DevonCrawford / Video-Editing-Automation

Toolkit of algorithms to automate the video editing process
GNU General Public License v3.0
1.17k stars 161 forks source link

Undefined Symbols: Linker error for Mac OSX #11

Closed connorsoohoo closed 5 years ago

connorsoohoo commented 5 years ago

I built the ffmpeg library successfully on Mac OSX and I was trying to build your Video Automation project. I got the following linker error. Has anyone else run into this issue and know a solution?

cc   bin/examples/ffmpeg/demuxing_decoding.o    -o bin/examples/ffmpeg/demuxing_decoding
Undefined symbols for architecture x86_64:
  "_av_dict_set", referenced from:
      _open_codec_context in demuxing_decoding.o
  "_av_dump_format", referenced from:
      _main in demuxing_decoding.o
  "_av_find_best_stream", referenced from:
      _open_codec_context in demuxing_decoding.o
  "_av_frame_alloc", referenced from:
      _main in demuxing_decoding.o
  "_av_frame_free", referenced from:
      _main in demuxing_decoding.o
  "_av_frame_unref", referenced from:
      _decode_packet in demuxing_decoding.o
  "_av_free", referenced from:
      _main in demuxing_decoding.o
  "_av_get_bytes_per_sample", referenced from:
      _decode_packet in demuxing_decoding.o
  "_av_get_media_type_string", referenced from:
      _open_codec_context in demuxing_decoding.o
  "_av_get_packed_sample_fmt", referenced from:
      _main in demuxing_decoding.o
  "_av_get_pix_fmt_name", referenced from:
      _main in demuxing_decoding.o
      _decode_packet in demuxing_decoding.o
  "_av_get_sample_fmt_name", referenced from:
      _main in demuxing_decoding.o
      _get_format_from_sample_fmt in demuxing_decoding.o
  "_av_image_alloc", referenced from:
      _main in demuxing_decoding.o
  "_av_image_copy", referenced from:
      _decode_packet in demuxing_decoding.o
  "_av_init_packet", referenced from:
      _main in demuxing_decoding.o
  "_av_packet_unref", referenced from:
      _main in demuxing_decoding.o
  "_av_read_frame", referenced from:
      _main in demuxing_decoding.o
  "_av_sample_fmt_is_planar", referenced from:
      _main in demuxing_decoding.o
  "_av_seek_frame", referenced from:
      _main in demuxing_decoding.o
  "_av_strerror", referenced from:
      _av_make_error_string in demuxing_decoding.o
  "_avcodec_alloc_context3", referenced from:
      _open_codec_context in demuxing_decoding.o
  "_avcodec_decode_audio4", referenced from:
      _decode_packet in demuxing_decoding.o
  "_avcodec_decode_video2", referenced from:
      _decode_packet in demuxing_decoding.o
  "_avcodec_find_decoder", referenced from:
      _open_codec_context in demuxing_decoding.o
  "_avcodec_free_context", referenced from:
      _main in demuxing_decoding.o
  "_avcodec_open2", referenced from:
      _open_codec_context in demuxing_decoding.o
  "_avcodec_parameters_to_context", referenced from:
      _open_codec_context in demuxing_decoding.o
  "_avformat_close_input", referenced from:
      _main in demuxing_decoding.o
  "_avformat_find_stream_info", referenced from:
      _main in demuxing_decoding.o
  "_avformat_open_input", referenced from:
      _main in demuxing_decoding.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: *** [bin/examples/ffmpeg/demuxing_decoding] Error 1
connorsoohoo commented 5 years ago

I resolved the issue. I dug a little deeper and found that it was having trouble finding packages that were specified by pkgconfig. I resolved it by explicitly adding the following to my pkgconfig path.

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

Also for Mac OSX make sure you install ffmpeg using brew (i.e. brew install ffmpeg).