Error building OpenCV in Ubuntu using cmake - opencv

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?

Related

/usr/bin/ld: cannot find -lvtkRenderingOpenGL

Errors << apriltag_ros:make /home/ravinspect/catkin_ws/logs/apriltag_ros/build.make.001.log
/usr/bin/ld: cannot find -lvtkRenderingOpenGL
/usr/bin/ld: cannot find -lvtkImagingHybrid
/usr/bin/ld: cannot find -lvtkIOImage
/usr/bin/ld: cannot find -lvtkCommonTransforms
/usr/bin/ld: cannot find -lvtkCommonExecutionModel
/usr/bin/ld: cannot find -lvtkDICOMParser
/usr/bin/ld: cannot find -lvtkIOCore
/usr/bin/ld: cannot find -lvtkImagingColor
/usr/bin/ld: cannot find -lvtkRenderingContext2D
/usr/bin/ld: cannot find -lvtkRenderingGL2PS
/usr/bin/ld: cannot find -lvtkRenderingContextOpenGL
/usr/bin/ld: cannot find -lvtkRenderingLabel
collect2: error: ld returned 1 exit status
make[2]: ***
[/home/ravinspect/catkin_ws/devel/.private/apriltag_ros/lib/libapriltag_ros_common.so]
Error 1
make[1]: *** [CMakeFiles/apriltag_ros_common.dir/all] Error 2
I want to build a workspace with catkin build but i am taking this error while building workspace. I tried bunch of solutions but still i am taking this error.
Can anyone help me with this?
First install
sudo apt install libvtk5-dev
and then remove opencv and reinstall will solve the issue

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, \
\
"

Building opencv 3.2.0 with contribution ERROR

I am trying to build opencv with opencv_contributions, but I can`t figure out this error at building.
I made cmake like this :
cmake -DOPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-master/modules/ ~/opencv-3.2.0/
And at the end of building i got this error:
[100%] Linking CXX executable ../../bin/opencv_perf_stitching
[100%] Built target opencv_perf_stitching
[100%] Linking CXX shared module ../../lib/cv2.so
/usr/bin/ld: CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o: relocation R_X86_64_PC32 against undefined symbol `_Z13pyopencv_fromIN2cv4MatxIdLi4ELi4EEEEP7_objectRKT_' 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/python2/CMakeFiles/opencv_python2.dir/build.make:393: recipe for target 'lib/cv2.so' failed
make[2]: *** [lib/cv2.so] Error 1
CMakeFiles/Makefile2:14221: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

OpenCV error while compiling ros workspace

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.

OpenCV with ffmpeg on Fedora 22

I am trying to compile OpenCV 3.0 on Fedora 22 with ffmpeg. I encounter the following error:
[ 26%] Building CXX object
modules/core/CMakeFiles/opencv_perf_core.dir/perf/perf_bitwise.cpp.o
Linking CXX executable /global/OpenCV/opencv_perf_core
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `swr_free'
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `swr_init'
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `swr_is_initialized'
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `lzma_code'
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `lzma_end'
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `swr_close'
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `swr_convert'
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `swr_alloc'
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `lzma_stream_decoder'
collect2: error: ld returned 1 exit status
modules/core/CMakeFiles/opencv_perf_core.dir/build.make:770: recipe for target '/global/OpenCV/opencv_perf_core' failed
make[2]: *** [/global/OpenCV/opencv_perf_core] Error 1
CMakeFiles/Makefile2:1245: recipe for target 'modules/core/CMakeFiles/opencv_perf_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2
Any help would be highly appreciated !

Resources