Building Components from CLion doesn't work
I am trying to build the composition demo package with CLion, but I always get linking errors.
When I build from shell, it works out of the box.
I am running CLion from the same shell where the shell build worked.
undefined reference to `class_loader::ClassLoader::ClassLoader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
CMakeFiles/dlopen_composition.dir/src/dlopen_composition.cpp.o: In function `std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > class_loader::impl::getAvailableClasses<rclcpp_components::NodeFactory>(class_loader::ClassLoader const*)':
/opt/ros/dashing/include/class_loader/class_loader_core.hpp:310: undefined reference to `class_loader::impl::getPluginBaseToFactoryMapMapMutex()'
/opt/ros/dashing/include/class_loader/class_loader_core.hpp:318: undefined reference to `class_loader::impl::AbstractMetaObjectBase::isOwnedBy(class_loader::ClassLoader const*) const'
/opt/ros/dashing/include/class_loader/class_loader_core.hpp:320: undefined reference to `class_loader::impl::AbstractMetaObjectBase::isOwnedBy(class_loader::ClassLoader const*) const'
CMakeFiles/dlopen_composition.dir/src/dlopen_composition.cpp.o: In function `rclcpp_components::NodeFactory* class_loader::ClassLoader::createRawInstance<rclcpp_components::NodeFactory>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)':
/opt/ros/dashing/include/class_loader/class_loader.hpp:280: undefined reference to `class_loader::ClassLoader::setUnmanagedInstanceBeenCreated(bool)'
CLion cmake output:
- Found ament_cmake: 0.7.3 (/opt/ros/dashing/share/ament_cmake/cmake)
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Found example_interfaces: 0.7.1 (/opt/ros/dashing/share/example_interfaces/cmake)
-- Found rosidl_adapter: 0.7.4 (/opt/ros/dashing/share/rosidl_adapter/cmake)
-- Found rclcpp: 0.7.6 (/opt/ros/dashing/share/rclcpp/cmake)
-- Found rmw_implementation_cmake: 0.7.2 (/opt/ros/dashing/share/rmw_implementation_cmake/cmake)
-- Found rclcpp_components: 0.7.6 (/opt/ros/dashing/share/rclcpp_components/cmake)
-- Found poco_vendor: (/opt/ros/dashing/share/poco_vendor/cmake)
CMake Warning at /opt/ros/dashing/share/class_loader/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
Package 'class_loader' exports library 'class_loader' which couldn't be
found
I am a bit clueless where the problem might be.
Workaround: run
export CMAKE_LIBRARY_PATH="/opt/ros/dashing/lib"
before running CLion.I think this might be a bug in
class_loader
, and this should fix it https://github.com/ros/class_loader/p...