diff --git a/classes/catkin.bbclass b/classes/catkin.bbclass index dffb8d9..9fa086e 100644 --- a/classes/catkin.bbclass +++ b/classes/catkin.bbclass @@ -29,6 +29,14 @@ EXTRA_OECMAKE_prepend = "\ OECMAKE_SOURCEPATH = "${S}" OECMAKE_BUILDPATH = "${S}/build" +# Having a command like `find_package(catkin COMPONENTS roscpp)` in a package's CMakeLists.txt +# leads to adding "-Wl,-rpath=${RECIPE_SYSROOT}${ros_libdir}" option to the cross-linker. +# However starting from binutils 2.29 the cross-linker prepends this path with the value +# of --sysroot option thus producing wrong effective path (see https://sourceware.org/ml/binutils/2017-03/msg00161.html) +# These options help to aleviate the problem. +OECMAKE_C_LINK_FLAGS += "-Wl,-rpath-link=${RECIPE_SYSROOT}${ros_libdir}" +OECMAKE_CXX_LINK_FLAGS += "-Wl,-rpath-link=${RECIPE_SYSROOT}${ros_libdir}" + export BUILD_SYS export HOST_SYS