OpenCV error while compiling ros workspace - opencv

recently, after installing OpenCV3, I am not able to use Baxter on Ubuntu 14.04 64 bit OS. However, I removed OpenCV3 later on but the catkin_make on ros indigo workspace is giving following error-
Linking CXX executable /home/ravi/ros_ws/devel/lib/baxter_sim_hardware/baxter_emulator
[100%] Built target baxter_sim_io
CMakeFiles/baxter_emulator.dir/src/baxter_emulator.cpp.o: In function `baxter_en::baxter_emulator::publish(std::string const&)':
baxter_emulator.cpp:(.text+0x2087): undefined reference to `cv::imread(cv::String const&, int)'
CMakeFiles/baxter_emulator.dir/src/baxter_emulator.cpp.o: In function `cv::String::~String()':
baxter_emulator.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): undefined reference to `cv::String::deallocate()'
CMakeFiles/baxter_emulator.dir/src/baxter_emulator.cpp.o: In function `cv::String::String(std::string const&)':
baxter_emulator.cpp:(.text._ZN2cv6StringC2ERKSs[_ZN2cv6StringC5ERKSs]+0x69): undefined reference to `cv::String::allocate(unsigned long)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/ravi/ros_ws/devel/lib/baxter_sim_hardware/baxter_emulator] Error 1
make[1]: *** [baxter_simulator/baxter_sim_hardware/CMakeFiles/baxter_emulator.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j8 -l8" failed
OpenCV3 was installed from the source using this script. This script has installed some additional libraries as well. I removed OpenCV3 by following command-
cd OpenCV/build
sudo make unistall
sudo ldconfig
but catkin_make is still showing same error.

Related

Error building OpenCV in Ubuntu using cmake

Attempting to build open OpenCV in Ubuntu, following this tutorial (specifically the "Build core modules" section), and I get the following error:
[ 71%] Linking CXX executable ../../bin/opencv_test_highgui
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libfontconfig.so: undefined reference to 'uuid_parse#UUID_1.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libfontconfig.so: undefined reference to 'uuid_generate_random#UUID_1.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libfontconfig.so: undefined reference to 'uuid_unparse#UUID_1.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libfontconfig.so: undefined reference to 'uuid_copy#UUID_1.0'
collect2: error: ld returned 1 exit status
make[2]: *** [modules/highgui/CMakeFiles/opencv_test_highgui.dir/build.make:122: bin/opencv_test_highgui] Error 1
make1: *** [CMakeFiles/Makefile2:2754: modules/highgui/CMakeFiles/opencv_test_highgui.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
I imagine this is a missing dependency, but I'm having a hard time finding it. Anyone have a fix?

unable to compile opencv 3.4.4 from source

Running ubuntu with 5.3 kernel.
/usr/bin/ld: /usr/local/lib/libavcodec.a(vc1dsp_mmx.o): relocation R_X86_64_PC32 against symbol `ff_pw_9' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:307: recipe for target 'lib/libopencv_videoio.so.3.4.0' failed
make[2]: *** [lib/libopencv_videoio.so.3.4.0] Error 1
CMakeFiles/Makefile2:8259: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
Also:
ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1) 2.27
gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Any ideas ?

How to fix "undefined reference to symbol 'vxCannyEdgeDetectorNode'" error compiling openvx on yocto

I'm trying to compile the OpenCV version 4.1.0 whith OpenVX enabled on yocto but It is raising an "undefined referece" error. I already try to include the the "lm" library as a dependency, but I think that It is not available to Yocto. I also noticed that the VX/vx.h file was not present on the OpenCV or OpenVX sources. Does someone have some idea of how I can resolve this error?
CMakeFiles/example_openvx_no_wrappers.dir/no_wrappers.cpp.o: undefined reference to symbol 'vxCannyEdgeDetectorNode'
~/imx-yocto-bsp/build/tmp/sysroots/apalis-imx8/usr/lib/libOpenVX.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [bin/example_openvx_no_wrappers] Error 1
make[2]: Leaving directory `~/imx-yocto-bsp/build/tmp/work/aarch64-mx8qm-poky-linux/opencv/4.1.0+gitAUTOINC+371bba8f54_2c32791a9c_32e315a5b1_34e4206aef_fccf7cd6a4-r0/build'
make[1]: ***[samples/openvx/CMakeFiles/example_openvx_no_wrappers.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
In my opencv_4.1.0.bbappend I put the following PACKAGECONFIG:
PACKAGECONFIG[openvx] = " \
-DWITH_OPENVX=ON -DOPENVX_ROOT=${STAGING_LIBDIR} -DOPENVX_LIB_CANDIDATES='OpenVX;OpenVXU', \
-DWITH_OPENVX=OFF, \
virtual/libopenvx, \
\
"

Getting compilation error during building OpenCV

I am using Xubuntu 14.04 and trying to install the latest version of OpenCV, which is 3.0.0 rc1. Briefly, this is the error message I get:
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_videoio.so.3.0.0] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2
This error message was raised at 41% of the installation, when linking CXX shared library. Before trying to install openCV, first I configured by using cmake without flags. It said that openCV was ready to be installed. I don't know how to solve this problem and I am new to install packages from source. Any help would be appreciated.

OpenCV Ubuntu installation Error

I'm Trying to install OpenCV on Ubuntu 14.10 but i'm facing this error again and again :(
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:654: recipe for target 'lib/libopencv_highgui.so.2.4.9' failed
make[2]: *** [lib/libopencv_highgui.so.2.4.9] Error 1
CMakeFiles/Makefile2:1767: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
Makefile:133: recipe for target 'all' failed
make: *** [all] Error 2
Please provide the command history before you have encountered the error.
If calling make was the last thing before the error occured, you can try to call make CFLAGS="-fPIC" instead.
Late to the party, but the issue is that FFMPEG is not compiled with position-independent code. Go to your FFMPEG directory and do
./configure --enable-nonfree --enable-pic --enable-shared
then redo the make, make install steps, and re-do the build of opencv.

Resources