Opened 5 years ago

Closed 4 years ago

#2784 closed defect (fixed)

MacOS: building minimal, audio-only version fails with linker error

Reported by: milgner Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: osx
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

In order to build a minimal, audio-decoding-only of ffmpeg I created this longish configure command line. It builds on Linux but strangely enough fails when executing on MacOS 10.8.
First I disable all features, then I add back in everything I actually might need.

./configure --prefix=../../dist --disable-static --enable-shared --disable-programs --disable-doc --disable-everything --enable-decoder=aac --enable-decoder=aac_latm --enable-decoder=mp1 --enable-decoder=mp2 --enable-decoder=mp3 --enable-decoder=mp3float --enable-decoder=mp3adufloat --enable-decoder=mp3adu --enable-decoder=mp3on4 --enable-decoder=mp3on4float --enable-decoder=vorbis --enable-decoder=flac --enable-decoder=wavpack --enable-decoder=wmalossless --enable-decoder=wmapro --enable-decoder=wmav1 --enable-decoder=wmav2 --enable-decoder=pcm_alaw --enable-decoder=pcm_bluray --enable-decoder=pcm_dvd --enable-decoder=pcm_f32be --enable-decoder=pcm_f32le --enable-decoder=pcm_f64be --enable-decoder=pcm_f64le --enable-decoder=pcm_lxf --enable-decoder=pcm_mulaw --enable-decoder=pcm_s16be --enable-decoder=pcm_s16be_planar --enable-decoder=pcm_s16le --enable-decoder=pcm_s16le_planar --enable-decoder=pcm_s24be --enable-decoder=pcm_s24daud --enable-decoder=pcm_s24le --enable-decoder=pcm_s24le_planar --enable-decoder=pcm_s32be --enable-decoder=pcm_s32le --enable-decoder=pcm_s32le_planar --enable-decoder=pcm_s8 --enable-decoder=pcm_s8_planar --enable-decoder=pcm_u16be --enable-decoder=pcm_u16le --enable-decoder=pcm_u24be --enable-decoder=pcm_u24le --enable-decoder=pcm_u32be --enable-decoder=pcm_u32le --enable-decoder=pcm_u8 --enable-bsf=mp3_header_decompress --enable-bsf=aac_adtstoasc --enable-bsf=chomp --enable-bsf=remove_extradata --disable-swscale --enable-swresample --enable-parser=aac --enable-parser=aac_latm --enable-parser=flac --enable-parser=ac3 --enable-parser=vorbis --enable-parser=mpegaudio --enable-demuxer=aac --enable-demuxer=aiff --enable-demuxer=flac --enable-demuxer=latm --enable-demuxer=mp3 --enable-demuxer=ogg --enable-demuxer=pcm_f32be --enable-demuxer=pcm_f32le --enable-demuxer=pcm_f64be --enable-demuxer=pcm_f64le --enable-demuxer=pcm_mulaw --enable-demuxer=pcm_s16be --enable-demuxer=pcm_s16le --enable-demuxer=pcm_s24be --enable-demuxer=pcm_s24le --enable-demuxer=pcm_s32be --enable-demuxer=pcm_s32le --enable-demuxer=pcm_s8 --enable-demuxer=pcm_u16be --enable-demuxer=pcm_u16le --enable-demuxer=pcm_u24be --enable-demuxer=pcm_u24le --enable-demuxer=pcm_u32be --enable-demuxer=pcm_u32le --enable-demuxer=pcm_u8 --enable-demuxer=wav --enable-protocol=file

Attached, find the make output. Also it looks like there are still video components built, like libavcodec/dirac.o, libavfilter/video.o - but I don't mind since it's probably minimal.

Attachments (1)

ffmpeg_build_output.txt (21.4 KB) - added by milgner 5 years ago.
Build output

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by milgner

Build output

comment:1 follow-up: Changed 5 years ago by cehoyos

  • Keywords osx added; MacOS removed
LD      libavfilter/libavfilter.3.dylib
Undefined symbols for architecture x86_64:
  "_av_find_input_format", referenced from:
      _ff_load_image in lavfutils.o

av_find_input_format is defined in libavformat/format.c which is compiled unconditionally so your problem is difficult to understand. Could you confirm that you did make distclean before testing and that no conflicting versions of dynamic FFmpeg libraries are installed on your system?

Also it looks like there are still video components built, like libavcodec/dirac.o

The ogg demuxer relies on dirac.o.

Unrelated: Your configure line will get more readable if you use wildcards and lists:
./configure --disable-demuxers --enable-demuxer=pcm*,flac,latm
(This is supported since a long time.)

--disable-everything originally was a debug option (that contrary to its name does not disable all components of FFmpeg), you may want to try --disable-all. As a side-effect, it will also fix the linking problem you reported (although that does not at all explain it).
(This option is not supported since a long time, it will not work on old versions.)

I don't think you will find pcm_bluray and pcm_dvd in any of the formats for which you enabled demuxers, the following should also work as expected:
./configure --disable-decoders --enable-decoder=pcm* --disable-decoder=pcm_bluray,pcm_dvd

comment:2 in reply to: ↑ 1 Changed 5 years ago by jamal

av_find_input_format is defined in libavformat/format.c which is compiled unconditionally so your problem is difficult to understand.

In this build, libavfilter/avcodec.o and libavfilter/lavfutils.o are compiled because of these lines in libavfilter's Makefile:

OBJS-$(CONFIG_AVCODEC)                       += avcodec.o
OBJS-$(CONFIG_AVFORMAT)                      += lavfutils.o

But when linking, neither avcoded or avformat are included in the FFLIBS variable because they are only added when certain filters are built, and all filters were disabled here.

Something like

FFLIBS-$(CONFIG_AVCODEC)  += avcodec
FFLIBS-$(CONFIG_AVFORMAT) += avformat

fixes this, and i think a patch doing this was submitted some time ago but was never committed for some reason.

comment:3 Changed 5 years ago by cehoyos

  • Reproduced by developer set
  • Status changed from new to open
$ ./configure --disable-everything --enable-shared --disable-static
$ make V=1
gcc -dynamiclib -Wl,-single_module -Wl,-install_name,/usr/local/lib/libavfilter.3.dylib,-current_version,3.82.100,-compatibility_version,3 -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,-dynamic,-search_paths_first -o libavfilter/libavfilter.3.dylib libavfilter/af_aformat.o libavfilter/af_anull.o libavfilter/allfilters.o libavfilter/audio.o libavfilter/avcodec.o libavfilter/avfilter.o libavfilter/avfiltergraph.o libavfilter/buffer.o libavfilter/buffersink.o libavfilter/buffersrc.o libavfilter/drawutils.o libavfilter/fifo.o libavfilter/formats.o libavfilter/graphdump.o libavfilter/graphparser.o libavfilter/lavfutils.o libavfilter/lswsutils.o libavfilter/opencl_allkernels.o libavfilter/pthread.o libavfilter/setpts.o libavfilter/transform.o libavfilter/trim.o libavfilter/vf_format.o libavfilter/vf_null.o libavfilter/video.o -lavutil -liconv -lm -lbz2 -lz
Undefined symbols:
  "_sws_scale", referenced from:
      _ff_scale_image in lswsutils.o
  "_av_read_frame", referenced from:
      _ff_load_image in lavfutils.o
  "_sws_getContext", referenced from:
      _ff_scale_image in lswsutils.o
  "_av_find_input_format", referenced from:
      _ff_load_image in lavfutils.o
  "_avcodec_open2", referenced from:
      _ff_load_image in lavfutils.o
  "_avcodec_close", referenced from:
      _ff_load_image in lavfutils.o
  "_sws_freeContext", referenced from:
      _ff_scale_image in lswsutils.o
  "_avcodec_decode_video2", referenced from:
      _ff_load_image in lavfutils.o
  "_avcodec_find_best_pix_fmt_of_2", referenced from:
      _pick_format in avfiltergraph.o
  "_avformat_close_input", referenced from:
      _ff_load_image in lavfutils.o
  "_avcodec_find_decoder", referenced from:
      _ff_load_image in lavfutils.o
  "_av_register_all", referenced from:
      _ff_load_image in lavfutils.o
  "_avcodec_alloc_frame", referenced from:
      _ff_load_image in lavfutils.o
  "_avformat_open_input", referenced from:
      _ff_load_image in lavfutils.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libavfilter/libavfilter.3.dylib] Error 1

comment:4 Changed 4 years ago by cehoyos

Still reproducible:

$ make V=1 ffmpeg
gcc -dynamiclib -Wl,-single_module -Wl,-install_name,/usr/local/lib/libavfilter.3.dylib,-current_version,3.92.100,-compatibility_version,3 -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,-dynamic,-search_paths_first -o libavfilter/libavfilter.3.dylib libavfilter/af_aformat.o libavfilter/af_anull.o libavfilter/allfilters.o libavfilter/audio.o libavfilter/avcodec.o libavfilter/avfilter.o libavfilter/avfiltergraph.o libavfilter/buffer.o libavfilter/buffersink.o libavfilter/buffersrc.o libavfilter/drawutils.o libavfilter/fifo.o libavfilter/formats.o libavfilter/graphdump.o libavfilter/graphparser.o libavfilter/opencl_allkernels.o libavfilter/pthread.o libavfilter/setpts.o libavfilter/transform.o libavfilter/trim.o libavfilter/vf_format.o libavfilter/vf_null.o libavfilter/video.o -lavutil -liconv -lm -lbz2 -lz 
Undefined symbols for architecture x86_64:
  "_avcodec_find_best_pix_fmt_of_2", referenced from:
      _pick_format in avfiltergraph.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libavfilter/libavfilter.3.dylib] Error 1

comment:5 Changed 4 years ago by michael

comment:6 Changed 4 years ago by cehoyos

  • Component changed from build system to avfilter
  • Resolution set to fixed
  • Status changed from open to closed
Note: See TracTickets for help on using tickets.