Undefined symbols for architecture arm64:
"_Decoder_Interface_init", referenced from:
EM_DecodeAMRFileToWAVEFile(char const*, char const*) in amrFileCodec.o
"_Decoder_Interface_Decode", referenced from:
EM_DecodeAMRFileToWAVEFile(char const*, char const*) in amrFileCodec.o
"_Decoder_Interface_exit", referenced from:
EM_DecodeAMRFileToWAVEFile(char const*, char const*) in amrFileCodec.o
"_Encoder_Interface_init", referenced from:
EM_EncodeWAVEFileToAMRFile(char const*, char const*, int, int) in amrFileCodec.o
"_Encoder_Interface_Encode", referenced from:
EM_EncodeWAVEFileToAMRFile(char const*, char const*, int, int) in amrFileCodec.o
"_Encoder_Interface_exit", referenced from:
EM_EncodeWAVEFileToAMRFile(char const*, char const*, int, int) in amrFileCodec.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
某天遇到編譯錯誤,操作一番,然后出現這個問題。這個問題當時困擾我和同事好久。上網翻找答案,都是講的arm64指令集的問題。但是對於解決這問題還是一臉懵逼的狀態。我晚上加班再查查了網上各類文章,試着改了改 Xcode項目 Build Settings -> Architectures的配置,如下圖:
一直在這改動Architectures所支持的arm64、arm64e、armv7、armv7s指令集,如下圖
但是還是解決不了,有的時候還出現了新的錯誤。錯誤我也就不摘出來了,我也不大清楚這類錯誤。
我轉而繼續看提示的錯誤,我發現了個amrFileCodec.o。shift+command+o 來一波,輸入amrFileCodec,如下圖
最后我定位到如下的文件
我給同事講了講,應該是這個文件編譯不通。同事之前做過環信的IM遇到這類問題,她意識到是缺少了2個.a文件,她上網找到這兩文件拖進項目。最后項目終於編譯終於通過解決這問題。
事后,同事也跟我說了下這兩文件的作用:IM音視頻需要這兩文件libopencore-amrwb.a(64位) 和 libopencore-amrnb.a(64位) 支持arm64,armv7,armv7s。我想到我查找這類文章的時候非常不方便,就寫下這篇文章與小伙伴們分享下,希望對大家有所幫助。