Ошибка компиляции с помощью make install для установки OpenCV 4 в Raspbian Raspberry Pi 3+ - PullRequest
8 голосов
/ 04 апреля 2019

`Здравствуйте, я установил OpenCV на Raspberry пару раз.Однако, поскольку все постоянно развивается (ОС, библиотеки и т. Д.).На этот раз я получаю следующую ошибку:

-- Installing: /usr/local/lib/python2.7/dist-packages/cv2/python-2.7/cv2.so
CMake Error at modules/python2/cmake_install.cmake:61 (file):
  file RPATH_CHANGE could not write new RPATH:

    /usr/local/lib

  to the file:

    /usr/local/lib/python2.7/dist-packages/cv2/python-2.7/cv2.so

  No valid ELF RPATH or RUNPATH entry exists in the file; Error reading ELF
  identification.
Call Stack (most recent call first):
  modules/cmake_install.cmake:162 (include)
  cmake_install.cmake:95 (include)


Makefile:83: recipe for target 'install' failed
make: *** [install] Error 1

Я попробовал следующий скрипт:

    sudo apt-get upgrade
    sudo apt-get install -y build-essential cmake pkg-config
    sudo apt-get install -y libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
    sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
    sudo apt-get install -y libxvidcore-dev libx264-dev
    sudo apt-get install -y libgtk2.0-dev
    sudo apt-get install -y libatlas-base-dev gfortran
    sudo apt-get install -y python2.7-dev python3-dev
    cd ~
    #wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.1.0.zip
    #unzip opencv.zip
    #wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip
    #unzip opencv_contrib.zip
    git clone https://github.com/opencv/opencv.git
    git clone https://github.com/opencv/opencv_contrib.git
    pip install numpy
    cd ~/opencv
    mkdir build
    cd build
    cmake -D CMAKE_BUILD_TYPE=RELEASE \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D INSTALL_PYTHON_EXAMPLES=ON \
        -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
        -D BUILD_EXAMPLES=ON ..

    make -j4
    sudo make install
    sudo ldconfig

Я ожидал, что библиотека будет скомпилирована правильно, однако, это то, что показывает консоль:

-- Up-to-date: /usr/local/lib/libopencv_stitching.so.4.1
-- Up-to-date: /usr/local/lib/libopencv_stitching.so
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/warpers.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/autocalib.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/blenders.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/camera.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/exposure_compensate.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/matchers.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/motion_estimators.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/seam_finders.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/timelapsers.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/util.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/util_inl.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/warpers.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stitching/detail/warpers_inl.hpp
-- Up-to-date: /usr/local/lib/libopencv_superres.so.4.1.0
-- Up-to-date: /usr/local/lib/libopencv_superres.so.4.1
-- Up-to-date: /usr/local/lib/libopencv_superres.so
-- Up-to-date: /usr/local/include/opencv4/opencv2/superres.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/superres/optical_flow.hpp
-- Up-to-date: /usr/local/lib/libopencv_tracking.so.4.1.0
-- Up-to-date: /usr/local/lib/libopencv_tracking.so.4.1
-- Up-to-date: /usr/local/lib/libopencv_tracking.so
-- Up-to-date: /usr/local/include/opencv4/opencv2/tracking.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/tracking/feature.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/tracking/kalman_filters.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/tracking/onlineBoosting.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/tracking/onlineMIL.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/tracking/tldDataset.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/tracking/tracker.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/tracking/tracking.hpp
-- Up-to-date: /usr/local/lib/libopencv_stereo.so.4.1.0
-- Up-to-date: /usr/local/lib/libopencv_stereo.so.4.1
-- Up-to-date: /usr/local/lib/libopencv_stereo.so
-- Up-to-date: /usr/local/include/opencv4/opencv2/stereo.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stereo/descriptor.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stereo/matching.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stereo/quasi_dense_stereo.hpp
-- Up-to-date: /usr/local/include/opencv4/opencv2/stereo/stereo.hpp
-- Up-to-date: /usr/local/lib/python2.7/dist-packages/cv2/__init__.py
-- Up-to-date: /usr/local/lib/python2.7/dist-packages/cv2/load_config_py2.py
-- Up-to-date: /usr/local/lib/python2.7/dist-packages/cv2/load_config_py3.py
-- Up-to-date: /usr/local/lib/python2.7/dist-packages/cv2/config.py
-- Installing: /usr/local/lib/python2.7/dist-packages/cv2/python-2.7/cv2.so
CMake Error at modules/python2/cmake_install.cmake:61 (file):
  file RPATH_CHANGE could not write new RPATH:

    /usr/local/lib

  to the file:

    /usr/local/lib/python2.7/dist-packages/cv2/python-2.7/cv2.so

  No valid ELF RPATH or RUNPATH entry exists in the file; Error reading ELF
  identification.
Call Stack (most recent call first):
  modules/cmake_install.cmake:162 (include)
  cmake_install.cmake:95 (include)


Makefile:83: recipe for target 'install' failed
make: *** [install] Error 1`

Любая помощь будет принята с благодарностью.Я создам резервную копию и загрузу образ после компиляции для психического здоровья многих людей.

Ответы [ 2 ]

3 голосов
/ 15 апреля 2019

Я много чего перепробовал и решил проблему. Изображение Raspbian Stretch + OpenCV 4 можно найти здесь:

https://drive.google.com/open?id=1UpHp4hR0_mCSU4OS2OLGzebA_4zyBdqf

0 голосов
/ 10 апреля 2019

Я также столкнулся с этой ошибкой и смог устранить ее, выполнив следующие действия:

  1. перейдите в каталог OpenCV (работает cd .. с вашего * 1007)* directory).

  2. выполните следующую команду:

    python ./modules/python/src2/gen2.py ./build/modules/python_bindings_generator ./build/modules/python_bindings_generator/headers.txt`
    
  3. вернитесь в каталог сборки и еще раз выполните sudo make install

На этот раз все должно работать, если вы выполнили команду cmake из каталога build.

...