Jetson NX安装opencv3.2.0报错及问题汇总

2023-05-16

先放一个完整的cmake命令

cmake -D CMAKE_BUILD_TYPE=Release -D ENABLE_PRECOMPILED_HEADERS=OFF -D CMAKE_EXE_LINKER_FLAGS=-lcblas  -D WITH_CUDA=OFF -D CMAKE_INSTALL_PREFIX=/usr/local ..

前置

修改cuda部分源码,参考链接
1)修改 /usr/local/cuda/include/cuda_gl_interop.h 的62行到68行,修改后如下:

sudo gedit /usr/local/cuda/include/cuda_gl_interop.h

此部分修改为

//#if defined(__arm__) || defined(__aarch64__)
//#ifndef GL_VERSION
//#error Please include the appropriate gl headers before including cuda_gl_interop.h
//#endif
//#else
 #include <GL/gl.h>
//#endif

错误1

CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: CUDA_nppi_LIBRARY (ADVANCED)

原因解析:
cuda9不再支持2.0架构
解决方法:
参考链接
1:在 opencv-3.2.0/cmake 文件夹下找到 FindCUDA.cmake 文件,对其进行修改

cd opencv-3.2.0/cmake
sudo gedit FindCUDA.cmake

1)找到行

find_cuda_helper_libs(nppi)

改为:

  find_cuda_helper_libs(nppial)
  find_cuda_helper_libs(nppicc)
  find_cuda_helper_libs(nppicom)
  find_cuda_helper_libs(nppidei)
  find_cuda_helper_libs(nppif)
  find_cuda_helper_libs(nppig)
  find_cuda_helper_libs(nppim)
  find_cuda_helper_libs(nppist)
  find_cuda_helper_libs(nppisu)
  find_cuda_helper_libs(nppitc)

2)找到行

set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppi_LIBRARY};${CUDA_npps_LIBRARY}")

改为:

set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")

3)找到行

unset(CUDA_nppi_LIBRARY CACHE)

改为:

unset(CUDA_nppial_LIBRARY CACHE)
unset(CUDA_nppicc_LIBRARY CACHE)
unset(CUDA_nppicom_LIBRARY CACHE)
unset(CUDA_nppidei_LIBRARY CACHE)
unset(CUDA_nppif_LIBRARY CACHE)
unset(CUDA_nppig_LIBRARY CACHE)
unset(CUDA_nppim_LIBRARY CACHE)
unset(CUDA_nppist_LIBRARY CACHE)
unset(CUDA_nppisu_LIBRARY CACHE)
unset(CUDA_nppitc_LIBRARY CACHE)

2: 在 opencv-3.2.0/cmake 文件夹下找到文件 OpenCVDetectCUDA.cmake,对其进行修改

cd opencv-3.2.0/cmake
sudo gedit OpenCVDetectCUDA.cmake

修改以下几行:

 ...
  set(__cuda_arch_ptx "")
  if(CUDA_GENERATION STREQUAL "Fermi")
    set(__cuda_arch_bin "2.0")
  elseif(CUDA_GENERATION STREQUAL "Kepler")
    set(__cuda_arch_bin "3.0 3.5 3.7")
  ...

改为:

  ...
  set(__cuda_arch_ptx "")
  if(CUDA_GENERATION STREQUAL "Kepler")
    set(__cuda_arch_bin "3.0 3.5 3.7")
  elseif(CUDA_GENERATION STREQUAL "Maxwell")
    set(__cuda_arch_bin "5.0 5.2")
  ...

第三步: Cuda9或者Cuda10及以后的版本 中有一个单独的halffloat(cuda_fp16.h)头文件,也应该被包括在opencv的目录里

将头文件cuda_fp16.h添加至 opencv/modules/cudev/include/opencv2/cudev/common.hpp

cd opencv-3.2.0/modules/cudev/include/opencv2/cudev
sudo gedit common.hpp

即在common.hpp中添加

#include <cuda_fp16.h>

重新cmake

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..

错误2

/usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory #include_next <stdlib.h>
参考链接
原因分析:
这是由于gcc7已经吧stdlib.h纳入了libstdc++以进行更好的优化,C Library的头文件stdlib.h使用 Include_next,而include_next对gcc系统头文件路径很敏感。

推荐的修复方法是不要把include路径作为系统目录,而是使用标准方式包含include 目录

解决方法:
在编译opecv-3.2.0时,加入选项 -D ENABLE_PRECOMPILED_HEADERS=OFF

# 完整的命令
cmake -D CMAKE_BUILD_TYPE=Release -D ENABLE_PRECOMPILED_HEADERS=OFF -D CMAKE_INSTALL_PREFIX=/usr/local ..

错误3

../../lib/libopencv_core.so.3.2.0: undefined reference to `cblas_zgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, void const*, void const*, int, void const*, int, void const*, void*, int)'
../../lib/libopencv_core.so.3.2.0: undefined reference to `cblas_dgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, double, double const*, int, double const*, int, double, double*, int)'
../../lib/libopencv_core.so.3.2.0: undefined reference to `cblas_sgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, float, float const*, int, float const*, int, float, float*, int)'
../../lib/libopencv_core.so.3.2.0: undefined reference to `cblas_cgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, void const*, void const*, int, void const*, int, void const*, void*, int)'
collect2: error: ld returned 1 exit status
apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:103: recipe for target 'bin/opencv_annotation' failed
make[2]: *** [bin/opencv_annotation] Error 1
CMakeFiles/Makefile2:6153: recipe for target 'apps/annotation/CMakeFiles/opencv_annotation.dir/all' failed
make[1]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

参考链接
在cmake时加入-D CMAKE_EXE_LINKER_FLAGS=-lcblas选项

sudo apt-get install libopenblas-dev
cmake -D CMAKE_BUILD_TYPE=Release -D ENABLE_PRECOMPILED_HEADERS=OFF -D CMAKE_EXE_LINKER_FLAGS=-lcblas -D CMAKE_INSTALL_PREFIX=/usr/local ..

错误4

n file included from /home/lusx/opencv-3.2.0/modules/core/src/hal_internal.cpp:49:0:
/home/lusx/opencv-3.2.0/build/opencv_lapack.h:2:10: fatal error: LAPACKE_H_PATH-NOTFOUND/lapacke.h: No such file or directory
 #include "LAPACKE_H_PATH-NOTFOUND/lapacke.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
modules/core/CMakeFiles/opencv_core.dir/build.make:522: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/hal_internal.cpp.o' failed
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/hal_internal.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In member function ‘void cv::EigenvalueDecomposition::compute(cv::InputArray)’:
cc1plus: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
CMakeFiles/Makefile2:1195: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

解决:
找到报错的文件opencv-3.2.0/build/opencv_lapack.h,将第二行改为以下内容

#include "lapacke.h"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Jetson NX安装opencv3.2.0报错及问题汇总 的相关文章

随机推荐

  • Ubuntu 16.04 安装tftp

    准备工作 新建一个777权限的tftpdir服务文件夹 例如 home sjj work tftpdir 放一个有内容的1 txt文本用来测试 安装tftp的增强版本 服务端tftpd hpa 客户端tftp hpa sudo apt ge
  • VS粘贴word时中文乱码修复工具v1

    部分VS版本复制代码到word时 中文注释变成乱码 就做了个小工具实时修复 以前在网上也下载过类似工具 但每次都要点一下 很麻烦 本工具可自动监控剪切板 自动修复 可谓全自动了
  • 正斜杠/和反斜杠\的区别

    近来研究源码时发现 xff0c 常常在路径中出现正斜杠 和反斜杠 xff0c 之前就一直不胜其扰 xff0c 所幸查资料把它一次弄懂 xff0c 求个明白 在这里做个记录 我认真搜了一下 xff0c 发现问这个问题的人还不少 xff0c 知
  • Gazebo需要的protoc版本与google-cartographer需要的版本不一致

    问题 xff1a 编译ROS工作空间时出现了问题 xff1a 错误提示是Gazebo代码由更新的protoc版本产生 xff0c 而当前安装的protobuf库的版本低了 xff11 xff0e ubuntu 18 04 Gazebo依赖的
  • vue 2.0项目 favicon.ico不显示 解决方案

    1 最好把favicon ico放到 index html放到同一目录 2 在webpack 配置文件里面配置 在webpack dev conf js 里面的 plugins配置 new HtmlWebpackPlugin filenam
  • 来自IT公司速查手册的各大IT公司薪资和待遇内幕

    来自IT公司速查手册的各大IT公司薪资和待遇内幕 xff08 转载于 http xuchaoyi99 cnblogs com xff09 编号 1 杭州 诺基亚 2 南京 趋势科技 Trend 3 北京 联想 xff08 北京 xff09
  • GCC中SIMD指令的应用方法

    X86架构上的多媒体应用开发 xff0c 如果能够使用SIMD指令进行优化 xff0c 性能将大大提高 目前 xff0c IA 32的SIMD指令包括MMX xff0c SSE xff0c SSE2等几级 在GCC的开发环境中 xff0c
  • ffmpeg mplayer x264 代码重点详解 详细分析

    ffmpeg和mplayer中求平均值得方法 1 ordinary c language level define avg2 a b a 43 b 43 1 gt gt 1 define avg4 a b c d a 43 b 43 c 4
  • 基于Region Proposal的深度学习目标检测简述

    转载链接 开篇需要跟大家道歉 xff0c 一切忙没时间的理由都是借口 xff0c 实际上就是偷懒了 xff0c 这么久才更新 xff0c 非常抱歉 xff01 本篇争取以最简明的叙述 xff0c 帮助大家理解下基于Region Propos
  • 3D电视,你知道多少?

    1 3D电视常见知识 系统概述篇 1 什么是3D电视 xff1f 答 xff1a 3D电视是一种能够模拟实际景物的真实空间关系的新型电视 xff0c 它利用人眼的视觉特性产生立体感 xff0c 让观众感受到观看的影像是具有深度特性的三维立体
  • 程序员成熟的标志《程序员成长路线图:从入门到优秀》

    对好书进行整理 xff0c 把好内容共享 我见证过许多的程序员的成长 xff0c 他们很多人在进入成熟期之后 xff0c 技术上相对较高 xff0c 一般项目开发起来比较自信 xff0c 没有什么太大的困难 xff0c 有的职位上也有所提升
  • 前端工程师的价值体现在哪里?

    这是一个很老的话题 前端工程师的价值体现在哪里 xff1f 有人说 xff1a 前端工程师之于网站的价值犹如化妆师之于明星的价值 一位好的Web前端开发工程师在知识体系上既要有广度 xff0c 又要有深度 当然 xff0c Web前端工程师
  • 设计公共API的六个注意事项

    摘要 xff1a 俗话说 xff1a 好东西就要贡献出来和大家一起分享 xff0c 尤其是在互联网业务高度发达的今天 xff0c 如果你的创业公司提供了一项很酷的技术或者服务 xff0c 并且其他用户也非常喜欢该产品 xff0c 在这种情况
  • 从工具的奴隶到工具的主人

    摘要 xff1a 我们每个人都是工具的奴隶 随着我们的学习 xff0c 我们不断的加深自己对工具的认识 xff0c 从而从它们里面解脱出来 现在我就来说一下我作为各种工具的奴隶 xff0c 以及逐渐摆脱它们的思想控制的历史吧 当我高中毕业进
  • C语言 常用API

    MySQL的C语言API接口 1 首先当然是连接数据库 xff0c 函数原型如下 xff1a MYSQL STDCALL mysql real connect MYSQL mysql const char host const char u
  • linux下的C语言开发

    linux下的C语言开发 xff08 开篇 xff09 在很多人的眼里 xff0c C语言和linux常常是分不开的 这其中的原因很多 xff0c 其中最重要的一部分我认为是linux本身就是C语言的杰出作品 当然 xff0c linux操
  • C读写ini文件

    read write ini file with c function 64 file testini c chinayaosir blog http blog csdn net chinayaosir connect ini databa
  • 职场必知的20条黄金法则

    时间紧张 xff0c 先记一笔 xff0c 后续优化与完善 1 办公室里只有两种人 xff0c 角主和龙套 职场上 xff0c 想要过的省力 xff0c 不想往上爬 xff0c 那就只能做一生的龙套 作龙套的处坏就是 xff1a 死送你先去
  • 检测是浏览器还是手机,需求为是否支持FLASH,此文为检测是否支持FLASH的代码(含demo下载)

    步骤 xff1a 1 导入swfobject js文件 2 写一个函数 3 在需要用的地方调用方法 xff0c 此处为页面加载时调用 以下为示例代码 xff1a Java代码 lt script src 61 34 Public js sw
  • Jetson NX安装opencv3.2.0报错及问题汇总

    先放一个完整的cmake命令 cmake D CMAKE BUILD TYPE 61 Release D ENABLE PRECOMPILED HEADERS 61 OFF D CMAKE EXE LINKER FLAGS 61 lcbla