unitreerobotics / unitree_ros

BSD 3-Clause "New" or "Revised" License
463 stars 224 forks source link

cannot find -lunitree_joint_control_tool #58

Open BolunDai0216 opened 1 year ago

BolunDai0216 commented 1 year ago

When installing unitree_ros I get the following error

Scanning dependencies of target unitree_servo
[ 97%] Building CXX object unitree_ros/unitree_controller/CMakeFiles/unitree_servo.dir/src/servo.cpp.o
[ 98%] Linking CXX executable /home/parallels/unitree_ws/devel/lib/unitree_controller/unitree_servo
[100%] Linking CXX shared library /home/parallels/unitree_ws/devel/lib/libunitree_legged_control.so
/usr/bin/ld: skipping incompatible /home/parallels/unitree_ws/src/unitree_ros/unitree_legged_control/lib/libunitree_joint_control_tool.so when searching for -lunitree_joint_control_tool
/usr/bin/ld: cannot find -lunitree_joint_control_tool
collect2: error: ld returned 1 exit status
make[2]: *** [unitree_ros/unitree_legged_control/CMakeFiles/unitree_legged_control.dir/build.make:110: /home/parallels/unitree_ws/devel/lib/libunitree_legged_control.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:2629: unitree_ros/unitree_legged_control/CMakeFiles/unitree_legged_control.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Built target unitree_servo
make: *** [Makefile:141: all] Error 2
Invoking "make -j2 -l2" failed

Can someone help me understand what is the issue?

Thanks in advance!

thschafer commented 1 year ago

I had this same problem. The full error indicates that ld finds libunitree_joint_control_tool.so, but that particular .so is not compatible with the rest of your build: /usr/bin/ld: skipping incompatible /home/parallels/unitree_ws/src/unitree_ros/unitree_legged_control/lib/libunitree_joint_control_tool.so when searching for -lunitree_joint_control_tool

For me, it was because I am building on an arm64 system. The build seems to be set for amd64 by default. The appropriate arm64 .so is also provided under unitree_ros/unitree_legged_control/lib/. You can correct this by changing the last line of unitree_ros/unitree_legged_control/CMakeLists.txt from: target_link_libraries(unitree_legged_control ${catkin_LIBRARIES} unitree_joint_control_tool) to: target_link_libraries(unitree_legged_control ${catkin_LIBRARIES} unitree_joint_control_tool_arm64)