Open KenYN opened 4 years ago
OK, I've added a workaround similar to the nodelet
one; in the CMakeLists.txt
:
if((NOT "${ros1_message_package}" STREQUAL "nodelet") AND (NOT "${ros1_message_package}" STREQUAL "rviz"))
I still get the "Cannot generate a safe runtime search path for target rosbag2_bag_v2_plugins because there is a cycle in the constraint graph" warning, but otherwise it seems to be OK. ros2 bag info -s rosbag_v2 <path_to_bagfile>
works as expected.
Could you provide more details for your workaround?
Which CMakeList.txt did you modify?
Did you modify src/rosbag2_bag_v2/rosbag2_bag_v2_plugins/CMakeLists.txt
?
Did you wrap the entire file with
if((NOT "${ros1_message_package}" STREQUAL "nodelet") AND (NOT "${ros1_message_package}" STREQUAL "rviz"))
I am trying to build this plugin with eloquent and melodic and I get
CMake Warning at CMakeLists.txt:76 (add_library):
Cannot generate a safe runtime search path for target
rosbag2_bag_v2_plugins because there is a cycle in the constraint graph:
dir 0 is [/home/zwieszok/projects/my_rosbag2/install/lib]
dir 1 is [/opt/ros/eloquent/lib]
dir 0 must precede it due to runtime library [libros1_rosbag_storage.so]
dir 3 must precede it due to runtime library [libcv_bridge.so]
dir 2 is [/opt/ros/eloquent/opt/yaml_cpp_vendor/lib]
dir 3 is [/opt/ros/melodic/lib]
dir 1 must precede it due to runtime library [libclass_loader.so]
dir 4 is [/usr/lib/x86_64-linux-gnu/hdf5/openmpi]
dir 5 is [/usr/lib/x86_64-linux-gnu/openmpi/lib]
Some of these libraries may not be found correctly.
/opt/ros/melodic/lib/librosbag_storage.so: undefined reference to `class_loader::impl::AbstractMetaObjectBase::isOwnedBy(class_loader::ClassLoader const*)'
/opt/ros/melodic/lib/librosbag_storage.so: undefined reference to `class_loader::MultiLibraryClassLoader::getAllAvailableClassLoaders()'
/opt/ros/melodic/lib/librosbag_storage.so: undefined reference to `class_loader::MultiLibraryClassLoader::getRegisteredLibraries[abi:cxx11]()'
/opt/ros/melodic/lib/librosbag_storage.so: undefined reference to `class_loader::ClassLoader::isLibraryLoaded()'
collect2: error: ld returned 1 exit status
make[2]: *** [test_rosbag_output_stream] Error 1
make[1]: *** [CMakeFiles/test_rosbag_output_stream.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/opt/ros/melodic/lib/librosbag_storage.so: undefined reference to `class_loader::impl::AbstractMetaObjectBase::isOwnedBy(class_loader::ClassLoader const*)'
/opt/ros/melodic/lib/librosbag_storage.so: undefined reference to `class_loader::MultiLibraryClassLoader::getAllAvailableClassLoaders()'
/opt/ros/melodic/lib/librosbag_storage.so: undefined reference to `class_loader::MultiLibraryClassLoader::getRegisteredLibraries[abi:cxx11]()'
/opt/ros/melodic/lib/librosbag_storage.so: undefined reference to `class_loader::ClassLoader::isLibraryLoaded()'
collect2: error: ld returned 1 exit status
make[2]: *** [test_rosbag_v2_storage] Error 1
make[1]: *** [CMakeFiles/test_rosbag_v2_storage.dir/all] Error 2
make: *** [all] Error 2
---
Failed <<< rosbag2_bag_v2_plugins [50.1s, exited with code 2]
I replaced this line with the indicated code. In your case, it seems to be rosbag_storage
that is causing the problem, so it could be changed to this:
if((NOT "${ros1_message_package}" STREQUAL "nodelet") AND (NOT "${ros1_message_package}" STREQUAL "rosbag_storage")
AND (NOT "${ros1_message_package}" STREQUAL "rviz"))
Or perhaps it would be better and more compact as (not tested!):
set(ignore_packages nodelet rosbag_storage rviz)
if (NOT(${ros1_message_package} IN_LIST ignore_packages))
It works! Thank you :+1: I still get the errors with graph cycles as you described, but it compiles nevertheless.
What worked for me:
colcon build --packages-select rosbag2_bag_v2_plugins --cmake-args ' -Dclass_loader_INCLUDE_DIRS=/opt/ros/foxy/include/class_loader' '-Dclass_loader_LIBRARIES=/opt/ros/foxy/lib/libclass_loader.so'
I think this is a separate issue from #29 although it was initially reported under there. I get the following errors:
Looking at the two
libclass_loader.so
I see this (and all other methods areconst
infoxy
):So, the linker should be pulling in
noetic/lib/libclass_loader.so
but for some reason it is choosing thefoxy
version. I believe I am sourcing everything correctly:I'm not sure why
librviz.so
is being picked up - is this normal?