New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile:160: recipe for target 'all' failed make: *** [all] Error 2 #7652

Closed
vivekpatani opened this Issue Nov 11, 2016 · 27 comments

Comments

@vivekpatani
Copy link

vivekpatani commented Nov 11, 2016


STOP READING NOW

If you get the error message from the caption, because it is useless and too generic (are you sure that you build OpenCV library and not other make project?).
Reason of your build problem is somewhere above this line, you need to grab it instead.
To get right error message you should run "make" in verbose mode:

$ make VERBOSE=1

(without any -j options to prevent message lines mess)


System information (version)
  • OpenCV => 3.1
  • Operating System / Platform => Elementary OS (Loki)
  • Compiler => make
Detailed description
  • When I did just cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .., make -j4 worked all right```
  • When I tried to make -j4 VERBOSE=1 with Examples and Modules, I got this error
...
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
cd /home/flipswitch/Programs/anaconda3/pkgs/opencv/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/flipswitch/Programs/anaconda3/pkgs/opencv /home/flipswitch/Programs/anaconda3/pkgs/opencv_contrib/modules/surface_matching /home/flipswitch/Programs/anaconda3/pkgs/opencv/build /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/surface_matching /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/surface_matching/CMakeFiles/opencv_surface_matching.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make -f modules/surface_matching/CMakeFiles/opencv_surface_matching.dir/build.make modules/surface_matching/CMakeFiles/opencv_surface_matching.dir/build
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make[2]: Nothing to be done for 'modules/surface_matching/CMakeFiles/opencv_surface_matching.dir/build'.
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
[ 28%] Built target opencv_surface_matching
make -f modules/surface_matching/CMakeFiles/example_surface_matching_ppf_load_match.dir/build.make modules/surface_matching/CMakeFiles/example_surface_matching_ppf_load_match.dir/depend
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
cd /home/flipswitch/Programs/anaconda3/pkgs/opencv/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/flipswitch/Programs/anaconda3/pkgs/opencv /home/flipswitch/Programs/anaconda3/pkgs/opencv_contrib/modules/surface_matching /home/flipswitch/Programs/anaconda3/pkgs/opencv/build /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/surface_matching /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/surface_matching/CMakeFiles/example_surface_matching_ppf_load_match.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make -f modules/surface_matching/CMakeFiles/example_surface_matching_ppf_load_match.dir/build.make modules/surface_matching/CMakeFiles/example_surface_matching_ppf_load_match.dir/build
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make[2]: Nothing to be done for 'modules/surface_matching/CMakeFiles/example_surface_matching_ppf_load_match.dir/build'.
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
[ 28%] Built target example_surface_matching_ppf_load_match
make -f modules/surface_matching/CMakeFiles/example_surface_matching_ppf_normal_computation.dir/build.make modules/surface_matching/CMakeFiles/example_surface_matching_ppf_normal_computation.dir/depend
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
cd /home/flipswitch/Programs/anaconda3/pkgs/opencv/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/flipswitch/Programs/anaconda3/pkgs/opencv /home/flipswitch/Programs/anaconda3/pkgs/opencv_contrib/modules/surface_matching /home/flipswitch/Programs/anaconda3/pkgs/opencv/build /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/surface_matching /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/surface_matching/CMakeFiles/example_surface_matching_ppf_normal_computation.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make -f modules/surface_matching/CMakeFiles/example_surface_matching_ppf_normal_computation.dir/build.make modules/surface_matching/CMakeFiles/example_surface_matching_ppf_normal_computation.dir/build
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make[2]: Nothing to be done for 'modules/surface_matching/CMakeFiles/example_surface_matching_ppf_normal_computation.dir/build'.
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
[ 28%] Built target example_surface_matching_ppf_normal_computation
make -f modules/video/CMakeFiles/opencv_video.dir/build.make modules/video/CMakeFiles/opencv_video.dir/depend
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
cd /home/flipswitch/Programs/anaconda3/pkgs/opencv/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/flipswitch/Programs/anaconda3/pkgs/opencv /home/flipswitch/Programs/anaconda3/pkgs/opencv/modules/video /home/flipswitch/Programs/anaconda3/pkgs/opencv/build /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/video /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/video/CMakeFiles/opencv_video.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make -f modules/video/CMakeFiles/opencv_video.dir/build.make modules/video/CMakeFiles/opencv_video.dir/build
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make[2]: Nothing to be done for 'modules/video/CMakeFiles/opencv_video.dir/build'.
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
[ 29%] Built target opencv_video
make -f modules/video/CMakeFiles/opencv_test_video.dir/build.make modules/video/CMakeFiles/opencv_test_video.dir/depend
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
cd /home/flipswitch/Programs/anaconda3/pkgs/opencv/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/flipswitch/Programs/anaconda3/pkgs/opencv /home/flipswitch/Programs/anaconda3/pkgs/opencv/modules/video /home/flipswitch/Programs/anaconda3/pkgs/opencv/build /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/video /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/video/CMakeFiles/opencv_test_video.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make -f modules/video/CMakeFiles/opencv_test_video.dir/build.make modules/video/CMakeFiles/opencv_test_video.dir/build
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make[2]: Nothing to be done for 'modules/video/CMakeFiles/opencv_test_video.dir/build'.
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
[ 30%] Built target opencv_test_video
make -f modules/video/CMakeFiles/opencv_perf_video.dir/build.make modules/video/CMakeFiles/opencv_perf_video.dir/depend
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
cd /home/flipswitch/Programs/anaconda3/pkgs/opencv/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/flipswitch/Programs/anaconda3/pkgs/opencv /home/flipswitch/Programs/anaconda3/pkgs/opencv/modules/video /home/flipswitch/Programs/anaconda3/pkgs/opencv/build /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/video /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/video/CMakeFiles/opencv_perf_video.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make -f modules/video/CMakeFiles/opencv_perf_video.dir/build.make modules/video/CMakeFiles/opencv_perf_video.dir/build
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make[2]: Nothing to be done for 'modules/video/CMakeFiles/opencv_perf_video.dir/build'.
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
[ 31%] Built target opencv_perf_video
make -f modules/dnn/CMakeFiles/opencv_dnn.dir/build.make modules/dnn/CMakeFiles/opencv_dnn.dir/depend
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
cd /home/flipswitch/Programs/anaconda3/pkgs/opencv/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/flipswitch/Programs/anaconda3/pkgs/opencv /home/flipswitch/Programs/anaconda3/pkgs/opencv_contrib/modules/dnn /home/flipswitch/Programs/anaconda3/pkgs/opencv/build /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/dnn /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/dnn/CMakeFiles/opencv_dnn.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make -f modules/dnn/CMakeFiles/opencv_dnn.dir/build.make modules/dnn/CMakeFiles/opencv_dnn.dir/build
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make[2]: Nothing to be done for 'modules/dnn/CMakeFiles/opencv_dnn.dir/build'.
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
[ 33%] Built target opencv_dnn
make -f modules/dnn/CMakeFiles/example_dnn_fcn_semsegm.dir/build.make modules/dnn/CMakeFiles/example_dnn_fcn_semsegm.dir/depend
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
cd /home/flipswitch/Programs/anaconda3/pkgs/opencv/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/flipswitch/Programs/anaconda3/pkgs/opencv /home/flipswitch/Programs/anaconda3/pkgs/opencv_contrib/modules/dnn /home/flipswitch/Programs/anaconda3/pkgs/opencv/build /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/dnn /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/dnn/CMakeFiles/example_dnn_fcn_semsegm.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
make -f modules/dnn/CMakeFiles/example_dnn_fcn_semsegm.dir/build.make modules/dnn/CMakeFiles/example_dnn_fcn_semsegm.dir/build
make[2]: Entering directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
[ 33%] Linking CXX executable ../../bin/example_dnn_fcn_semsegm
cd /home/flipswitch/Programs/anaconda3/pkgs/opencv/build/modules/dnn && /usr/bin/cmake -E cmake_link_script CMakeFiles/example_dnn_fcn_semsegm.dir/link.txt --verbose=1
/usr/bin/c++      -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security  -Wundef -Winit-self -Wpointer-arith -Wshadow  -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -Wno-shadow -Wno-parentheses -Wno-maybe-uninitialized -Wno-sign-promo -Wno-missing-declarations -O3 -DNDEBUG  -DNDEBUG      CMakeFiles/example_dnn_fcn_semsegm.dir/samples/fcn_semsegm.cpp.o  -o ../../bin/example_dnn_fcn_semsegm -rdynamic ../../lib/libopencv_dnn.so.3.1.0 ../../lib/libopencv_highgui.so.3.1.0 ../../lib/libopencv_videoio.so.3.1.0 ../../lib/libopencv_imgcodecs.so.3.1.0 ../../lib/libopencv_imgproc.so.3.1.0 ../../lib/libopencv_core.so.3.1.0 -Wl,-rpath,/home/flipswitch/Programs/anaconda3/pkgs/opencv/build/lib 
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::DescriptorPool::FindFileByName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::Message::GetTypeName[abi:cxx11]() const'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::empty_string_[abi:cxx11]'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteString(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, google::protobuf::internal::ArenaStringPtr)'
collect2: error: ld returned 1 exit status
modules/dnn/CMakeFiles/example_dnn_fcn_semsegm.dir/build.make:100: recipe for target 'bin/example_dnn_fcn_semsegm' failed
make[2]: *** [bin/example_dnn_fcn_semsegm] Error 1
make[2]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
CMakeFiles/Makefile2:3094: recipe for target 'modules/dnn/CMakeFiles/example_dnn_fcn_semsegm.dir/all' failed
make[1]: *** [modules/dnn/CMakeFiles/example_dnn_fcn_semsegm.dir/all] Error 2
make[1]: Leaving directory '/home/flipswitch/Programs/anaconda3/pkgs/opencv/build'
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2


Steps to reproduce
  • Downloaded opencv and opencv_contrib
  • Then cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/Programs/anaconda3/pkgs/opencv_contrib/modules -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_IPP=OFF ..
  • Followed by make -j4 VERBOSE=1
  • First time I tried without using WITH_IPP=OFF, it reached 50% and errored out with the same error.
  • Next time I tried with it and it errored out at 23%

@alalek alalek added invalid incomplete and removed invalid labels Nov 11, 2016

@vivekpatani

This comment has been minimized.

Copy link
Author

vivekpatani commented Nov 11, 2016

What more information should I provide? @alalek

@pcuci

This comment has been minimized.

Copy link

pcuci commented Nov 12, 2016

+1 one Ubuntu 16.04, following the install sequence here: https://github.com/milq/scripts-ubuntu-debian/blob/master/install-opencv.sh

@alalek

This comment has been minimized.

Copy link
Contributor

alalek commented Nov 12, 2016

Detailed build log with failed command should help to reproduce problem (make VERBOSE=1).

@vivekpatani

This comment has been minimized.

Copy link
Author

vivekpatani commented Nov 13, 2016

updated.

@alalek

This comment has been minimized.

Copy link
Contributor

alalek commented Nov 13, 2016

To receive proper build log you should run make without -j4. Current log cut doesn't contain failed command and error message.

@vivekpatani

This comment has been minimized.

Copy link
Author

vivekpatani commented Nov 13, 2016

@pcuci did not work. Any other alt?

@alalek

This comment has been minimized.

Copy link
Contributor

alalek commented Nov 13, 2016

Probably there is unsupported system protobuf installation with other compiler flags (c++11 is not used by default in OpenCV).
Try to run with this CMake option: -DBUILD_LIBPROTOBUF_FROM_SOURCES=ON or just disable dnn module (-DBUILD_opencv_dnn=OFF).

@alalek

This comment has been minimized.

Copy link
Contributor

alalek commented Nov 26, 2016

Latest code (opencv and opencv_contrib) should work fine without additional options. It just ignores system protobuf installations. You need to build from scratch (clean build directory).

@alalek alalek closed this Nov 26, 2016

@jonathanrjpereira

This comment has been minimized.

Copy link

jonathanrjpereira commented Jan 4, 2017

Ubuntu _16.10Similar Problem_

[ 13%] Generating precomp.hpp.gch/opencv_highgui_Release.gch
In file included from /usr/include/c++/6/bits/stl_algo.h:59:0,
from /usr/include/c++/6/algorithm:62,
from /home/jonathan/Desktop/OpenCV/modules/core/include/opencv2/core/base.hpp:55,
from /home/jonathan/Desktop/OpenCV/modules/core/include/opencv2/core.hpp:54,
from /home/jonathan/Desktop/OpenCV/modules/highgui/include/opencv2/highgui.hpp:46,
from /home/jonathan/Desktop/OpenCV/build/modules/highgui/precomp.hpp:45:
/usr/include/c++/6/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^
compilation terminated.
modules/highgui/CMakeFiles/pch_Generate_opencv_highgui.dir/build.make:62: recipe for target 'modules/highgui/precomp.hpp.gch/opencv_highgui_Release.gch' failed
make[2]: *** [modules/highgui/precomp.hpp.gch/opencv_highgui_Release.gch] Error 1
CMakeFiles/Makefile2:4262: recipe for target 'modules/highgui/CMakeFiles/pch_Generate_opencv_highgui.dir/all' failed
make[1]: *** [modules/highgui/CMakeFiles/pch_Generate_opencv_highgui.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

@ChadTaljaardt

This comment has been minimized.

Copy link

ChadTaljaardt commented Jan 10, 2017

Same error as @jonathanrjpereira

@mshabunin mshabunin added the invalid label Jan 13, 2017

@ThibaultGROUEIX

This comment has been minimized.

@alalek

This comment has been minimized.

Copy link
Contributor

alalek commented Jan 18, 2017

Try to add "-D ENABLE_PRECOMPILED_HEADERS=OFF" option to CMake command to workaround this GCC bug with "#include_next" processing.

@ThibaultGROUEIX

This comment has been minimized.

Copy link

ThibaultGROUEIX commented Jan 18, 2017

It didn't compile but i had a different error at 10% (instead of 36%)
/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

I use @daveselinger repo to build since I use cuda-8

@alalek

This comment has been minimized.

Copy link
Contributor

alalek commented Jan 18, 2017

/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

Your ffmpeg build configuration should be fixed (not related to OpenCV).

@Herschelpu

This comment has been minimized.

Copy link

Herschelpu commented Feb 8, 2017

similar problem:

[ 16%] Generating precomp.hpp.gch/opencv_videoio_RELEASE.gch
In file included from /home/pi/opencv_contrib/modules/optflow/include/opencv2/optflow.hpp:70:0,
from /home/pi/opencv_contrib/modules/optflow/src/precomp.hpp:45,
from /home/pi/opencv_3.0/opencv-3.1.0/build/modules/optflow/opencv_optflow_pch_dephelp.cxx:1:
/home/pi/opencv_contrib/modules/optflow/include/opencv2/optflow/sparse_matching_gpc.hpp: In member function ‘void cv::optflow::GPCPatchDescriptor::markAsSeparated()’:
/home/pi/opencv_contrib/modules/optflow/include/opencv2/optflow/sparse_matching_gpc.hpp:73:41: error: ‘numeric_limits’ is not a member of ‘std’
void markAsSeparated() { feature[0] = std::numeric_limits< double >::quiet_NaN(); }
^
/home/pi/opencv_contrib/modules/optflow/include/opencv2/optflow/sparse_matching_gpc.hpp:73:62: error: expected primary-expression before ‘double’
void markAsSeparated() { feature[0] = std::numeric_limits< double >::quiet_NaN(); }
^
modules/optflow/CMakeFiles/opencv_optflow_pch_dephelp.dir/build.make:71: recipe for target 'modules/optflow/CMakeFiles/opencv_optflow_pch_dephelp.dir/opencv_optflow_pch_dephelp.cxx.o' failed
make[2]: *** [modules/optflow/CMakeFiles/opencv_optflow_pch_dephelp.dir/opencv_optflow_pch_dephelp.cxx.o] Error 1
CMakeFiles/Makefile2:20391: recipe for target 'modules/optflow/CMakeFiles/opencv_optflow_pch_dephelp.dir/all' failed
make[1]: *** [modules/optflow/CMakeFiles/opencv_optflow_pch_dephelp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 16%] Built target pch_Generate_opencv_videoio
[ 16%] Built target pch_Generate_opencv_imgcodecs
[ 16%] Built target pch_Generate_opencv_core
[ 16%] Built target pch_Generate_opencv_imgproc
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

@tch1001

This comment has been minimized.

Copy link

tch1001 commented Feb 18, 2017

Are you using a virtualenv? You might want to try without the virtualenv, worked for me! :)

@Vict0rSch

This comment has been minimized.

Copy link

Vict0rSch commented Feb 22, 2017

I also got this error using Ubuntu 16.04 + Cuda 8.0 from commands cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. and make -j4

[ 89%] Building CXX object modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:120:54: error: ‘NppiGraphcutState’ has not been declared
     typedef NppStatus (*init_func_t)(NppiSize oSize, NppiGraphcutState** ppState, Npp8u* pDeviceMem);
                                                      ^
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:135:18: error: ‘NppiGraphcutState’ does not name a type
         operator NppiGraphcutState*()
                  ^
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:141:9: error: ‘NppiGraphcutState’ does not name a type
         NppiGraphcutState* pState;
         ^
In file included from /home/ubuntu/opencv/build/modules/cudalegacy/precomp.hpp:75:0:
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp: In constructor ‘{anonymous}::NppiGraphcutStateHandler::NppiGraphcutStateHandler(NppiSize, Npp8u*, {anonymous}::init_func_t)’:
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:127:39: error: ‘pState’ was not declared in this scope
             nppSafeCall( func(sznpp, &pState, pDeviceMem) );
                                       ^
/home/ubuntu/opencv/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
                                                    ^
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp: In destructor ‘{anonymous}::NppiGraphcutStateHandler::~NppiGraphcutStateHandler()’:
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:132:43: error: ‘pState’ was not declared in this scope
             nppSafeCall( nppiGraphcutFree(pState) );
                                           ^
/home/ubuntu/opencv/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
                                                    ^
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:132:49: error: ‘nppiGraphcutFree’ was not declared in this scope
             nppSafeCall( nppiGraphcutFree(pState) );
                                                 ^
/home/ubuntu/opencv/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
                                                    ^
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp: In function ‘void cv::cuda::graphcut(cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::Stream&)’:
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:174:51: error: ‘nppiGraphcutGetSize’ was not declared in this scope
     nppSafeCall( nppiGraphcutGetSize(sznpp, &bufsz) );
                                                   ^
/home/ubuntu/opencv/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
                                                    ^
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:182:61: error: ‘nppiGraphcutInitAlloc’ was not declared in this scope
     NppiGraphcutStateHandler state(sznpp, buf.ptr<Npp8u>(), nppiGraphcutInitAlloc);
                                                             ^
In file included from /home/ubuntu/opencv/build/modules/cudalegacy/precomp.hpp:75:0:
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:191:146: error: ‘nppiGraphcut_32s8u’ was not declared in this scope
             static_cast<int>(terminals.step), static_cast<int>(leftTransp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                                                                                                  ^
/home/ubuntu/opencv/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
                                                    ^
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:196:146: error: ‘nppiGraphcut_32f8u’ was not declared in this scope
             static_cast<int>(terminals.step), static_cast<int>(leftTransp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                                                                                                  ^
/home/ubuntu/opencv/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
                                                    ^
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp: In function ‘void cv::cuda::graphcut(cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::Stream&)’:
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:246:52: error: ‘nppiGraphcut8GetSize’ was not declared in this scope
     nppSafeCall( nppiGraphcut8GetSize(sznpp, &bufsz) );
                                                    ^
/home/ubuntu/opencv/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
                                                    ^
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:254:61: error: ‘nppiGraphcut8InitAlloc’ was not declared in this scope
     NppiGraphcutStateHandler state(sznpp, buf.ptr<Npp8u>(), nppiGraphcut8InitAlloc);
                                                             ^
In file included from /home/ubuntu/opencv/build/modules/cudalegacy/precomp.hpp:75:0:
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:267:146: error: ‘nppiGraphcut8_32s8u’ was not declared in this scope
             static_cast<int>(terminals.step), static_cast<int>(leftTransp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                                                                                                  ^
/home/ubuntu/opencv/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
                                                    ^
/home/ubuntu/opencv/modules/cudalegacy/src/graphcuts.cpp:274:146: error: ‘nppiGraphcut8_32f8u’ was not declared in this scope
             static_cast<int>(terminals.step), static_cast<int>(leftTransp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                                                                                                  ^
/home/ubuntu/opencv/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
                                                    ^
modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/build.make:314: recipe for target 'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o' failed
make[2]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:9173: recipe for target 'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/all' failed
make[1]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
@Herschelpu

This comment has been minimized.

Copy link

Herschelpu commented Feb 22, 2017

@Vict0rSch

This comment has been minimized.

Copy link

Vict0rSch commented Feb 23, 2017

I tried at least 3 times...

@kidapu

This comment has been minimized.

Copy link

kidapu commented Mar 2, 2017

I reproduce same kind of error by executing following Dockerfile.

FROM nvidia/cuda:8.0-devel-ubuntu16.04

RUN mkdir OpenCV && cd OpenCV

RUN apt-get update && apt-get install -y \
  build-essential \
  checkinstall \
  cmake \
  pkg-config \
  yasm \
  libtiff5-dev \
  libjpeg-dev \
  libjasper-dev \
  libavcodec-dev \
  libavformat-dev \
  libswscale-dev \
  libdc1394-22-dev \
 # libxine-dev \
  libgstreamer0.10-dev \
  libgstreamer-plugins-base0.10-dev \
  libv4l-dev \
  python-dev \
  python-numpy \
  python-pip \
  libtbb-dev \
  libeigen3-dev \
  libqt4-dev \
  libgtk2.0-dev \
  # Doesn't work libfaac-dev \
  libmp3lame-dev \
  libopencore-amrnb-dev \
  libopencore-amrwb-dev \
  libtheora-dev \
  libvorbis-dev \
  libxvidcore-dev \
  x264 \ 
  v4l-utils \
 # Doesn't work ffmpeg \
  libgtk2.0-dev \
#  zlib1g-dev \
#  libavcodec-dev \
  unzip \
  wget

RUN cd /opt && \
  wget https://github.com/opencv/opencv/archive/3.1.0.zip -O opencv-3.1.0.zip -nv && \
  unzip opencv-3.1.0.zip && \
  cd opencv-3.1.0 && \
  rm -rf build && \
  mkdir build && \
  cd build && \
  cmake -D CUDA_ARCH_BIN=3.2 \
    -D CUDA_ARCH_PTX=3.2 \
    -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D WITH_TBB=ON \
    -D BUILD_NEW_PYTHON_SUPPORT=ON \
    -D WITH_V4L=ON \
    -D BUILD_TIFF=ON \
    -D WITH_QT=ON \
    -D ENABLE_PRECOMPILED_HEADERS=OFF \
 #   -D USE_GStreamer=ON \
    -D WITH_OPENGL=ON .. && \
  make -j4 && \
  make install && \
  echo "/usr/local/lib" | sudo tee -a /etc/ld.so.conf.d/opencv.conf && \
  ldconfig
RUN cp /opt/opencv-3.1.0/build/lib/cv2.so /usr/lib/python2.7/dist-packages/cv2.so

exec command.

nvidia-docker build --no-cache -t test-image .

error is below.

modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/build.make:266: recipe for target 'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o' failed
make[2]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 89%] Linking CXX executable ../../bin/opencv_perf_cudastereo
[ 89%] Built target opencv_perf_cudastereo
make[1]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/all] Error 2
CMakeFiles/Makefile2:5143: recipe for target 'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/all' failed
make: *** [all] Error 2
@alalek

This comment has been minimized.

Copy link
Contributor

alalek commented Mar 2, 2017

Actually there is no useful error message (error reason is above and it was cut from log).
Also you should use fresh code/release instead of OpenCV 3.1 (3.1 is released before CUDA 8.0, so it can't be supported - see #6510).

@daveselinger

This comment has been minimized.

Copy link

daveselinger commented Mar 2, 2017

Hey there @kidapu @Vict0rSch , just a reminder that there is a new version of OpenCV out which most likely supports your needs. I would highly recommend using that.

That said, I've repaired #6510 and other CUDA8 issues in an off-by-one branch here: https://github.com/daveselinger/opencv/tree/3.1.0-with-cuda8

I do my best to support it, but again the newer versions of OpenCV would be my recommendation unless you've got legacy integrations to do.

@Vict0rSch

This comment has been minimized.

Copy link

Vict0rSch commented Mar 2, 2017

Just tried with OpenCV 3.2 (git checkout 3.2.0) and followed these instructions but got an error still :

[ 52%] Building NVCC (Device) object modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_cmp_op.cu.o
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).
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).
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).
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).
Scanning dependencies of target opencv_test_cudev
[ 52%] Building CXX object modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/test_main.cpp.o
[ 52%] Linking CXX executable ../../../bin/opencv_test_cudev
[ 52%] Built target opencv_test_cudev
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

@daveselinger should I use the previously mentioned instructions within your repo https://github.com/daveselinger/opencv/tree/3.1.0-with-cuda8 ?

@Vict0rSch

This comment has been minimized.

Copy link

Vict0rSch commented Mar 2, 2017

@daveselinger Just tried what I described above (use the previously mentioned instructions within your repo) and I still get an error at 52% after the following commands :

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_CUBLAS=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" ..    
make -j $(($(nproc) + 1))

[ 52%] Linking CXX shared library ../../lib/libopencv_features2d.so
[ 52%] Built target opencv_features2d
Scanning dependencies of target opencv_cudawarping
[ 52%] Building CXX object modules/cudawarping/CMakeFiles/opencv_cudawarping.dir/src/resize.cpp.o
[ 52%] Building CXX object modules/cudawarping/CMakeFiles/opencv_cudawarping.dir/src/remap.cpp.o
[ 52%] Building CXX object modules/cudawarping/CMakeFiles/opencv_cudawarping.dir/src/warp.cpp.o
[ 52%] Building CXX object modules/cudawarping/CMakeFiles/opencv_cudawarping.dir/src/pyramids.cpp.o
[ 52%] Linking CXX shared library ../../lib/libopencv_cudawarping.so
[ 52%] Built target opencv_cudawarping
Scanning dependencies of target opencv_cudaarithm
[ 52%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_cudaarithm.dir/src/reductions.cpp.o
[ 52%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_cudaarithm.dir/src/core.cpp.o
[ 52%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_cudaarithm.dir/src/element_operations.cpp.o
[ 52%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_cudaarithm.dir/src/arithm.cpp.o
[ 52%] Linking CXX shared library ../../lib/libopencv_cudaarithm.so
[ 52%] Built target opencv_cudaarithm
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

If you care to have a look here is the Cmake -> pastebin

@kidapu

This comment has been minimized.

Copy link

kidapu commented Mar 2, 2017

@daveselinger Thanks! I can succeed to install by using your repository. My Dockerfile is below.

FROM nvidia/cuda:8.0-devel-ubuntu16.04

RUN mkdir OpenCV && cd OpenCV

RUN apt-get update && apt-get install -y \
  build-essential \
  checkinstall \
  cmake \
  pkg-config \
  yasm \
  libtiff5-dev \
  libjpeg-dev \
  libjasper-dev \
  libavcodec-dev \
  libavformat-dev \
  libswscale-dev \
  libdc1394-22-dev \
 # libxine-dev \
  libgstreamer0.10-dev \
  libgstreamer-plugins-base0.10-dev \
  libv4l-dev \
  python-dev \
  python-numpy \
  python-pip \
  libtbb-dev \
  libeigen3-dev \
  libqt4-dev \
  libgtk2.0-dev \
  # Doesn't work libfaac-dev \
  libmp3lame-dev \
  libopencore-amrnb-dev \
  libopencore-amrwb-dev \
  libtheora-dev \
  libvorbis-dev \
  libxvidcore-dev \
  x264 \ 
  v4l-utils \
 # Doesn't work ffmpeg \
  libgtk2.0-dev \
#  zlib1g-dev \
#  libavcodec-dev \
  unzip \
  libhdf5-dev \
  wget \
  sudo
    

RUN cd /opt && \
  wget https://github.com/daveselinger/opencv/archive/3.1.0-with-cuda8.zip -O opencv-3.1.0.zip -nv && \
  unzip opencv-3.1.0.zip && \
  mv opencv-3.1.0-with-cuda8 opencv-3.1.0 && \
  cd opencv-3.1.0 && \
  rm -rf build && \
  mkdir build && \
  cd build && \
  cmake -D CUDA_ARCH_BIN=3.2 \
    -D CUDA_ARCH_PTX=3.2 \
    -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D WITH_TBB=ON \
    -D BUILD_NEW_PYTHON_SUPPORT=ON \
    -D WITH_V4L=ON \
    -D BUILD_TIFF=ON \
    -D WITH_QT=ON \
    -D ENABLE_PRECOMPILED_HEADERS=OFF \
 #   -D USE_GStreamer=ON \
    -D WITH_OPENGL=ON .. && \
  make -j4 && \
  make install && \
  echo "/usr/local/lib" | sudo tee -a /etc/ld.so.conf.d/opencv.conf && \
  ldconfig
RUN cp /opt/opencv-3.1.0/build/lib/cv2.so /usr/lib/python2.7/dist-packages/cv2.so
@Frikster

This comment has been minimized.

Copy link

Frikster commented Mar 8, 2017

Same issue: https://zerobin.net/?88e740401d761161#VnNwW45QNR3XIAJJcd1JxjWYkOjH3SvYlkY2KALo5sU=

System information (version)
OpenCV => 3.1
Operating System / Platform => Ubuntu 14.04.1
Compiler => make

tried following instructions here just with 3.1 instead of 3.0

@alalek

This comment has been minimized.

Copy link
Contributor

alalek commented Mar 8, 2017

@Frikster Your issue is resolved in OpenCV 3.2: some things are gone from CUDA 8.0, so build is failed. OpenCV 3.0/3.1 works with CUDA 6.5. There is another issue about your problem (your comment is duplicate).

P.S. I will lock this thread, because there are posted a lot of unrelated build issues for non-descriptive "failed make" message pattern.

@opencv opencv locked and limited conversation to collaborators Mar 8, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.