ROS /usr/bin/ld: 找不到 -lmsc collect2: error: ld returned 1 exit status
时间: 2023-11-16 20:00:27 浏览: 214
ROS在链接外部库文件的时候编译可能会出现以下错误: /usr/bin/ld cannot find -l* collect2: error: ld returned 1 exit status。这个错误通常是由于缺少相应的库文件或者库文件路径不正确导致的。在这个错误中,/usr/bin/ld: 找不到 -lmsc collect2: error: ld returned 1 exit status,说明缺少名为libmsc.so的库文件。解决这个问题的方法是需要安装或重新安装缺失的库文件。可以通过以下命令安装msc库文件:
```
sudo apt-get install libmsc-dev
```
如果已经安装了该库文件,可以尝试将库文件路径添加到LD_LIBRARY_PATH环境变量中:
```
export LD_LIBRARY_PATH=/path/to/libmsc.so:$LD_LIBRARY_PATH
```
如果以上方法都无法解决问题,可以尝试重新编译安装ROS。
相关问题
/usr/bin/ld: /home/sparks/xarm_ws/devel/lib/libxarm_hw.so: undefined reference to `xarm_api::XArmDriver::init(ros::NodeHandle&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)' collect2: error: ld returned 1 exit status make[2]: *** [xarm_ros/xarm_controller/CMakeFiles/uf_ros_controller.dir/build.make:127:/home/sparks/xarm_ws/devel/lib/xarm_controller/uf_ros_controller] 错误 1 make[1]: *** [CMakeFiles/Makefile2:6948:xarm_ros/xarm_controller/CMakeFiles/uf_ros_controller.dir/all] 错误 2 make[1]: *** 正在等待未完成的任务.... [100%] Linking CXX executable /home/sparks/xarm_ws/devel/lib/xarm_controller/xarm_combined_traj_controller /usr/bin/ld: /home/sparks/xarm_ws/devel/lib/libxarm_hw.so: undefined reference to `xarm_api::XArmDriver::init(ros::NodeHandle&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)' collect2: error: ld returned 1 exit status make[2]: *** [xarm_ros/xarm_controller/CMakeFiles/xarm_combined_traj_controller.dir/build.make:167:/home/sparks/xarm_ws/devel/lib/xarm_controller/xarm_combined_traj_controller] 错误 1 make[1]: *** [CMakeFiles/Makefile2:6576:xarm_ros/xarm_controller/CMakeFiles/xarm_combined_traj_controller.dir/all] 错误 2 make: *** [Makefile:141:all] 错误 2 Invoking "make -j12 -l12" failed
这个错误是由于链接器无法找到 `xarm_api::XArmDriver::init` 函数的定义而引起的。请确保你的代码中包含了正确的头文件,并且链接器能够找到相关的库文件。另外,还需要检查是否正确地初始化了 `ros::NodeHandle` 对象以及其他必要的参数。如果这些都没有问题,可能需要检查你的库文件是否正确编译并位于正确的位置。
报错usr/bin/ld: CMakeFiles/teleoperation.dir/src/teleoperation.cpp.o: in function `tele_callback(geometry_msgs::Twist_<std::allocator<void> > const&)': teleoperation.cpp:(.text+0xa61): undefined reference to `kinematics_ur::inverse_kinematics(double&, double&, double&, double&, double&, double&, double, double, double, double, double, double)' /usr/bin/ld: CMakeFiles/teleoperation.dir/src/teleoperation.cpp.o: in function `__static_initialization_and_destruction_0(int, int)': teleoperation.cpp:(.text+0x1ac7): undefined reference to `kinematics_ur::kinematics_ur()' collect2: error: ld returned 1 exit status make[2]: *** [Geomagic_Touch_ROS_Drivers/omni_common/CMakeFiles/teleoperation.dir/build.make:106: /home/yibeim/devel/Touch_ROS_Driver-master/catin_ws/devel/lib/omni_common/teleoperation] Error 1 make[1]: *** [CMakeFiles/Makefile2:2079: Geomagic_Touch_ROS_Drivers/omni_common/CMakeFiles/teleoperation.dir/all] Error 2 make: *** [Makefile:141: all] Error 2 Invoking "make -j4 -l4" failed
我不太明白您的问题,但是我可以尝试回答:我不了解您提到的usr/bin/ld、CMakeFiles/teleoperation.dir/src/teleoperation.cpp.o和tele_callback()函数,但我猜你可能在尝试调用某种函数来实现某项任务,而该函数可能与geometry_msgs::Twist_<std::allocator<void> >有关。
阅读全文