[Libav-user] libavformat.56.dylib

Thinc Tank thinctank at gmail.com
Thu Oct 21 19:52:49 EEST 2021


hello,

i am installing essentia (https://github.com/MTG/essentia/issues/1190) for
macOS and Xcode. after finishing the installation process, i was unable to
build essentia because i am missing the library libavformat.56.dylib. i
downloaded ffmpeg "Nash," which includes libavformat.56.dylib, but i could
not configure this version of ffmpeg for obvious reasons. therefore, i
tried to make libavformat in terminal using the Makefile. unfortunately,
although there is a Makefile, i received this output from terminal:

Makefile:1: ../config.mak: No such file or directory
make: *** No rule to make target `../config.mak'.  Stop.

because i was unable to configure the contents of the libavformat folder, i
tried to create a dylib using the .c files using this method:
https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/CreatingDynamicLibraries.html

i ran a test using the gcc command, which looks promising only because it
seems like the process itself works. here is my console output:

banana.ash at bananaash-2 libavformat % gcc -dynamiclib 4xm.c a64.c aacdec.c
ac3dec.c act.c adp.c adtsenc.c adxdec.c aea.c afc.c aiffdec.c aiffenc.c -o
libavformat.56.dylib -current_version 1.0 -compatibility_version 1.0
In file included from 4xm.c:32:
./avformat.h:1847:16: error: redefinition of 'AVPacketList'
typedef struct AVPacketList {
               ^
/usr/local/include/libavcodec/packet.h:404:16: note: previous definition is
here
typedef struct AVPacketList {
               ^
In file included from 4xm.c:32:
./avformat.h:1850:3: error: typedef redefinition with different types
('struct (anonymous struct at ./avformat.h:1847:16)' vs 'struct
AVPacketList')
} AVPacketList;
  ^
/usr/local/include/libavcodec/packet.h:407:3: note: previous definition is
here
} AVPacketList;
  ^
In file included from 4xm.c:33:
In file included from ./internal.h:26:
./os_support.h:30:10: fatal error: 'config.h' file not found
#include "config.h"
         ^~~~~~~~~~
3 errors generated.
a64.c:23:10: fatal error: 'libavcodec/bytestream.h' file not found
#include "libavcodec/bytestream.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from aacdec.c:24:
./avformat.h:1847:16: error: redefinition of 'AVPacketList'
typedef struct AVPacketList {
               ^
/usr/local/include/libavcodec/packet.h:404:16: note: previous definition is
here
typedef struct AVPacketList {
               ^
In file included from aacdec.c:24:
./avformat.h:1850:3: error: typedef redefinition with different types
('struct (anonymous struct at ./avformat.h:1847:16)' vs 'struct
AVPacketList')
} AVPacketList;
  ^
/usr/local/include/libavcodec/packet.h:407:3: note: previous definition is
here
} AVPacketList;
  ^
In file included from aacdec.c:25:
In file included from ./internal.h:26:
./os_support.h:30:10: fatal error: 'config.h' file not found
#include "config.h"
         ^~~~~~~~~~
3 errors generated.
In file included from ac3dec.c:24:
./avformat.h:1847:16: error: redefinition of 'AVPacketList'
typedef struct AVPacketList {
               ^
/usr/local/include/libavcodec/packet.h:404:16: note: previous definition is
here
typedef struct AVPacketList {
               ^
In file included from ac3dec.c:24:
./avformat.h:1850:3: error: typedef redefinition with different types
('struct (anonymous struct at ./avformat.h:1847:16)' vs 'struct
AVPacketList')
} AVPacketList;
  ^
/usr/local/include/libavcodec/packet.h:407:3: note: previous definition is
here
} AVPacketList;
  ^
ac3dec.c:31:5: error: use of undeclared identifier 'AC3HeaderInfo'
    AC3HeaderInfo *phdr = NULL;
    ^
ac3dec.c:31:20: error: use of undeclared identifier 'phdr'
    AC3HeaderInfo *phdr = NULL;
                   ^
ac3dec.c:32:5: error: use of undeclared identifier 'GetBitContext'
    GetBitContext gbc;
    ^
ac3dec.c:55:17: error: implicit declaration of function 'init_get_bits' is
invalid in C99 [-Werror,-Wimplicit-function-declaration]
                init_get_bits(&gbc, buf3, 54);
                ^
ac3dec.c:55:32: error: use of undeclared identifier 'gbc'
                init_get_bits(&gbc, buf3, 54);
                               ^
ac3dec.c:57:17: error: implicit declaration of function 'init_get_bits' is
invalid in C99 [-Werror,-Wimplicit-function-declaration]
                init_get_bits(&gbc, buf2, 54);
                ^
ac3dec.c:57:32: error: use of undeclared identifier 'gbc'
                init_get_bits(&gbc, buf2, 54);
                               ^
ac3dec.c:58:16: error: implicit declaration of function
'avpriv_ac3_parse_header2' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
            if(avpriv_ac3_parse_header2(&gbc, &phdr) < 0)
               ^
ac3dec.c:58:16: note: did you mean 'av_ac3_parse_header'?
/usr/local/include/libavcodec/ac3_parser.h:32:5: note:
'av_ac3_parse_header' declared here
int av_ac3_parse_header(const uint8_t *buf, size_t size,
    ^
ac3dec.c:58:42: error: use of undeclared identifier 'gbc'
            if(avpriv_ac3_parse_header2(&gbc, &phdr) < 0)
                                         ^
ac3dec.c:58:48: error: use of undeclared identifier 'phdr'
            if(avpriv_ac3_parse_header2(&gbc, &phdr) < 0)
                                               ^
ac3dec.c:60:23: error: use of undeclared identifier 'phdr'
            if(buf2 + phdr->frame_size > end)
                      ^
ac3dec.c:63:17: error: implicit declaration of function 'av_assert0' is
invalid in C99 [-Werror,-Wimplicit-function-declaration]
                av_assert0(phdr->frame_size <= sizeof(buf3));
                ^
ac3dec.c:63:28: error: use of undeclared identifier 'phdr'
                av_assert0(phdr->frame_size <= sizeof(buf3));
                           ^
ac3dec.c:64:28: error: use of undeclared identifier 'phdr'
                for(i=8; i<phdr->frame_size; i+=2) {
                           ^
ac3dec.c:69:60: error: use of undeclared identifier 'gbc'
            if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, gbc.buffer + 2,
phdr->frame_size - 2))
                                                           ^
ac3dec.c:69:76: error: use of undeclared identifier 'phdr'
            if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, gbc.buffer + 2,
phdr->frame_size - 2))
                                                                           ^
ac3dec.c:71:17: error: use of undeclared identifier 'phdr'
            if (phdr->bitstream_id > 10)
                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
In file included from act.c:21:
./avformat.h:1847:16: error: redefinition of 'AVPacketList'
typedef struct AVPacketList {
               ^
/usr/local/include/libavcodec/packet.h:404:16: note: previous definition is
here
typedef struct AVPacketList {
               ^
In file included from act.c:21:
./avformat.h:1850:3: error: typedef redefinition with different types
('struct (anonymous struct at ./avformat.h:1847:16)' vs 'struct
AVPacketList')
} AVPacketList;
  ^
/usr/local/include/libavcodec/packet.h:407:3: note: previous definition is
here
} AVPacketList;
  ^
In file included from act.c:22:
In file included from ./riff.h:33:
In file included from ./internal.h:26:
./os_support.h:30:10: fatal error: 'config.h' file not found
#include "config.h"
         ^~~~~~~~~~
3 errors generated.
In file included from adp.c:24:
./avformat.h:1847:16: error: redefinition of 'AVPacketList'
typedef struct AVPacketList {
               ^
/usr/local/include/libavcodec/packet.h:404:16: note: previous definition is
here
typedef struct AVPacketList {
               ^
In file included from adp.c:24:
./avformat.h:1850:3: error: typedef redefinition with different types
('struct (anonymous struct at ./avformat.h:1847:16)' vs 'struct
AVPacketList')
} AVPacketList;
  ^
/usr/local/include/libavcodec/packet.h:407:3: note: previous definition is
here
} AVPacketList;
  ^
In file included from adp.c:25:
In file included from ./internal.h:26:
./os_support.h:30:10: fatal error: 'config.h' file not found
#include "config.h"
         ^~~~~~~~~~
3 errors generated.
adtsenc.c:23:10: fatal error: 'libavcodec/get_bits.h' file not found
#include "libavcodec/get_bits.h"
         ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from adxdec.c:27:
./avformat.h:1847:16: error: redefinition of 'AVPacketList'
typedef struct AVPacketList {
               ^
/usr/local/include/libavcodec/packet.h:404:16: note: previous definition is
here
typedef struct AVPacketList {
               ^
In file included from adxdec.c:27:
./avformat.h:1850:3: error: typedef redefinition with different types
('struct (anonymous struct at ./avformat.h:1847:16)' vs 'struct
AVPacketList')
} AVPacketList;
  ^
/usr/local/include/libavcodec/packet.h:407:3: note: previous definition is
here
} AVPacketList;
  ^
In file included from adxdec.c:28:
In file included from ./internal.h:26:
./os_support.h:30:10: fatal error: 'config.h' file not found
#include "config.h"
         ^~~~~~~~~~
3 errors generated.
In file included from aea.c:25:
./avformat.h:1847:16: error: redefinition of 'AVPacketList'
typedef struct AVPacketList {
               ^
/usr/local/include/libavcodec/packet.h:404:16: note: previous definition is
here
typedef struct AVPacketList {
               ^
In file included from aea.c:25:
./avformat.h:1850:3: error: typedef redefinition with different types
('struct (anonymous struct at ./avformat.h:1847:16)' vs 'struct
AVPacketList')
} AVPacketList;
  ^
/usr/local/include/libavcodec/packet.h:407:3: note: previous definition is
here
} AVPacketList;
  ^
aea.c:103:23: error: implicit declaration of function
'NULL_IF_CONFIG_SMALL' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
    .long_name      = NULL_IF_CONFIG_SMALL("MD STUDIO audio"),
                      ^
aea.c:103:23: warning: incompatible integer to pointer conversion
initializing 'const char *' with an expression of type 'int'
[-Wint-conversion]
    .long_name      = NULL_IF_CONFIG_SMALL("MD STUDIO audio"),
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aea.c:103:23: error: initializer element is not a compile-time constant
    .long_name      = NULL_IF_CONFIG_SMALL("MD STUDIO audio"),
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 4 errors generated.
In file included from afc.c:23:
./avformat.h:1847:16: error: redefinition of 'AVPacketList'
typedef struct AVPacketList {
               ^
/usr/local/include/libavcodec/packet.h:404:16: note: previous definition is
here
typedef struct AVPacketList {
               ^
In file included from afc.c:23:
./avformat.h:1850:3: error: typedef redefinition with different types
('struct (anonymous struct at ./avformat.h:1847:16)' vs 'struct
AVPacketList')
} AVPacketList;
  ^
/usr/local/include/libavcodec/packet.h:407:3: note: previous definition is
here
} AVPacketList;
  ^
In file included from afc.c:24:
In file included from ./internal.h:26:
./os_support.h:30:10: fatal error: 'config.h' file not found
#include "config.h"
         ^~~~~~~~~~
3 errors generated.
In file included from aiffdec.c:25:
./avformat.h:1847:16: error: redefinition of 'AVPacketList'
typedef struct AVPacketList {
               ^
/usr/local/include/libavcodec/packet.h:404:16: note: previous definition is
here
typedef struct AVPacketList {
               ^
In file included from aiffdec.c:25:
./avformat.h:1850:3: error: typedef redefinition with different types
('struct (anonymous struct at ./avformat.h:1847:16)' vs 'struct
AVPacketList')
} AVPacketList;
  ^
/usr/local/include/libavcodec/packet.h:407:3: note: previous definition is
here
} AVPacketList;
  ^
In file included from aiffdec.c:26:
In file included from ./internal.h:26:
./os_support.h:30:10: fatal error: 'config.h' file not found
#include "config.h"
         ^~~~~~~~~~
3 errors generated.
In file included from aiffenc.c:26:
./avformat.h:1847:16: error: redefinition of 'AVPacketList'
typedef struct AVPacketList {
               ^
/usr/local/include/libavcodec/packet.h:404:16: note: previous definition is
here
typedef struct AVPacketList {
               ^
In file included from aiffenc.c:26:
./avformat.h:1850:3: error: typedef redefinition with different types
('struct (anonymous struct at ./avformat.h:1847:16)' vs 'struct
AVPacketList')
} AVPacketList;
  ^
/usr/local/include/libavcodec/packet.h:407:3: note: previous definition is
here
} AVPacketList;
  ^
In file included from aiffenc.c:27:
In file included from ./internal.h:26:
./os_support.h:30:10: fatal error: 'config.h' file not found
#include "config.h"
         ^~~~~~~~~~
3 errors generated.

i have some questions about this approach:

1. assuming i used this method to create a dylib, would it be safe or valid
to use?
2. the gcc command includes .c files, but there are .h files in the folder
as well. do i need to link them? if so, how?
3. are there less adhoc methods for obtaining a libavformat.56.dylib
library?

thanks in advance.

tk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20211021/b6319ef7/attachment.htm>


More information about the Libav-user mailing list