elu
elu

Reputation: 1

Error compiling libx264: Undefined symbols for architecture x86_64

I have ffmpeg installed, and I am trying to compile libx264 but keep getting an error. Most of the results I've found from searching are about issues compiling ffmpeg or configuring it with libx264 but I can't seem to even get libx264 to compile.

Here is the error:

Undefined symbols for architecture x86_64:
  "_CFDataCreate", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
      _vda_h264_end_frame in libavcodec.a(vda_h264.o)
  "_CFDictionaryCreateMutable", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_CFDictionarySetValue", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_CFNumberCreate", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_CFRelease", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
      _vda_h264_end_frame in libavcodec.a(vda_h264.o)
  "_CVPixelBufferGetBaseAddress", referenced from:
      _vdadec_decode in libavcodec.a(vda_h264_dec.o)
  "_CVPixelBufferGetBaseAddressOfPlane", referenced from:
      _vdadec_decode in libavcodec.a(vda_h264_dec.o)
  "_CVPixelBufferGetBytesPerRow", referenced from:
      _vdadec_decode in libavcodec.a(vda_h264_dec.o)
  "_CVPixelBufferGetBytesPerRowOfPlane", referenced from:
      _vdadec_decode in libavcodec.a(vda_h264_dec.o)
  "_CVPixelBufferGetPixelFormatType", referenced from:
      _vda_decoder_callback in libavcodec.a(vda_h264.o)
  "_CVPixelBufferGetPlaneCount", referenced from:
      _vdadec_decode in libavcodec.a(vda_h264_dec.o)
  "_CVPixelBufferIsPlanar", referenced from:
      _vdadec_decode in libavcodec.a(vda_h264_dec.o)
  "_CVPixelBufferLockBaseAddress", referenced from:
      _vdadec_decode in libavcodec.a(vda_h264_dec.o)
  "_CVPixelBufferRelease", referenced from:
      _release_buffer in libavcodec.a(vda_h264_dec.o)
      _vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
      _vda_h264_uninit in libavcodec.a(vda_h264.o)
      _ff_vda_output_callback in libavcodec.a(vda_h264.o)
      _release_buffer in libavcodec.a(vda_h264.o)
      _vda_h264_release_buffer in libavcodec.a(vda_h264.o)
  "_CVPixelBufferRetain", referenced from:
      _vdadec_decode in libavcodec.a(vda_h264_dec.o)
      _vda_decoder_callback in libavcodec.a(vda_h264.o)
      _ff_vda_output_callback in libavcodec.a(vda_h264.o)
  "_CVPixelBufferUnlockBaseAddress", referenced from:
      _release_buffer in libavcodec.a(vda_h264_dec.o)
  "_VDADecoderCreate", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_VDADecoderDecode", referenced from:
      _vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
      _vda_h264_end_frame in libavcodec.a(vda_h264.o)
  "_VDADecoderDestroy", referenced from:
      _ff_vda_destroy_decoder in libavcodec.a(vda_h264.o)
  "_VDADecoderFlush", referenced from:
      _vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
      _vda_h264_end_frame in libavcodec.a(vda_h264.o)
  "_iconv", referenced from:
      _avcodec_decode_subtitle2 in libavcodec.a(utils.o)
  "_iconv_close", referenced from:
      _avcodec_open2 in libavcodec.a(utils.o)
      _avcodec_decode_subtitle2 in libavcodec.a(utils.o)
  "_iconv_open", referenced from:
      _avcodec_open2 in libavcodec.a(utils.o)
      _avcodec_decode_subtitle2 in libavcodec.a(utils.o)
  "_kCFAllocatorDefault", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
      _vda_h264_end_frame in libavcodec.a(vda_h264.o)
  "_kCFCoreFoundationVersionNumber", referenced from:
      _vdadec_init in libavcodec.a(vda_h264_dec.o)
  "_kCFTypeDictionaryKeyCallBacks", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_kCFTypeDictionaryValueCallBacks", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_kCVPixelBufferIOSurfacePropertiesKey", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_kCVPixelBufferPixelFormatTypeKey", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_kVDADecoderConfiguration_Height", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_kVDADecoderConfiguration_SourceFormat", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_kVDADecoderConfiguration_Width", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_kVDADecoderConfiguration_avcCData", referenced from:
      _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
      _ff_vda_default_init in libavcodec.a(vda_h264.o)
  "_swr_alloc", referenced from:
      _opus_decode_init in libavcodec.a(opusdec.o)
  "_swr_close", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
      _opus_decode_flush in libavcodec.a(opusdec.o)
  "_swr_convert", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
  "_swr_free", referenced from:
      _opus_decode_close in libavcodec.a(opusdec.o)
  "_swr_init", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
  "_swr_is_initialized", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.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: *** [x264] Error 1

Update: I worked around this by just using homebrew to install ffmpeg with libx264.

Upvotes: 0

Views: 3191

Answers (2)

larod
larod

Reputation: 435

You need to add the following frameworks to your project: VideoDecodeAcceleration.framework, CoreVideo.framework, CoreFoundation.framework

To add them select your target, go to "Build Phases -> Link Binary With Libraries" click the + button and select your frameworks. Everything should compile after that.

Upvotes: 4

nobody555
nobody555

Reputation: 2374

If you only want libx264 and don't need x264 cli than disable lavf input during configure with ./configure --disable-lavf because it is problem with libavcodec/libavformat (lavf) dependencies.

Upvotes: 1

Related Questions