《视觉SLAM十四讲》报错信息和解决方案

ch4-Sophus编译报错

  • 报错信息:
error: lvalue required as left operand of assignment
   unit_complex_.real() = 1.;
                          ^~
error: lvalue required as left operand of assignment
   unit_complex_.imag() = 0.;
                          ^~
CMakeFiles/Sophus.dir/build.make:65: recipe for target 'CMakeFiles/Sophus.dir/sophus/so2.cpp.o' failed
  • 解决方法:修改Sophus下的so2.cpp文件
    • 将下面这个修改一下:

      unit_complex_.real() = 1.;
      unit_complex_.imag() = 0.;
      
    • 修改为:

      unit_complex_.real(1.);
      unit_complex_.imag(0.);
      

ch5/imageBasics安装opencv4.x报错

  • 环境:Unbuntu22.04,安装opencv4.x
  • 报错信息:
libgtk2.0-dev : 依赖: libgdk-pixbuf-2.0-dev (>= 2.21.0) 但无法安装它 或 libgdk-pixbuf2.0-dev (>= 2.21.0) 但无法安装它

ch5/joinMap/CMakeLists.txt编译报错

  • 报错信息:
error: #error PCL requires C++14 or above
  • 我的解决方案:注释掉关于 c++11特性的设置
# set( CMAKE_CXX_FLAGS "-std=c++11 -O3")

ch5/joinMap-pcl_viewer map.pcd报错

  • 环境:Mac中的Ubuntu22.04虚拟机

  • 报错信息:在生成map.pcd地图之后执行pcl_viewer map.pcd报错:

    $ ch5/joinMap$ pcl_viewer map.pcd 
    2023-07-31 21:33:35.519 (   0.006s) [        C7314880] vtkContextDevice2D.cxx:32    WARN| Error: no override found for 'vtkContextDevice2D'.
    The viewer window provides interactive commands; for help, press 'h' or 'H' from within the window.
    > Loading map.pcd 2023-07-31 21:33:35.647 (   0.134s) [        C7314880]vtkOpenGLRenderWindow.c:499    ERR| vtkXOpenGLRenderWindow (0x563c2ae6cf10): Unable to find a valid OpenGL 3.2 or later implementation. Please update your video card driver to the latest version. If you are using Mesa please make sure you have version 11.2 or later and make sure your driver in Mesa supports OpenGL 3.2 such as llvmpipe or openswr. If you are on windows and using Microsoft remote desktop note that it only supports OpenGL 3.2 with nvidia quadro cards. You can use other remoting software such as nomachine to avoid this issue.
    2023-07-31 21:33:35.647 (   0.134s) [        C7314880]     vtkOpenGLState.cxx:1795  WARN| Hardware does not support the number of textures defined.
    2023-07-31 21:33:35.647 (   0.134s) [        C7314880]     vtkOpenGLState.cxx:1795  WARN| Hardware does not support the number of textures defined.
    2023-07-31 21:33:35.648 (   0.134s) [        C7314880]     vtkOpenGLState.cxx:1795  WARN| Hardware does not support the number of textures defined.
    2023-07-31 21:33:35.648 (   0.135s) [        C7314880]     vtkOpenGLState.cxx:1795  WARN| Hardware does not support the number of textures defined.
    2023-07-31 21:33:35.648 (   0.135s) [        C7314880]     vtkOpenGLState.cxx:1795  WARN| Hardware does not support the number of textures defined.
    2023-07-31 21:33:35.648 (   0.135s) [        C7314880]     vtkOpenGLState.cxx:1795  WARN| Hardware does not support the number of textures defined.
    2023-07-31 21:33:35.648 (   0.135s) [        C7314880]     vtkOpenGLState.cxx:1795  WARN| Hardware does not support the number of textures defined.
    [PCLVisualizer::setUseVbos] Has no effect when OpenGL version is ≥ 2
    2023-07-31 21:33:35.655 (   0.141s) [        C7314880]   vtkTextureObject.cxx:1463   ERR| vtkTextureObject (0x563c2b3b8c90): Failed to determine texture parameters. IF=0 F=6408 T=5121
    2023-07-31 21:33:35.655 (   0.141s) [        C7314880]     vtkOpenGLState.cxx:1795  WARN| Hardware does not support the number of textures defined.
    2023-07-31 21:33:35.655 (   0.142s) [        C7314880]     vtkOpenGLState.cxx:1795  WARN| Hardware does not support the number of textures defined.
    2023-07-31 21:33:35.665 (   0.152s) [        C7314880]   vtkShaderProgram.cxx:437    ERR| vtkShaderProgram (0x563c2b250fb0): 1: #version 150
    2: #ifndef GL_ES
    3: #define highp
    4: #define mediump
    5: #define lowp
    6: #endif // GL_ES
    7: #define attribute in
    8: #define varying out
    9: 
    10: 
    11: /*=========================================================================
    12: 
    13:   Program:   Visualization Toolkit
    14:   Module:    vtkPolyData2DVS.glsl
    15: 
    16:   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
    17:   All rights reserved.
    18:   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    19: 
    20:      This software is distributed WITHOUT ANY WARRANTY; without even
    21:      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    22:      PURPOSE.  See the above copyright notice for more information.
    23: 
    24: =========================================================================*/
    25: 
    26: // all variables that represent positions or directions have a suffix
    27: // indicating the coordinate system they are in. The possible values are
    28: // MC - Model Coordinates
    29: // WC - WC world coordinates
    30: // VC - View Coordinates
    31: // DC - Display Coordinates
    32: 
    33: in vec4 vertexWC;
    34: 
    35: // material property values
    36: //VTK::Color::Dec
    37: 
    38: // Texture coordinates
    39: in vec2 tcoordMC; out vec2 tcoordVCVSOutput;
    40: 
    41: // Apple Bug
    42: //VTK::PrimID::Dec
    43: 
    44: uniform mat4 WCVCMatrix;  // World to view matrix
    45: 
    46: void main()
    47: {
          
          
    48:   // Apple Bug
    49:   //VTK::PrimID::Impl
    50: 
    51:   gl_Position = WCVCMatrix*vertexWC;
    52:   tcoordVCVSOutput = tcoordMC;
    53:   //VTK::Color::Impl
    54: }
    
    2023-07-31 21:33:35.665 (   0.152s) [        C7314880]   vtkShaderProgram.cxx:438    ERR| vtkShaderProgram (0x563c2b250fb0): 0:1(10): error: GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES
    
    2023-07-31 21:33:35.665 (   0.152s) [        C7314880]   vtkShaderProgram.cxx:437    ERR| vtkShaderProgram (0x563c2b246170): 1: #version 150
    2: #ifndef GL_ES
    3: #define highp
    4: #define mediump
    5: #define lowp
    6: #endif // GL_ES
    7: #define attribute in
    8: #define varying out
    9: 
    10: in vec4 ndCoordIn;
    11: in vec2 texCoordIn;
    12: out vec2 texCoord;
    13: void main()
    14: {
          
          
    15:   gl_Position = ndCoordIn;
    16:   texCoord = texCoordIn;
    17: }
    
    2023-07-31 21:33:35.665 (   0.152s) [        C7314880]   vtkShaderProgram.cxx:438    ERR| vtkShaderProgram (0x563c2b246170): 0:1(10): error: GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES
    
    2023-07-31 21:33:35.665 (   0.152s) [        C7314880]vtkOpenGLVertexArrayObj:265    ERR| vtkOpenGLVertexArrayObject (0x563c2b7bf8b0): attempt to add attribute without a program for attribute ndCoordIn
    2023-07-31 21:33:35.665 (   0.152s) [        C7314880]vtkOpenGLQuadHelper.cxx:62    WARN| Error binding ndCoords to VAO.
    2023-07-31 21:33:35.665 (   0.152s) [        C7314880]vtkOpenGLRenderWindow.c:932    ERR| vtkXOpenGLRenderWindow (0x563c2ae6cf10): Couldn't build the shader program for depth blits
    段错误 (核心已转储)
    
  • 核心报错信息:vtkShaderProgram (0x563c2b246170): 0:1(10): error: GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES

  • 可能的解决方案:在Ubuntu虚拟机中运行OpenGL程序时,可能会遇到一些限制,因为虚拟机可能无法直接访问主机系统的显卡硬件。这可能导致OpenGL实现不支持较高版本的GLSL。要解决这个问题,您可以尝试以下方法:

    • 启用3D加速:确保您的虚拟机软件(如VirtualBox、VMware等)已启用3D加速。这通常可以在虚拟机设置的显示或图形部分找到。启用3D加速后,虚拟机将尝试使用主机系统的显卡来提供更好的OpenGL支持。
    • 安装虚拟机工具:确保您已安装了虚拟机软件提供的增强工具(如VirtualBox Guest Additions、VMware Tools等)。这些工具通常包含了针对虚拟机优化的图形驱动程序,可以提高OpenGL性能和兼容性。

    • 使用软件渲染(我是通过这个解决的):如果您无法启用3D加速或安装虚拟机工具,您可以尝试使用软件渲染。这将使用CPU而不是GPU来渲染OpenGL图形,性能可能较差,但可以提供更广泛的GLSL支持。在Ubuntu中,您可以安装Mesa的软件渲染器,例如llvmpipe。要安装llvmpipe,请运行以下命令:

      sudo apt-get install libgl1-mesa-swx11
      
    • 安装完成后,您可以通过设置LIBGL_ALWAYS_SOFTWARE=1环境变量来强制使用软件渲染:

      export LIBGL_ALWAYS_SOFTWARE=1 
      

猜你喜欢

转载自blog.csdn.net/xijuezhu8128/article/details/132035330