Installation error: opencv_perf_features2d

asked 2019-01-14 07:40:09 -0600

Atomic gravatar image

updated 2019-01-14 07:44:09 -0600

berak gravatar image
  • OpenCV => 3.4.3
  • Operating System / Platform => Raspbian Stretch

Hi,

following the standard procedure on https://www.pyimagesearch.com/2017/09...

after doing:

 cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.3/modules \
    -D BUILD_EXAMPLES=ON ..

gives me the following error at around 48%:

[ 46%] Built target opencv_perf_bioinspired
Scanning dependencies of target opencv_line_descriptor

[ 46%] Built target example_dpm_cascade_detect_sequence

[ 46%] Building CXX object modules/line_descriptor/CMakeFiles/opencv_line_descriptor.dir/src/LSDDetector.cpp.o
Scanning dependencies of target opencv_saliency

[ 46%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/BING/CmFile.cpp.o

[ 46%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/BING/CmShow.cpp.o

[ 46%] Building CXX object modules/line_descriptor/CMakeFiles/opencv_line_descriptor.dir/src/binary_descriptor.cpp.o

[ 46%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/BING/FilterTIG.cpp.o

[ 46%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/BING/ValStructVec.cpp.o

[ 46%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/BING/objectnessBING.cpp.o

[ 46%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/ocl/test_feature2d.cpp.o

[ 46%] Building CXX object modules/features2d/CMakeFiles/opencv_perf_features2d.dir/perf/opencl/perf_feature2d.cpp.o

[ 46%] Building CXX object modules/line_descriptor/CMakeFiles/opencv_line_descriptor.dir/src/binary_descriptor_matcher.cpp.o

[ 46%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/motionSaliency.cpp.o

[ 46%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/motionSaliencyBinWangApr2014.cpp.o

[ 47%] Building CXX object modules/line_descriptor/CMakeFiles/opencv_line_descriptor.dir/src/draw.cpp.o

[ 47%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_agast.cpp.o

[ 48%] Building CXX object modules/features2d/CMakeFiles/opencv_perf_features2d.dir/perf/perf_batchDistance.cpp.o

[ 48%] Linking CXX shared library ../../lib/libopencv_line_descriptor.so

[ 48%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/objectness.cpp.o

[ 48%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_akaze.cpp.o

[ 48%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/saliency.cpp.o
/usr/bin/ld: error: ../../lib/libopencv_features2d.so.3.4.3: file too short
collect2: error: ld returned 1 exit status
modules/line_descriptor/CMakeFiles/opencv_line_descriptor.dir/build.make:180: recipe for target 'lib/libopencv_line_descriptor.so.3.4.3' failed
make[2]: *** [lib/libopencv_line_descriptor.so.3.4.3] Error 1
CMakeFiles/Makefile2:12442: recipe for target 'modules/line_descriptor/CMakeFiles/opencv_line_descriptor.dir/all' failed
make[1]: *** [modules/line_descriptor/CMakeFiles/opencv_line_descriptor.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

[ 48%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/staticSaliency.cpp.o

[ 48%] Building CXX object modules/features2d/CMakeFiles/opencv_perf_features2d.dir/perf/perf_feature2d.cpp.o

[ 48%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/staticSaliencyFineGrained.cpp.o

[ 48%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_brisk.cpp.o

[ 48%] Building CXX object modules/saliency/CMakeFiles/opencv_saliency.dir/src/staticSaliencySpectralResidual.cpp.o

[ 48%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_descriptors_invariance.cpp.o

[ 48%] Linking CXX shared library ../../lib/libopencv_saliency.so
/usr/bin/ld: error: ../../lib/libopencv_features2d.so.3.4.3: file too short
collect2: error: ld returned ...
(more)
edit retag flag offensive close merge delete

Comments

i don't have a raspi, but look here:

[ 48%] Linking CXX executable ../../bin/opencv_test_features2d
/usr/bin/ld: error: ../../lib/libopencv_features2d.so.3.4.3: file too short
collect2: error: ld returned 1 exit status
modules/features2d/CMakeFiles/opencv_test_features2d.dir/build.make:493: recipe for target 'bin/opencv_test_features2d' failed

it looks, like you ran out of disk space (and it got truncated) ;(

berak gravatar imageberak ( 2019-01-14 07:43:52 -0600 )edit

hmm that could be it. Will clean up and run again I guess

Atomic gravatar imageAtomic ( 2019-01-14 07:48:11 -0600 )edit

what you could try (after a radical cleanup), all of it in the hope to compile less:

  • get a larger disk / sdcard
  • disable precompiled headers (they're a hog): cmake -DENABLE_PRECOMPILED_HEADERS=OFF
  • disable the tests: -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF
  • disable any opencv module, you don't need: -DBUILD_opencv_xxxx=OFF (esp. from the contrib ones, saliency ? fuzzy ?)
berak gravatar imageberak ( 2019-01-14 07:50:19 -0600 )edit

just for the record, that means next to

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.3/modules \
-D BUILD_EXAMPLES=ON ..

I would also need to add

-D ENABLE_PRECOMPILED_HEADERS=OFF
-DBUILD_TESTS=OFF
-DBUILD_PERF_TESTS=OFF
-DBUILD_opencv_saliency=OFF
Atomic gravatar imageAtomic ( 2019-01-14 08:03:21 -0600 )edit

exactly, those are all cmake flags.

and don't forget, that if you put them on a seperate line, you need a backslach at the end.

berak gravatar imageberak ( 2019-01-14 08:09:18 -0600 )edit

This is wrong link that you're posted.The link you're posted is outdated. Here is link for Opencv 4 for raspberry pi: Install OpenCV 4 on your Raspberry Pi

supra56 gravatar imagesupra56 ( 2019-01-14 14:20:25 -0600 )edit

Don't forget make -j1 instead of -j4

supra56 gravatar imagesupra56 ( 2019-01-14 14:22:19 -0600 )edit
supra56 gravatar imagesupra56 ( 2019-01-14 20:42:00 -0600 )edit