Closed potentialdiffer closed 5 years ago
I am getting the same error using a VM with Ubuntu 18.04.
Not building the tests should get around this error. Try adding --cmake-args -DBUILD_TESTING=OFF
to your colcon build command.
I suspect there is a problem in the rcl cmake scripts. Maybe you can open an inssue on ros2/rcl?
Thanks! Disabling test building solved the problem for now.
@filiperinaldi @lmayencourt do you know which tests are causing these issues so we can enable running tests through cross-compilation?
@nuclearsandwich Building any test in rcl
will result in this error. I'm seeing it too on my computer. I think this ticket deserves reopening.
I did some debug. Here's the whole compiling command of the failed target
/usr/bin/aarch64-linux-gnu-g++ ...
```shell /usr/bin/aarch64-linux-gnu-g++ \ --sysroot=/home/myname/sysroot_arm64v8_ubuntu_bionic \ CMakeFiles/test_wait__rmw_fastrtps_dynamic_cpp.dir/rcl/test_wait.cpp.o \ -o test_wait__rmw_fastrtps_dynamic_cpp \ -Wl,-rpath,/home/myname/cc_ws/ros2_ws/build/rcl:/home/myname/cc_ws/ros2_ws/install/rmw_fastrtps_dynamic_cpp/lib:/home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_introspection_cpp/lib:/home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_introspection_c/lib:/home/myname/cc_ws/ros2_ws/install/rmw_fastrtps_shared_cpp/lib:/home/myname/cc_ws/ros2_ws/install/rcutils/lib:/home/myname/cc_ws/ros2_ws/install/rosidl_generator_c/lib:/home/myname/cc_ws/ros2_ws/install/rmw/lib:/home/myname/cc_ws/ros2_ws/install/fastrtps/lib:/home/myname/cc_ws/ros2_ws/install/fastcdr/lib:/home/myname/cc_ws/ros2_ws/install/builtin_interfaces/lib:/home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_cpp/lib:/home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_c/lib:/home/myname/cc_ws/ros2_ws/install/rcl_interfaces/lib:/home/myname/cc_ws/ros2_ws/install/rmw_implementation/lib:/home/myname/cc_ws/ros2_ws/install/rcl_logging_noop/lib \ ../gtest/libgtest_main.a \ ../gtest/libgtest.a \ ../librcl.so \ /home/myname/cc_ws/ros2_ws/install/rmw_fastrtps_dynamic_cpp/lib/librmw_fastrtps_dynamic_cpp.so \ /home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_introspection_cpp/lib/librosidl_typesupport_introspection_cpp.so \ /home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_introspection_c/lib/librosidl_typesupport_introspection_c.so \ /home/myname/cc_ws/ros2_ws/install/rmw_fastrtps_shared_cpp/lib/librmw_fastrtps_shared_cpp.so \ /home/myname/cc_ws/ros2_ws/install/rcutils/lib/librcutils.so \ /home/myname/cc_ws/ros2_ws/install/rosidl_generator_c/lib/librosidl_generator_c.so \ /home/myname/cc_ws/ros2_ws/install/rmw/lib/librmw.so \ /home/myname/cc_ws/ros2_ws/install/fastrtps/lib/libfastrtps.so.1.8.0 \ /home/myname/cc_ws/ros2_ws/install/fastcdr/lib/libfastcdr.so.1.0.9 \ -pthread \ /home/myname/cc_ws/ros2_ws/install/builtin_interfaces/lib/libbuiltin_interfaces__rosidl_typesupport_c.so \ /home/myname/cc_ws/ros2_ws/install/builtin_interfaces/lib/libbuiltin_interfaces__rosidl_typesupport_cpp.so \ /home/myname/cc_ws/ros2_ws/install/builtin_interfaces/lib/libbuiltin_interfaces__rosidl_typesupport_fastrtps_c.so \ /home/myname/cc_ws/ros2_ws/install/builtin_interfaces/lib/libbuiltin_interfaces__rosidl_generator_c.so \ /home/myname/cc_ws/ros2_ws/install/builtin_interfaces/lib/libbuiltin_interfaces__rosidl_typesupport_fastrtps_cpp.so \ /home/myname/cc_ws/ros2_ws/install/builtin_interfaces/lib/libbuiltin_interfaces__rosidl_typesupport_introspection_c.so \ /home/myname/cc_ws/ros2_ws/install/builtin_interfaces/lib/libbuiltin_interfaces__rosidl_typesupport_introspection_cpp.so \ /home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_cpp/lib/librosidl_typesupport_cpp.so \ /home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_c/lib/librosidl_typesupport_c.so \ /home/myname/cc_ws/ros2_ws/install/rcl_interfaces/lib/librcl_interfaces__rosidl_typesupport_c.so \ /home/myname/cc_ws/ros2_ws/install/rcl_interfaces/lib/librcl_interfaces__rosidl_typesupport_cpp.so \ /home/myname/cc_ws/ros2_ws/install/rcl_interfaces/lib/librcl_interfaces__rosidl_typesupport_fastrtps_c.so \ /home/myname/cc_ws/ros2_ws/install/rcl_interfaces/lib/librcl_interfaces__rosidl_generator_c.so \ /home/myname/cc_ws/ros2_ws/install/rcl_interfaces/lib/librcl_interfaces__rosidl_typesupport_fastrtps_cpp.so \ /home/myname/cc_ws/ros2_ws/install/rcl_interfaces/lib/librcl_interfaces__rosidl_typesupport_introspection_c.so \ /home/myname/cc_ws/ros2_ws/install/rcl_interfaces/lib/librcl_interfaces__rosidl_typesupport_introspection_cpp.so \ /home/myname/cc_ws/ros2_ws/install/rmw_implementation/lib/librmw_implementation.so \ /home/myname/cc_ws/ros2_ws/install/rcl_logging_noop/lib/librcl_logging_noop.so \ /home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_introspection_cpp/lib/librosidl_typesupport_introspection_cpp.so \ /home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_introspection_c/lib/librosidl_typesupport_introspection_c.so \ /home/myname/cc_ws/ros2_ws/install/rcutils/lib/librcutils.so \ /home/myname/cc_ws/ros2_ws/install/rosidl_generator_c/lib/librosidl_generator_c.so \ /home/myname/cc_ws/ros2_ws/install/rmw/lib/librmw.so \ -lpthread \ -ldl \ /home/myname/sysroot_arm64v8_ubuntu_bionic/usr/lib/aarch64-linux-gnu/libtinyxml2.so \ /home/myname/sysroot_arm64v8_ubuntu_bionic/usr/lib/aarch64-linux-gnu/libssl.so \ /home/myname/sysroot_arm64v8_ubuntu_bionic/usr/lib/aarch64-linux-gnu/libcrypto.so ```
In which, librmw_fastrtps_dynamic_cpp.so
depends on librosidl_typesupport_fastrtps_c.so
which is missing. I note that this file isn't linked directly to.
Therefore, I manually included these two missing files in the compile command,
...
/home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_fastrtps_c/lib/librosidl_typesupport_fastrtps_c.so \
/home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_fastrtps_cpp/lib/librosidl_typesupport_fastrtps_cpp.so
... and it compiled, which is expected because all the dependencies are at present.
So the solution could be,
rosidl_typesupport_fastrtps_c
and rosidl_typesupport_fastrtps_cpp
as their dependencies using ament_export_dependencie()
librmw_fastrtps_dynamic_cpp.so
even though they are not at presentOutput of readelf
that might help
```shell $ aarch64-linux-gnu-readelf -a /home/myname/cc_ws/ros2_ws/install/rmw_fastrtps_dynamic_cpp/lib/librmw_fastrtps_dynamic_cpp.so ... Dynamic section at offset 0x7cbb0 contains 39 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [librosidl_typesupport_fastrtps_c.so] 0x0000000000000001 (NEEDED) Shared library: [librosidl_typesupport_fastrtps_cpp.so] 0x0000000000000001 (NEEDED) Shared library: [librosidl_typesupport_introspection_c.so] 0x0000000000000001 (NEEDED) Shared library: [librosidl_typesupport_introspection_cpp.so] 0x0000000000000001 (NEEDED) Shared library: [librmw_fastrtps_shared_cpp.so] 0x0000000000000001 (NEEDED) Shared library: [libfastrtps.so.1] 0x0000000000000001 (NEEDED) Shared library: [libfastcdr.so.1] 0x0000000000000001 (NEEDED) Shared library: [librcutils.so] 0x0000000000000001 (NEEDED) Shared library: [librmw.so] 0x0000000000000001 (NEEDED) Shared library: [librosidl_generator_c.so] 0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6] 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x0000000000000001 (NEEDED) Shared library: [ld-linux-aarch64.so.1] 0x000000000000000e (SONAME) Library soname: [librmw_fastrtps_dynamic_cpp.so] 0x000000000000001d (RUNPATH) Library runpath: [/home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_fastrtps_c/lib:/home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_fastrtps_cpp/lib:/home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_introspection_c/lib:/home/myname/cc_ws/ros2_ws/install/rosidl_typesupport_introspection_cpp/lib:/home/myname/cc_ws/ros2_ws/install/rmw_fastrtps_shared_cpp/lib:/home/myname/cc_ws/ros2_ws/install/fastrtps/lib:/home/myname/cc_ws/ros2_ws/install/fastcdr/lib:/home/myname/cc_ws/ros2_ws/install/rcutils/lib:/home/myname/cc_ws/ros2_ws/install/rmw/lib:/home/myname/cc_ws/ros2_ws/install/rosidl_generator_c/lib] ```
Upon further inspection, when doing x86_64 native compilation, the linker log shows that librosidl_typesupport_fastrtps_c.so
is eventually found in /home/hao.peng/cc_ws/ros2_ws/install_x86_64/rosidl_typesupport_fastrtps_c/lib/
However, when doing cross compiling, the cross-linker will only search in SYSROOT and will certainly fail because it's not there.
I guess this behavior controlled by these CMake settings in the feneric toolchain file
set(CMAKE_FIND_ROOT_PATH $ENV{ROS2_INSTALL_PATH})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Here's the log of the succeeded and failed linker log.
I am trying to cross compile ROS2 for arm on Debian Stretch. Following the official instructions I am able to start compilation until, however it gets terminated reaching rcl package:
It seems like
librosidl_typesupport_fastrtps_c
is not found.Any idea on this? Or should I just try an Ubuntu VM? Thanks!