ubuntu20.04安装opencv4.2 cmake报错

在Ubuntu 20.04上安装OpenCV4.2时遇到cmake错误,主要是ippicv_2019_lnx_intel64_general_20180723.tgz文件下载失败。通过使用cmake-gui设置源码路径和构建目录,配置后查看错误日志,手动下载ippicv文件并替换,消除错误后重新配置和生成,从而成功进行安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ubuntu20.04安装opencv4.2 cmake报错
参考:https://blog.youkuaiyun.com/qq_34256375/article/details/107836051
https://docs.opencv.org/4.2.0/d7/d9f/tutorial_linux_install.html
https://blog.youkuaiyun.com/u011622208/article/details/104265206
备注:安装过程尽量看看官方文档

$ cmake -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules CMAKE_C_COMPILER=/usr/bin/gcc-5 ..

然后

-- Detected processor: x86_64
-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- IPPICV: Download: ippicv_2019_lnx_intel64_general_20180723.tgz
-- Try 1 failed
-- 
=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
  IPPICV: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  /home/ye/opencv-4.2.0/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  3rdparty/ippicv/ippicv.cmake:42 (ocv_download)
  cmake/OpenCVFindIPP.cmake:240 (download_ippicv)
  cmake/OpenCVFindLibsPerf.cmake:12 (include)
  CMakeLists.txt:674 (include)


-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR) 
-- A library with LAPACK API found.
-- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
-- The imported target "vtkParseOGLExt" references the file
   "/usr/bin/vtkParseOGLExt-7.1"
but this file does not exist.  Possible reasons include:

* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtk" references the file
   "/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target 
好的,以下是在 Ubuntu 20.04安装 OpenCV 4 的步骤: 1. 更新系统 在开始安装 OpenCV 4 之前,请先更新您的 Ubuntu 20.04 系统。您可以打开终端并运行以下命令: ``` sudo apt update sudo apt upgrade ``` 这将更新您的系统软件包到最新版本。 2. 安装依赖项 在安装 OpenCV 4 之前,您需要安装一些依赖项。在终端中运行以下命令: ``` sudo apt install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev libv4l-dev libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev gfortran libprotobuf-dev protobuf-compiler libgoogle-glog-dev libgflags-dev libgphoto2-dev libeigen3-dev libhdf5-dev doxygen ``` 这些依赖项将允许您编译和安装 OpenCV 4。 3. 克隆 OpenCV 存储库 在终端中输入以下命令,克隆 OpenCV 存储库: ``` git clone https://github.com/opencv/opencv.git ``` 这将把 OpenCV 存储库克隆到您的本地机器上。 4. 克隆 OpenCV_contrib 存储库 在终端中输入以下命令,克隆 OpenCV_contrib 存储库: ``` git clone https://github.com/opencv/opencv_contrib.git ``` 这将把 OpenCV_contrib 存储库克隆到您的本地机器上。 5. 构建和安装 OpenCV 4 在终端中进入 OpenCV 存储库的目录,并创建一个“build”目录。然后,进入“build”目录并运行 CMake: ``` cd opencv mkdir build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules .. ``` 请注意,您需要将“OPENCV_EXTRA_MODULES_PATH”参数设置为您之前克隆 OpenCV_contrib 存储库的路径。 接下来,运行以下命令来编译 OpenCV 4: ``` make -j8 ``` 请注意,这里的“-j8”参数表示使用 8 个线程并行编译。您可以根据您的系统配置自由更改该参数。 最后,运行以下命令来安装 OpenCV 4: ``` sudo make install ``` 完成后,您可以在 /usr/local/include/opencv4/ 和 /usr/local/lib/ 目录下找到 OpenCV 4 的头文件和库文件。 恭喜您,您已经成功地在 Ubuntu 20.04安装OpenCV 4
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值