OpenCV-3.4.0 installation:"make -j8" failed - opencv

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

Related

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!

ld: archive has no table of contents file error with homebrew

I'm trying to compile weechat,
%> brew upgrade weechat --debug
...
[ 86%] Built target weechat_gui_curses_normal
[ 87%] Building C object src/gui/curses/normal/CMakeFiles/weechat.dir/main.o
[ 87%] Linking C executable weechat
ld: archive has no table of contents file '../../../plugins/libweechat_plugins.a' for architecture x86_64
clang: error: unable to execute command: Segmentation fault: 11
clang: error: linker command failed due to signal (use -v to see invocation)
make[2]: *** [src/gui/curses/normal/weechat] Error 254
make[1]: *** [src/gui/curses/normal/CMakeFiles/weechat.dir/all] Error 2
make: *** [all] Error 2
bash-3.2$ exit
It fails with archive has no table of contents file for architecture x86_64, it seem to be a generic error, as it happens with mysql#5.5 and many other packages.
I also see ranlib errors
/usr/local/homebrew/bin/ranlib: libweechat_gui_curses_normal.a(gui-curses-term.o): unknown load command 0x32
Any ideas?
Resolved.
Simple do brew unlink binutils or specify RANLIB=/usr/bin/ranlib.

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 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.

Error in opencv_video when compiling ROS Hydro from source in Odroid-U3

I'm having a problem when trying to compile ROS Hydro from the source on Odroid-U3. This is the related error:
Built target pch_Generate_opencv_superres
[ 31%] Built target opencv_core
[ 32%] Built target opencv_flann
[ 35%] Built target opencv_ml
[ 42%] Built target opencv_imgproc
[ 42%] Built target opencv_photo
[ 45%] Built target opencv_video
Linking CXX shared library ../../lib/libopencv_highgui.so
/usr/local/lib/libavcodec.a(videodsp_armv5te.o): In function `ff_prefetch_arm':
/home/odroid/odroid-sources/sources/ffmpeg/libavcodec/arm/videodsp_armv5te.S:29:(.text+0x8): relocation truncated to fit: R_ARM_THM_JUMP19 against symbol `ff_prefetch_arm' defined in .text section in /usr/local/lib/libavcodec.a(videodsp_armv5te.o)
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.2.4.6] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
<== Failed to process package 'opencv2':
Command '/home/odroid/ros_catkin_ws/install_isolated/env.sh make -j4 -l4' returned non-zero exit status 2
Reproduce this error by running:
==> cd /home/odroid/ros_catkin_ws/build_isolated/opencv2 && /home/odroid/ros_catkin_ws/install_isolated/env.sh make -j4 -l4
Command failed, exiting.
Already tried to install those libraries by sudo apt-get install but no difference. Any help would be awesome. Thanks!

Resources