glassechidna / zxing-cpp

ZXing C++ Library
Apache License 2.0
610 stars 435 forks source link

Fails to build shared libs #64

Open yurivict opened 6 years ago

yurivict commented 6 years ago

Getting these errors:

[1/1] : && /usr/bin/c++  -O2 -pipe -fno-omit-frame-pointer -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -fno-omit-frame-pointer  -DLIBICONV_PLUG -O2 -pipe -fno-omit-frame-pointer -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -fno-omit-frame-pointer  -DLIBICONV_PLUG  -fstack-protector CMakeFiles/zxing.dir/cli/src/ImageReaderSource.cpp.o CMakeFiles/zxing.dir/cli/src/jpgd.cpp.o CMakeFiles/zxing.dir/cli/src/lodepng.cpp.o CMakeFiles/zxing.dir/cli/src/main.cpp.o  -o zxing  -Wl,-rpath,/usr/ports/textproc/zxing-cpp/work/.build: libzxing.so -lc && :
FAILED: zxing 
: && /usr/bin/c++  -O2 -pipe -fno-omit-frame-pointer -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -fno-omit-frame-pointer  -DLIBICONV_PLUG -O2 -pipe -fno-omit-frame-pointer -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -fno-omit-frame-pointer  -DLIBICONV_PLUG  -fstack-protector CMakeFiles/zxing.dir/cli/src/ImageReaderSource.cpp.o CMakeFiles/zxing.dir/cli/src/jpgd.cpp.o CMakeFiles/zxing.dir/cli/src/lodepng.cpp.o CMakeFiles/zxing.dir/cli/src/main.cpp.o  -o zxing  -Wl,-rpath,/usr/ports/textproc/zxing-cpp/work/.build: libzxing.so -lc && :
libzxing.so: undefined reference to `cv::Mat::deallocate()'
libzxing.so: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
libzxing.so: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
libzxing.so: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
libzxing.so: undefined reference to `cv::fastFree(void*)'
bygreencn commented 6 years ago

call 'pkg-config opencv --cflags --libs' to check opencv path, and add -lopencv_core -lopencv_imgproc -lopencv_highgui to link script.

yurivict commented 6 years ago

This is a bug that it doesn't use ${OpenCV_LIBRARIES} to link zxing in this line: https://github.com/glassechidna/zxing-cpp/blob/master/CMakeLists.txt#L86

yurivict commented 6 years ago

@tm-drtina Could you please fix CMakeLists.txt?