在jetson xavier上编译DBOW库时遇到/usr/bin/ld: cannot find -lvtkxxx问题

近日在把ORB-SLAM3的代码从amd架构的设备部署到英伟达的jetson xavier上,在编译第三方库DBoW2遇到一个问题/usr/bin/ld: cannot find -lvtkxxx,要给xavier要跪了

解决办法直接看2解决办法

1问题描述:

[ 14%] Linking CXX shared library ../lib/libDBoW2.so
/usr/bin/ld: cannot find -lvtkRenderingOpenGL
/usr/bin/ld: cannot find -lvtkImagingHybrid
/usr/bin/ld: cannot find -lvtkIOImage
/usr/bin/ld: cannot find -lvtkCommonDataModel
/usr/bin/ld: cannot find -lvtkCommonMath
/usr/bin/ld: cannot find -lvtkCommonCore
/usr/bin/ld: cannot find -lvtksys
/usr/bin/ld: cannot find -lvtkCommonMisc
/usr/bin/ld: cannot find -lvtkCommonSystem
/usr/bin/ld: cannot find -lvtkCommonTransforms
/usr/bin/ld: cannot find -lvtkCommonExecutionModel
/usr/bin/ld: cannot find -lvtkDICOMParser
/usr/bin/ld: cannot find -lvtkIOCore
/usr/bin/ld: cannot find -lvtkmetaio
/usr/bin/ld: cannot find -lvtkImagingCore
/usr/bin/ld: cannot find -lvtkRenderingCore
/usr/bin/ld: cannot find -lvtkCommonColor
/usr/bin/ld: cannot find -lvtkFiltersExtraction
/usr/bin/ld: cannot find -lvtkFiltersCore
/usr/bin/ld: cannot find -lvtkFiltersGeneral
/usr/bin/ld: cannot find -lvtkCommonComputationalGeometry
/usr/bin/ld: cannot find -lvtkFiltersStatistics
/usr/bin/ld: cannot find -lvtkImagingFourier
/usr/bin/ld: cannot find -lvtkalglib
/usr/bin/ld: cannot find -lvtkFiltersGeometry
/usr/bin/ld: cannot find -lvtkFiltersSources
/usr/bin/ld: cannot find -lvtkInteractionStyle
/usr/bin/ld: cannot find -lvtkRenderingLOD
/usr/bin/ld: cannot find -lvtkFiltersModeling
/usr/bin/ld: cannot find -lvtkIOPLY
/usr/bin/ld: cannot find -lvtkIOGeometry
/usr/bin/ld: cannot find -lvtkFiltersTexture
/usr/bin/ld: cannot find -lvtkRenderingFreeType
/usr/bin/ld: cannot find -lvtkftgl
/usr/bin/ld: cannot find -lvtkIOExport
/usr/bin/ld: cannot find -lvtkRenderingAnnotation
/usr/bin/ld: cannot find -lvtkImagingColor
/usr/bin/ld: cannot find -lvtkRenderingContext2D
/usr/bin/ld: cannot find -lvtkRenderingGL2PS
/usr/bin/ld: cannot find -lvtkRenderingContextOpenGL
/usr/bin/ld: cannot find -lvtkRenderingLabel
collect2: error: ld returned 1 exit status
CMakeFiles/DBoW2.dir/build.make:285: recipe for target '../lib/libDBoW2.so' failed
make[2]: *** [../lib/libDBoW2.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DBoW2.dir/all' failed
make[1]: *** [CMakeFiles/DBoW2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

总而言之就是在为DBOW2链接外部库文件时找不到vtk相关的内容,使用find /usr/lib -name libvtk*进行查找,发现也存在相关的库文件,只不过是在/usr/lib/aarch64-linux-gnu/目录下

尝试失败1:
CMakeLists.txt加入库文件地址的路径LINK_DIRECTORIES(/lib/aarch64-linux-gnu)
尝试失败2:
将相关的库从/usr/lib/aarch64-linux-gnu/直接拷贝到/usr/lib目录下
尝试失败3:
/usr/lib/cmake/vtk-6.3目录下的.cmake拷贝到DBOW2目录下

2解决办法

看到一个类似的报错,见链接,想到之前在搜索相关库文件的时候,库文件的名称是libvtkRenderingCore-6.3.so,带有版本信息。

然后就按照博客中的办法,新建一个libvtkRenderingCore.so的软连接,使其链接到已有的libvtkRenderingCore-6.3.so,把报错中提示的库文件都进行相应的操作,重新编译,没有报错。

完整命令:

cd /usr/lib/aarch64-linux-gnu/
sudo ln -slibvtkRenderingCore-6.3.so libvtkRenderingCore.so

但是存在一个小问题,如果我们只是一个两个库找不到,使用上面的办法比较容易的进行解决,但是像我这样大概20个库,一遍遍操作感觉好蠢,,,,,,期待能有一步到位的方法

你可能感兴趣的:(Linux系统,linux,服务器,运维)