`你好,我已经在 Raspberry 上安装了几次 OpenCV。但是,由于一切都在不断发展(操作系统、库等)。这次我收到以下错误:
-- 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`
任何帮助将不胜感激。为了很多人的心理健康,我将编译后的图像备份并上传。