本文主要是介绍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博客
这篇关于NVIDIA Jetson AGX Orin源码编译安装CV-CUDA的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!