x265已經編譯成功,但是ffmpeg/configure出現錯誤
ERROR: x265 not found using pkg-config
看了一下config.log,出了一坨“Undefined symbols for architecture x86_64” 的錯誤
Undefined symbols for architecture x86_64: "vtable for __cxxabiv1::__class_type_info", referenced from: ... "vtable for __cxxabiv1::__si_class_type_info", referenced from: ... "vtable for __cxxabiv1::__vmi_class_type_info", referenced from: ... ... ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ERROR: x265 not found using pkg-config
google 了半天,有些帖子說在x265.pc的“Libs.private:”里添加“-lstdc++”能解決。
- Libs.private: -lto_library -lc++ -ldl
+ Libs.private: -lto_library -lc++ -lstdc++ -ldl
試了一下,確實可以。
原來是蘋果對應GNU的libstdc++搞了個自己的libc++,導致Mac下GCC鏈接出了問題。自動化編譯時在腳本里添加一行
export LDFLAGS="${LDFLAGS} -lstdc++"
就好。MAC和linux下都能順利編過。因為Linux上本來就是使用的libstdc++。