TX2编译VINS-FUSION-GPU-MASTER问题

在https://github.com/pjrambo/VINS-Fusion-gpu中下载VINS-Fusion-gpu源码。所遇问题如下:

1.由于TX2安装时使用的是JetPack3.2,里边的Opencv版本为3.3,上述源码所运行的环境为Opencv3.4.1。所以需要重装Opencv。

(1)卸载Opencv3.3:

sudo apt-get purge libopencv*
sudo apt autoremove
sudo apt-get update

(2)安装Opencv3.4.1:

1.官网下载
2.解压:unzip opencv-3.4.1.zip 
3.进入解压目录:cd opencv-3.4.1
4.安装依赖:sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev
5.创建编译目录:mkdir build && cd build
6.cmake编译下:cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
7.make编译(使用make -j 否则可能会出错):make -j
8.安装opencv:sudo make install
9.添加环境变量:sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'

所有完成之后可以删除build目录(节省7G多空间哦),如果编译是存储内存不够也可以放在移动内存里边编译,编译完安装到TX2上。

2.编译VINS-FUSION-GPU之前需要做如下操作:

在 /vins_estimator/CMakeLists.txt中, 更改20行的opencv路径.
在/loop_fusion/CmakeLists.txt中, 更改19行的opencv路径.

3.编译VINS-FUSION-GPU

cd ~/catkin_ws/src
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Fusion.git
cd ../
catkin_make
source ~/catkin_ws/devel/setup.bash

注意只能使用catkin_make,不能使用catkin_make -j 回报错。

出现错误:#error Please include the appropriate gl headers before including cuda_gl_interop.h

解决方法:打开‘/usr/local/cuda-9.0/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
//#if defined(__arm__) || defined(__aarch64__)
//#ifndef GL_VERSION
//#error Please include the appropriate gl headers before including cuda_gl_interop.h
//#endif
//#else
 #include 
//#endif
//#endif

将里边的上述代码都注释掉,只剩#include

 

c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
VINS-Fusion-gpu-master/vins_estimator/CMakeFiles/vins_lib.dir/build.make:86: recipe for target 'VINS-Fusion-gpu-master/vins_estimator/CMakeFiles/vins_lib.dir/src/estimator/estimator.cpp.o' failed
make[2]: *** [VINS-Fusion-gpu-master/vins_estimator/CMakeFiles/vins_lib.dir/src/estimator/estimator.cpp.o] Error 4
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:2009: recipe for target 'VINS-Fusion-gpu-master/vins_estimator/CMakeFiles/vins_lib.dir/all' failed
make[1]: *** [VINS-Fusion-gpu-master/vins_estimator/CMakeFiles/vins_lib.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j6 -l6" failed

solve:

sudo  ~/jetson_clocks.sh

sudo nvpmodel -m 0

你可能感兴趣的:(TX2编译VINS-FUSION-GPU-MASTER问题)