Installation: Build Error
decada-robotics opened this issue · 4 comments
Bug report
Required information:
Using Ubuntu 20.04, ROS2 Galactic, Installing from Source.
Description of the bug
Hi building from source works smoothly in my other computers but for my current desktop I'm facing this error:
--- stderr: rmf_battery
/usr/bin/ld: /home/msi/workspace/trl_ws/install/rmf_traffic/lib/librmf_traffic.so: undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: /home/msi/workspace/trl_ws/install/rmf_traffic/lib/librmf_traffic.so: undefined reference to `pthread_rwlock_trywrlock'
/usr/bin/ld: /home/msi/workspace/trl_ws/install/rmf_traffic/lib/librmf_traffic.so: undefined reference to `pthread_rwlock_tryrdlock'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/test_rmf_battery.dir/build.make:147: test_rmf_battery] Error 1
make[1]: *** [CMakeFiles/Makefile2:80: CMakeFiles/test_rmf_battery.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
I tried searching online to find for solutions but couldn't find any. Would appreciate any help!
Linkers can be very tricky and inconsistent.
Could you try out the branch link_threads
from this PR: open-rmf/rmf_traffic#74 ?
Let me know if that solves this issue.
Hi, it solved the issue for rmf_traffic
but other packages such as rmf_task_ros2
failed but we've managed to fix them for our system.
Here's a pull request for the fixes.
Using -lpthread
isn't portable, so we should use find_package(Threads)
and Threads::Threads
similar to the rmf_traffic
PR.
Oops okay I've edited it to use Threads::Threads
and have double checked that the build still works. Thanks!