当前位置: 首页 > news >正文

NVIDIA Jetson AGX Orin源码编译安装CV-CUDA

目录

1  下载源码并配置

2 编译安装CV-CUDA

2.1 安装相应依赖包

2.2 升级gcc到gcc-11

2.3 build

2.4 升级cmake

2.5 再次build

2.5.1 报错 /usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:

3 直接使用安装包

参考文献:


Jetson AGX Orin还没到货,先在之前的Jetson AGX Xavier上面做相关开发,我Jetson AGX Xavier上新刷的机,然后JetPack用的是5.1.3。下面记录下我在Jetson上的CV-CUDA的编译安装工作。

1  下载源码并配置

sudo apt install -y git git-lfs
git clone https://github.com/CVCUDA/CV-CUDA.git
cd CV-CUDA/
./init_repo.sh 

执行init_repo.sh之后报错

./init_repo.sh 
pre-commit must be fully configured.
Try 'sudo apt-get install -y pip shellcheck && sudo pip install pre-commit'.

那就先执行这两个命令,然后再配置

sudo apt-get install -y pip shellcheck
sudo pip install pre-commit

然后 vim .pre-commit-config.yaml 里面加入如下内容

repos:- repo: https://github.com/pre-commit/pre-commit-hooksrev: v3.4.0hooks:- id: trailing-whitespace- id: end-of-file-fixer- id: check-yaml

然后

pre-commit install

然后再次执行 ./init_repo.sh

2 编译安装CV-CUDA

2.1 安装相应依赖包

sudo apt install -y cmake ninja-build python3-dev libssl-dev patchelf

2.2 升级gcc到gcc-11

如果直接apt install gcc-11 g++-11会报下面的错误

sudo apt install gcc-11 g++-11
Reading package lists... Done
Building dependency tree... 0%
Building dependency tree       
Reading state information... Done
E: Unable to locate package gcc-11
E: Unable to locate package g++-11

需要添加PPA源,然后再安装

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-11 g++-11

然后更改替代项

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11

然后选择默认版本

sudo update-alternatives --config gcc
sudo update-alternatives --config g++

然后发现成功升级成11版本

2.3 build

mkdir build
ci/build.sh release  -DBUILD_TESTS=1 -DPYTHON_VERSIONS=3.8 -DPUBLIC_API_COMPILERS=gcc-11

发生下面的错误

ci/build.sh release  -DBUILD_TESTS=1 -DPYTHON_VERSIONS=3.8 -DPUBLIC_API_COMPILERS=gcc-11
CMake Error at CMakeLists.txt:16 (cmake_minimum_required):CMake 3.20.1 or higher is required.  You are running version 3.16.3-- Configuring incomplete, errors occurred!

2.4 升级cmake

先卸载掉之前的cmake

sudo apt-get remove cmake

然后 直接下载二进制包

Download CMake

然后

chmod 777 cmake-3.30.2-linux-aarch64.sh
./cmake-3.30.2-linux-aarch64.sh  --prefix=/usr/local
vim ~/.bashrc
export PATH=/usr/local/cmake-3.30.2-linux-aarch64/bin:$PATH
source  ~/.bashrc

2.5 再次build

ci/build.sh release  -DBUILD_TESTS=1 -DPYTHON_VERSIONS=3.8 -DPUBLIC_API_COMPILERS=gcc-11

2.5.1 报错 /usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:

/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:435 |         function(_Functor&& __f)|                                                                                                                                                 ^ 
/usr/include/c++/11/bits/std_function.h:435:145: note:         ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:530 |         operator=(_Functor&& __f)|                                                                                                                                                  ^ 
/usr/include/c++/11/bits/std_function.h:530:146: note:         ‘_ArgTypes’

解决方法在

Fails on Cuda 11.6 and PyTorch 1.12 (/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:) · Issue #1491 · NVIDIA/apex · GitHub

具体就是

vim /usr/include/c++/11/bits/std_function.h 

然后把436这里的和后面531行这里的注释掉。

433       template<typename _Functor,
434                typename _Constraints = _Requires<_Callable<_Functor>>>
435         function(_Functor&& __f)
436         //noexcept(_Handler<_Functor>::template _S_nothrow_init<_Functor>())
437         : _Function_base()
438         {
439           static_assert(is_copy_constructible<__decay_t<_Functor>>::value,
440               "std::function target must be copy-constructible");
441           static_assert(is_constructible<__decay_t<_Functor>, _Functor>::value,
442               "std::function target must be constructible from the "
443               "constructor argument");
444 
445           using _My_handler = _Handler<_Functor>;
446 
447           if (_My_handler::_M_not_empty_function(__f))
448             {
449               _My_handler::_M_init_functor(_M_functor,
450                                            std::forward<_Functor>(__f));
451               _M_invoker = &_My_handler::_M_invoke;
452               _M_manager = &_My_handler::_M_manager;
453             }
454         }
528       template<typename _Functor>
529         _Requires<_Callable<_Functor>, function&>
530         operator=(_Functor&& __f)
531         //noexcept(_Handler<_Functor>::template _S_nothrow_init<_Functor>())
532         {
533           function(std::forward<_Functor>(__f)).swap(*this);
534           return *this;
535         }

然后编译就不报错了,但是编译过程中我发现,这太慢了

[167/377 4 1968.540s] Building CUDA object src/cvcuda/priv/legacy/CMakeFiles/cvcuda_legacy.dir/composite.cu.o

我直接放弃源码编译的方法,直接下载安装包试试,

3 直接使用安装包

Releases · CVCUDA/CV-CUDA · GitHub

去这里下载

然后直接

sudo apt install -y ./cvcuda-lib-0.10.1_beta-cuda11-aarch64-linux.deb ./cvcuda-dev-0.10.1_beta-cuda11-aarch64-linux.deb
sudo apt install -y ./cvcuda-python3.8-0.10.1_beta-cuda11-aarch64-linux.deb

参考文献:

ubuntu安装cmake-CSDN博客


http://www.mrgr.cn/news/10857.html

相关文章:

  • 关于Linux sudo授权的那点事
  • 《C++魔法:运算符重载的奇妙之旅》
  • Autosar(Davinci) --- ADT和IDT如何Mapping
  • Andrid异步更新UI:Handler(二)深入了解:Message你真的会创建?它是如何子线程和主线程通知?
  • [Mdfs] lc690. 员工的重要性(dfs+bfs+离线询问+问题拓展+基础题)
  • 支持pyro 1.8以上的贝叶斯神经网络实现 bnn Bayesian Neural Network pyro ,人工智能
  • ptrade排坑日记——一键脚本报错,启动jupyterhub失败。
  • 【PL/pgSQL】华为数据库GaussDB及PostgreSQL 数据库系统的过程语言
  • Flutter 高德地图坐标和百度坐标相互转换
  • C语言指针原理--单片机C语言编程开发中指针变量的本质/用法/注意事项
  • Prompt + 工作流组件 = AI智能体:开启智能化新时代
  • C#入门(14)Switch语句
  • Java-文件读取工具类FileReaderUtil
  • 【C#】【EXCEL】BumblebeeComponentsAnalysisGH_Ex_Ana_CondUnique.cs
  • 169页PPT丨城投公司战略规划之产业投资商规划
  • 数据结构学习:单链表
  • 四川财谷通,信息科技引领者!
  • Ps:首选项
  • css设置三个div宽度占据三分之一
  • .NET Razor类库 - 静态资源组件化