kewlbear/FFmpeg-iOS-build-script

Static libraries giving architecture error

tarunseera opened this issue ยท 18 comments

I am able to compile ffmpeg library but when integrate static library of ffmpeg its still giving undefined symbol error for various architecture.
I have tried with http://sourceforge.net/projects/ffmpeg-ios/postdownload?source=dlp too but this is giving same error
Undefined symbols for architecture armv7:
"_BZ2_bzDecompressInit", referenced from:
_matroska_decode_buffer in libavformat.a(matroskadec.o)
"_iconv", referenced from:
_avcodec_decode_subtitle2 in libavcodec.a(utils.o)
"_BZ2_bzDecompress", referenced from:
_matroska_decode_buffer in libavformat.a(matroskadec.o)
"_BZ2_bzDecompressEnd", referenced from:
_matroska_decode_buffer in libavformat.a(matroskadec.o)
"_iconv_open", referenced from:
_avcodec_open2 in libavcodec.a(utils.o)
_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)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

You have to link with libbz2.dylib and libiconv.dylib.

Thanks, Everything is fine now :)

Glad I could help.

Thanks . I encounter the same situation, and It can work for me .

I don't know if it changed, but I had to link against libbz2.1.0.dylib for it to work, libbz2.dylib didn't.

HI all I'm also phasing same issue i just add above lib but still it is showing some errors like below

Undefined symbols for architecture x86_64:
"_inflate", referenced from:
_http_read in libffmpeg.a(http.o)
_matroska_decode_buffer in libffmpeg.a(matroskadec.o)
_rtmp_open in libffmpeg.a(rtmpproto.o)
"_inflateEnd", referenced from:
_http_close in libffmpeg.a(http.o)
_http_read_header in libffmpeg.a(http.o)
_matroska_decode_buffer in libffmpeg.a(matroskadec.o)
_rtmp_open in libffmpeg.a(rtmpproto.o)
"inflateInit2", referenced from:
_http_read_header in libffmpeg.a(http.o)
"inflateInit", referenced from:
_matroska_decode_buffer in libffmpeg.a(matroskadec.o)
_rtmp_open in libffmpeg.a(rtmpproto.o)
"_uncompress", referenced from:
_ff_id3v2_read in libffmpeg.a(id3v2.o)
_mov_read_cmov in libffmpeg.a(mov.o)
(maybe you meant: _ssl3_do_uncompress)
"_zlibCompileFlags", referenced from:
_http_read_header in libffmpeg.a(http.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

please help me

Have you link libz?

yes libbz2.0.1.tbd and libbz2.tbd in xcode 7.2

You need libz instead of libbz2. By the way libbz2 is just a symlink to libbz2.0.1, so you don't have to link both.

Thanks its working now

I have linked libz, libiconv, libbz, but the errors are remains the same:
Undefined symbols for architecture x86_64:
"sws_getContext(int, int, AVPixelFormat, int, int, AVPixelFormat, int, SwsFilter_, SwsFilter_, double const*)", referenced from:

Do anyone have some idea? I am getting mad...

@kewlbear thank! you saved my day.

Why does everyone always say "You have to link XYZ" but never "You have to link XYZ and here's how to do that"? Okay--so now I know what I have to do, but I have no idea how...

@tjayrush Grab a good book on Xcode or google. You should learn such a basic stuff elsewhere.
.

I am getting error

Undefined symbols for architecture arm64:
"_CMTimeMake", referenced from:
_vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
"_kCMTimeInvalid", referenced from:
_vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
"_CMSampleBufferGetSampleAttachmentsArray", referenced from:
_vtenc_frame in libavcodec.a(videotoolboxenc.o)
"_kCMSampleAttachmentKey_NotSync", referenced from:
_vtenc_frame in libavcodec.a(videotoolboxenc.o)
"_CMSampleBufferGetTotalSampleSize", referenced from:
_vtenc_frame in libavcodec.a(videotoolboxenc.o)
"_CMSampleBufferGetDataBuffer", referenced from:
_vtenc_frame in libavcodec.a(videotoolboxenc.o)
"_CMSampleBufferGetFormatDescription", referenced from:
_vtenc_frame in libavcodec.a(videotoolboxenc.o)
_vtenc_output_callback in libavcodec.a(videotoolboxenc.o)
"_CMBlockBufferCopyDataBytes", referenced from:
_vtenc_frame in libavcodec.a(videotoolboxenc.o)
"_BZ2_bzDecompress", referenced from:
_matroska_decode_buffer in libavformat.a(matroskadec.o)
"_kCMTimeIndefinite", referenced from:
_vtenc_init in libavcodec.a(videotoolboxenc.o)
_vtenc_frame in libavcodec.a(videotoolboxenc.o)
_vtenc_close in libavcodec.a(videotoolboxenc.o)
"_CMBlockBufferCreateWithMemoryBlock", referenced from:
_videotoolbox_common_end_frame in libavcodec.a(videotoolbox.o)
"_CMSampleBufferCreate", referenced from:
_videotoolbox_common_end_frame in libavcodec.a(videotoolbox.o)
"_BZ2_bzDecompressInit", referenced from:
_matroska_decode_buffer in libavformat.a(matroskadec.o)
"_kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms", referenced from:
_videotoolbox_default_init in libavcodec.a(videotoolbox.o)
"_CMSampleBufferGetDecodeTimeStamp", referenced from:
_vtenc_frame in libavcodec.a(videotoolboxenc.o)
"_CMVideoFormatDescriptionCreate", referenced from:
_videotoolbox_default_init in libavcodec.a(videotoolbox.o)
"_CMVideoFormatDescriptionGetH264ParameterSetAtIndex", referenced from:
_vtenc_frame in libavcodec.a(videotoolboxenc.o)
_get_params_size in libavcodec.a(videotoolboxenc.o)
_copy_param_sets in libavcodec.a(videotoolboxenc.o)
"_CMSampleBufferGetPresentationTimeStamp", referenced from:
_vtenc_frame in libavcodec.a(videotoolboxenc.o)
"_BZ2_bzDecompressEnd", referenced from:
_matroska_decode_buffer in libavformat.a(matroskadec.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have already added

libiconv.tdb, libz.tdb,videotoolbox.framework,audiotoolbox.framework

Please help

I guess from the prefix โ€œCMโ€ you need CoreMedia framework. If you encounter this kind of error, you can always google the symbol causing the error.

@kewlbear That works , Thank you so much. I did't noticed CM ... 100 Thumbs up

Thank you for the CoreMedia.framework solution that helped me to fix an issue in another library.