Closed ipa-rwu closed 1 year ago
At first glance, this is probably due to the fact that the hooks installed by the debs in /opt/ros/<rosdistro>
are generated by ament, and the hooks generated by colcon might be a little different. Clearly they aren't completely compatible if this sort of bug is popping up.
This isn't really a solution to this exact issue, but installing using colcon on top of the files installed by the debs probably isn't a good idea for reasons other than what you're experiencing here. This is the sort of scenario that overlay workspaces are designed for. You should install the packages to a different location and source that workspace's setup
script, which should automatically chain to the /opt/ros/<distro>
setup script as well as long as it had already been sourced when the new workspace was created.
Thanks for you answer! I will close the issue.
I also posed this question in answers.ros.org in case anybody has the same issue.
Here is the problem:
After I run the command
I found the environment variable "LD_LIBRARY_PATH" changed from
/opt/ros/galactic/lib/x86_64-linux-gnu:/opt/ros/galactic/lib
to/opt/ros/galactic/lib
. And then it caused it cannot find libraries under /opt/ros/galactic/lib/x86_64-linux-gnu.Here are steps you can reproduce this error:
You can use docker image "public.ecr.aws/docker/library/ros:galactic"
put demo_nodes_cpp in your "src" folder. This demo needs
libconsole_bridge.so.1.0
which is under/opt/ros/galactic/lib/x86_64-linux-gnu
run
check the environment variable "LD_LIBRARY_PATH":
echo $LD_LIBRARY_PATH
. You should get/opt/ros/galactic/opt/yaml_cpp_vendor/lib:/opt/ros/galactic/lib/x86_64-linux-gnu:/opt/ros/galactic/lib
save this container as a docker image. You can run
to find this container ID. Then run
start a container of the new docker image. Then check check the environment variable "LD_LIBRARY_PATH":
echo $LD_LIBRARY_PATH
Run the demo
ros2 run demo_nodes_cpp talker
. You will get the error/opt/ros/galactic/lib/demo_nodes_cpp/talker: error while loading shared libraries: libconsole_bridge.so.1.0: cannot open shared object file: No such file or directory
There is no issue if only using
colcon build
. So I suspect the cause of this is from--merge-install
.Thank you for your help!