glassechidna / zxing-cpp

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

${OpenCV_LIBRARIES} needs to be added to zxing #84

Open yurivict opened 5 years ago

yurivict commented 5 years ago

It fails to link:

: && /usr/bin/c++  -O2 -pipe -fno-omit-frame-pointer -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -fno-omit-frame-pointer  -DLIBICONV_PLUG -std=c++11 -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::fastFree(void*)'

The FreeBSD port has this patch to fix this:

--- CMakeLists.txt.orig 2018-07-09 07:47:42 UTC
+++ CMakeLists.txt
@@ -83,7 +83,7 @@ file(GLOB_RECURSE ZXING_FILES
 )

 add_executable(zxing ${ZXING_FILES})
-target_link_libraries(zxing libzxing)
+target_link_libraries(zxing libzxing ${OpenCV_LIBRARIES})

 install(TARGETS zxing libzxing EXPORT zxing-targets
        LIBRARY DESTINATION lib