You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ROS PCL与Drake链接错误:VTK版本冲突问题求助

ROS Noetic与Drake集成时的VTK版本冲突问题

在同时引入多个ROS包和Drake库时出现链接错误,排查后确认根源为VTK版本冲突:ROS Noetic版本的PCL依赖VTK 7.1.0,而Drake依赖VTK 9.1.0。通过ldd命令检测到的依赖信息如下:

linux-vdso.so.1 (0x00007fffa88ea000)
libdrake.so => /opt/drake/lib/libdrake.so (0x00007f644589d000)
libpcl_io.so.1.10 => /lib/x86_64-linux-gnu/libpcl_io.so.1.10 (0x00007f64455d7000)
libvtkCommonCore-7.1.so.7.1p => /lib/x86_64-linux-gnu/libvtkCommonCore-7.1.so.7.1p (0x00007f644528b000)
libvtkFiltersGeneral-7.1.so.7.1p => /lib/x86_64-linux-gnu/libvtkFiltersGeneral-7.1.so.7.1p (0x00007f6444f41000)
libvtkRenderingCore-7.1.so.7.1p => /lib/x86_64-linux-gnu/libvtkRenderingCore-7.1.so.7.1p (0x00007f6444c30000)
libvtkRenderingOpenGL2-7.1.so.7.1p => /lib/x86_64-linux-gnu/libvtkRenderingOpenGL2-7.1.so.7.1p (0x00007f6444907000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6444725000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6444533000)
libdrake_lcm.so => /opt/drake/lib/libdrake_lcm.so (0x00007f644451a000)
libdrake_marker.so => /opt/drake/lib/libdrake_marker.so (0x00007f6444517000)
libvtksys-9.1.so.1 => /opt/drake/lib/libvtksys-9.1.so.1 (0x00007f64444c2000)
libvtkfmt-9.1.so.1 => /opt/drake/lib/libvtkfmt-9.1.so.1 (0x00007f644449b000)
libvtkkissfft-9.1.so.1 => /opt/drake/lib/libvtkkissfft-9.1.so.1 (0x00007f6444493000)
libvtkloguru-9.1.so.1 => /opt/drake/lib/libvtkloguru-9.1.so.1 (0x00007f6444459000)
...

当前配置文件

CMakeLists.txt

cmake_minimum_required(VERSION 3.10)
project(my_project)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  pcl_ros
)
find_package(drake CONFIG REQUIRED PATHS /opt/drake)

catkin_package(
  CATKIN_DEPENDS roscpp pcl_ros
  DEPENDS drake
)

include_directories(${catkin_INCLUDE_DIRS})

add_executable(my_test test.cpp)
target_link_libraries(my_test drake::drake ${catkin_LIBRARIES})

package.xml

....
<buildtool_depend>catkin</buildtool_depend>
  <depend>roscpp</depend>
  <depend>pcl_ros</depend>
</package>

复现测试代码

仅引入VTK头文件就会触发段错误,测试代码如下:

#include "drake/systems/framework/diagram_builder.h"

#include <vtkPolyData.h>
 
int main() {
    drake::systems::DiagramBuilder<double> builder;
    return 0;
}

内容的提问来源于stack exchange,提问作者alvin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 15:15:46