Building opencv 3.2.0 with contribution ERROR - opencv

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

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 ?

fatal error: opencv2/xfeatures2d.hpp: No such file or directory compilation terminated

I am trying to build this code:https://github.com/yjxiong/dense_flow/tree/opencv-3.1
I am using Ubuntu 16.04 and have OpenCV 3.4 installed.
xfeatures2d.hpp can't be found on the system.
I have looked at many different problems on the internet, but couldn't find a solution.
the error as below:
/dense_flow/build$ cmake .. && make -j
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- python
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yyk/ACTION/mmaction/third_party/dense_flow/build
Scanning dependencies of target denseflow
[ 7%] Building CXX object CMakeFiles/denseflow.dir/src/dense_warp_flow_gpu.cpp.o
[ 14%] Building CXX object CMakeFiles/denseflow.dir/src/dense_flow_gpu.cpp.o
/home/yyk/ACTION/mmaction/third_party/dense_flow/src/dense_warp_flow_gpu.cpp:12:10: fatal error: opencv2/xfeatures2d.hpp: No such file or directory
#include "opencv2/xfeatures2d.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
/home/yyk/ACTION/mmaction/third_party/dense_flow/src/dense_flow_gpu.cpp:5:10: fatal error: opencv2/xfeatures2d.hpp: No such file or directory
#include "opencv2/xfeatures2d.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/denseflow.dir/build.make:134: recipe for target 'CMakeFiles/denseflow.dir/src/dense_warp_flow_gpu.cpp.o' failed
make[2]: *** [CMakeFiles/denseflow.dir/src/dense_warp_flow_gpu.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/denseflow.dir/build.make:110: recipe for target 'CMakeFiles/denseflow.dir/src/dense_flow_gpu.cpp.o' failed
make[2]: *** [CMakeFiles/denseflow.dir/src/dense_flow_gpu.cpp.o] Error 1
CMakeFiles/Makefile2:215: recipe for target 'CMakeFiles/denseflow.dir/all' failed
make[1]: *** [CMakeFiles/denseflow.dir/all] Error 2
Makefile:83: recipe for target 'all' faile
Any help is awesome!

OpenCV-3.4.0 installation:"make -j8" failed

I tried to install opencv-3.4.0 according to the tutorials https://github.com/TadasBaltrusaitis/OpenFace/wiki/Unix-Installation,
but when I finished cmake,then try make -j8, it failed at 30%. Does anyone know the solution and can help me? Thank you very much.
All demanding dependencies for OpenCV was installed.
[ 29%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o
[ 29%] Built target pch_Generate_opencv_test_videostab
[ 30%] Built target pch_Generate_opencv_videostab
[ 30%] Built target pch_Generate_opencv_perf_superres
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
In file included from /home/zq/opencv-3.4.0/modules/cudev/include/opencv2/cudev/util/tuple.hpp:50:0,
from /home/zq/opencv-3.4.0/modules/cudev/include/opencv2/cudev.hpp:55,
from /home/zq/opencv-3.4.0/modules/core/src/cuda/gpu_mat.cu:52:
/home/zq/opencv-3.4.0/modules/cudev/include/opencv2/cudev/util/detail/tuple.hpp:49:26: fatal error: thrust/tuple.h: No such file or directory
compilation terminated.
CMake Error at cuda_compile_generated_gpu_mat.cu.o.cmake:208 (message):
Error generating
/home/zq/opencv-3.4.0/build/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gpu_mat.cu.o
modules/core/CMakeFiles/opencv_core.dir/build.make:63: recipe for target 'modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o' failed
make[2]: *** [modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o] Error 1
CMakeFiles/Makefile2:1730: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

make linking static libc not dynamic

I am trying to build an open source library (openCV in this case) from source using cmake and make. However, I run into a linking error
Linking CXX shared library ../../lib/libopencv_videoio.so
/usr/bin/ld: /usr/local/lib/libc.a(lib_a-mallocr.o): relocation R_X86_64_32S against `__malloc_av_' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libc.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
From what I gather, this means make is using the static version of glibc libc.a instead of the dynamic lib.so.6. I'm assuming I need to change a path somewhere in cmake but I'm unsure of where to look. Any help is appreciated.
edit: I'm doing this on a 64 bit linux mint machine

Resources