ubuntu编译报错及解决办法汇总

目录

错误描述1: Could not find a package configuration file provided by "Pangolin" with anyof the following names:PangolinConfig.cmake

错误描述2:fatal error: Eigen/Core: 没有那个文件或目录

错误描述3: nvcc fatal   : Unsupported gpu architecture 'compute_30':

错误描述4:Error: invalid texture reference: /home/y/SLAM/ElasticFusion-master/Core/src/Cuda/convenience.cuh:68

错误描述5:make: *** 没有规则可以创建“/usr/lib/x86_64-linux-gnu/libGL.so”需要的目标“XXXX”。 停止

错误描述6:X Error of failed request:  BadShmSeg (invalid shared segment parameter)

错误描述7:  "/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"  but not all the files it references.


错误描述1: Could not find a package configuration file provided by "Pangolin" with anyof the following names:PangolinConfig.cmake


 CMake Error at CMakeLists.txt:8 (find_package):
  By not providing "FindPangolin.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Pangolin",
  but CMake did not find one.

  Could not find a package configuration file provided by "Pangolin" with any
  of the following names:

    PangolinConfig.cmake
    pangolin-config.cmake

  Add the installation prefix of "Pangolin" to CMAKE_PREFIX_PATH or set
  "Pangolin_DIR" to a directory containing one of the above files.  If
  "Pangolin" provides a separate development package or SDK, be sure it has
  been installed.

错误分析:所在的目录中没有找到 OpencvConfig.cmake 文件

解决方案:

在 CMakeLists.txt 中加入Pangolin_DIR 的路径信息。PangolinConfig.cmake 文件在安装路径下 build/src 中,直接找到PangolinConfig.cmake文件右键属性获取绝对路径,并将其添加到 CMakeLists.txt 中的find_package(Pangolin REQUIRED)前添加:

set(Pangolin_DIR  /home/y/Library/Pangolin-0.6/build/src)

具体如下:


 

错误描述2:fatal error: Eigen/Core: 没有那个文件或目录
 

解决方案:

在CMakeLists.txt中加入如下代码,

include_directories("/usr/include/eigen3")

 ubuntu编译报错及解决办法汇总_第1张图片

错误描述3: nvcc fatal   : Unsupported gpu architecture 'compute_30':

nvcc fatal   : Unsupported gpu architecture 'compute_30'
CMake Error at cuda_compile_1_generated_cudafuncs.cu.o.cmake:219 (message):
  Error generating
  /home/y/SLAM/ElasticFusion-master/Core/src/build/CMakeFiles/cuda_compile_1.dir/Cuda/./cuda_compile_1_generated_cudafuncs.cu.o


CMakeFiles/efusion.dir/build.make:63: recipe for target 'CMakeFiles/cuda_compile_1.dir/Cuda/cuda_compile_1_generated_cudafuncs.cu.o' failed
make[2]: *** [CMakeFiles/cuda_compile_1.dir/Cuda/cuda_compile_1_generated_cudafuncs.cu.o] Error 1
make[2]: *** 正在等待未完成的任务....

错误分析: 显卡不支持compute_30的GPU构架,与CUDA版本不兼容。

解决方案:

找到 /home/y/SLAM/ElasticFusion-master/Core/src/目录下的cmake文件将CUDA_ARCH_BIN后字符串中直接删掉30,并重新编译。具体如下,

#set(CUDA_ARCH_BIN "30 35 50 52 61" CACHE STRING "Specify 'real' GPU arch to build binaries for, BIN(PTX) format is supported. Example: 1.3 2.1(1.3) or 13 21(13)")   #修改前
set(CUDA_ARCH_BIN "35 50 52 61" CACHE STRING "Specify 'real' GPU arch to build binaries for, BIN(PTX) format is supported. Example: 1.3 2.1(1.3) or 13 21(13)")    #修改后

错误描述4:Error: invalid texture reference: /home/y/SLAM/ElasticFusion-master/Core/src/Cuda/convenience.cuh:68

错误分析:显卡算力与cuda版本的不匹配

解决方案:

输入命令:

cd  /home/y/SLAM/ElasticFusion-master/Core/src

gedit   CMakeLists.txt            

在CMakeLists.txt中CUDA_ARCH_PTX 双引号中添加61。具体如下,

#set(CUDA_ARCH_PTX "" CACHE STRING "Specify 'virtual' PTX arch to build PTX intermediate code for. Example: 1.0 1.2 or 10 12")                              #修改前
set(CUDA_ARCH_PTX "61" CACHE STRING "Specify 'virtual' PTX arch to build PTX intermediate code for. Example: 1.0 1.2 or 10 12")   #修改后  

错误描述5:make: *** 没有规则可以创建“/usr/lib/x86_64-linux-gnu/libGL.so”需要的目标“XXXX”。 停止

问题分析:由于动态库链接中断导致

进入报错的相应的文件目录下,并通过命令ls查看该目录下的所有文件

cd /usr/lib/x86_64-linux-gnu/
ls   

情况一:若发现libGL.so文件是不存在的,是文件缺失导致错误。

情况二:若发现libGL.so文件是存在的,但文件名是红的。通过右键其属性显示为链接中断。

两种情况处理方式一致。

解决方案:

首先在另一台可用的电脑上查看

wrx@wrx:/usr/lib/x86_64-linux-gnu$ ls -l libGL.so
lrwxrwxrwx 1 root root 14 5月  10 20:17 libGL.so -> libGL.so.1.0.0

由此可见,libGL.so正确的链接方式是与libGL.so.1.0.0链接,然后用全局搜索找到libGL.so.1.0.0所在的目录:

sudo find / -iname "*libGL.so*"

找到libGL.so.1.0.0,其路径如下:

/usr/lib/x86_64-linux-gnu/libGL.so.1.0.0

针对上述进行手动链接,命令如下:

sudo ln -s  /usr/lib/x86_64-linux-gnu/libGL.so.1.0.0    /usr/lib/x86_64-linux-gnu/libGL.so

若提示无法创建符号链接,文件已经存在,就把已经存在的那个文件删掉

sudo rm -rf  libGL.so

直接删掉不太放心,先进行备份一下

sudo cp  libGL.so  /home/y 

之后再次链接,连接完成再次ls,发现文件名不再是红色即可。

错误描述6:X Error of failed request:  BadShmSeg (invalid shared segment parameter)

 New map created with 946 points
X Error of failed request:  BadShmSeg (invalid shared segment parameter)
  Major opcode of failed request:  131 (MIT-SHM)
  Minor opcode of failed request:  2 (X_ShmDetach)
  Segment id in failed request:  0x0
  Serial number of failed request:  33
  Current serial number in output stream:  34
Framebuffer with requested attributes not available. Using available framebuffer. You may see visual artifacts.段错误 (核心已转储)

解决方案:

打开环境:

sudo gedit  /etc/environment

在文档末尾添加:

QT_X11_NO_MITSHM=1

保存后运行:

source  /etc/environment

错误描述7:  "/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"  but not all the files it references.

The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.

解决方案:

首先查看python-vtk6是否安装或使用locate定位:

ls -l  /usr/lib/python2.7/dist-packages/vtk/libvtkRendering*
locate libvtkRenderingPythonTkWidgets.so  

如果没找到,则执行安装:

sudo apt-get install python-vtk6

如果找到,则手动链接:

sudo ln -s /usr/lib/python2.7/dist-packages/vtk/libvtkRenderingPythonTkWidgets.x86_64-linux-gnu.so /usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so

-- The imported target "vtk" references the file
   "/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.

解决方案:

sudo ln -s /usr/bin/vtk6 /usr/bin/vtk

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

你可能感兴趣的:(开发语言,c++,linux,ubuntu)