Issue 1:
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%

Issue 2:
System information (version)

OpenCV => :4.0.0.21:

Operating System / Platform => : windows10:

Compiler => :pre-build version from pip:

Detailed description

background: i wanna achieve opencv dnn model to detect face in an image

after accessing the model and prototxt from opencv_extra/testdata/dnn/download_models.py, i learned some sample code to test whether it works or not. And then, I got the following info:

[libprotobuf ERROR C:\projects\opencv-python\opencv\3rdparty\protobuf\src\google\protobuf\text_format.cc:288] Error parsing text-format opencv_caffe.NetParameter: 2:1: Invalid control characters encountered in text.
[libprotobuf ERROR C:\projects\opencv-python\opencv\3rdparty\protobuf\src\google\protobuf\text_format.cc:288] Error parsing text-format opencv_caffe.NetParameter: 2:2: Interpreting non ascii codepoint 162.
[libprotobuf ERROR C:\projects\opencv-python\opencv\3rdparty\protobuf\src\google\protobuf\text_format.cc:288] Error parsing text-format opencv_caffe.NetParameter: 2:2: Expected identifier, got: ?
Traceback (most recent call last):
File "src/facedetect/detector.py", line 103, in <module>
util.gainFaceByDNN(path, modelpath, deploypath)
File "src/facedetect/detector.py", line 26, in gainFaceByDNN
net = cv2.dnn.readNetFromCaffe(modelFile, configFile)
cv2.error: OpenCV(4.0.0) C:\projects\opencv-python\opencv\modules\dnn\src\caffe\caffe_io.cpp:1151: error: (-2:Unspecified error) FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse NetParameter file: D:\project\python\IQA\src\facedetect\res10_300x300_ssd_iter_140000.caffemodel in function 'cv::dnn::ReadNetParamsFromTextFileOrDie'

i have tried to google error, and got some solutions to try but they all failed, including checking the invisible content of the deploy.prototxt, redownload the files, etc.

Steps to reproduce

below is the code i used for test and it goes wrong on the first code.

net = cv2.dnn.readNetFromCaffe(modelFile, configFile)
image = cv2.imread(imgPath)
(h, w) = image.shape[:2]

blob = cv2.dnn.blobFromImage(cv2.resize(image, (300,300)), 1.0, (300,300), (103.93, 116.77, 123.68), False)
net.setInput(blob)

detections = net.forward()

Is there any practical solutions ? thanks ~