Can not link c++ app with opencv 3.1.1 only in Ubuntu
System information (version) Opencv install from source follow this instruction https://opencv-java-tutorials.readthe...
$ pkg-config --modversion opencv 3.3.1 $ uname -r 4.15.13-041513-generic Ubuntu 16.04 $ g++ --version g++ (Ubuntu 7.3.0-16ubuntu3) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Detailed description Opencv build ok Java application can load opencv library and work ok. But c++ app link error $g++ -std=c++11 -ggdb pkg-config --cflags opencv decode.cpp -o decode -ldl pkg-config --libs opencv /usr/bin/x86_64-linux-gnu-ld: /usr/local/lib/libopencv_core.a(opencl_core.cpp.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5' /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status
Steps to reproduce Compile demo code. Code compile and work well on os x, but error linking in Ubuntu https://github.com/hitanshu-dhawan/Im...
are you using static libs ?
try putting
-ldl
to the END of the cmdlineGot this if I put -ldl to the END. All bunch of un resolve of opencv /usr/local/lib/libopencv_core.a(arithm.cpp.o): In function
cv::hal::xor8u(unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned char*, unsigned long, int, int, void*)': arithm.cpp:(.text._ZN2cv3hal5xor8uEPKhmS2_mPhmiiPv+0x66): undefined reference to
ippicviXor_8u_C1R'......... .........yea, and this "whack a mole" game will go on & on, since it only resolves 1 lib at a time. (now it's about ipp)
IF you want to use it from c++, maybe it's easier, to rebuild the opencv libs with BUILD_SHARED_LIBS=ON (and no java or python bindings)
Very sad to hear about that. So I can not co exist Java and SHARED-LIBS. Any how to install another instance of Opencv to other --prefix? Thank you for your help any way I wonder why it work on os x with opencv-java enable?
you CAN use java or python with BUILD_SHARED_LIBS=ON !
it's just, that the opencv_java.so will depend on the other opencv libs (so you can't simply move it to another box)
Got it. Thanks.