今天在macos下编译libyuv,出现了这么一个错误:
Undefined symbols for architecture x86_64:
"_jpeg_CreateDecompress", referenced from:
libyuv::MJpegDecoder::MJpegDecoder() in mjpeg_decoder.cc.o
"_jpeg_abort_decompress", referenced from:
libyuv::MJpegDecoder::UnloadFrame() in mjpeg_decoder.cc.o
libyuv::MJpegDecoder::FinishDecode() in mjpeg_decoder.cc.o
"_jpeg_destroy_decompress", referenced from:
libyuv::MJpegDecoder::~MJpegDecoder() in mjpeg_decoder.cc.o
"_jpeg_read_header", referenced from:
libyuv::MJpegDecoder::LoadFrame(unsigned char const*, unsigned long) in mjpeg_decoder.cc.o
"_jpeg_read_raw_data", referenced from:
libyuv::MJpegDecoder::DecodeImcuRow() in mjpeg_decoder.cc.o
"_jpeg_resync_to_restart", referenced from:
libyuv::MJpegDecoder::MJpegDecoder() in mjpeg_decoder.cc.o
"_jpeg_start_decompress", referenced from:
libyuv::MJpegDecoder::StartDecode() in mjpeg_decoder.cc.o
"_jpeg_std_error", referenced from:
libyuv::MJpegDecoder::MJpegDecoder() in mjpeg_decoder.cc.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[2]: *** [libyuv.dylib] Error 1
make[1]: *** [CMakeFiles/yuv_shared.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
只需要修改CMakeLists.txt
文件里的:
target_link_libraries( yuvconvert ${JPEG_LIBRARY} )
将它改为:
target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} )
然后重新cmake && make,成功编译出libyuv.dylib