meta-ros/classes/catkin.bbclass

59 lines
2.4 KiB
Plaintext
Raw Normal View History

#
# Copyright (c) 2013 Stefan Herbrechtsmeier, Bielefeld University
#
ROS_USE_PYTHON3 ??= "no"
inherit cmake ${@'distutils3-base' if bb.utils.to_boolean(d.getVar('ROS_USE_PYTHON3', True)) else 'distutils-base'} ros faulty-solibs
# Prepend build dependency on "catkin-runtime" and "catkin-native"
# if the package is not "catkin" or "catkin-runtime"
DEPENDS =+ "${@'' if d.getVar('BPN', True) in ('catkin', 'catkin-runtime') else 'catkin-runtime catkin-native'}"
# Prepend run dependency on "catkin-runtime" for base packages
# if the package is not "catkin" or "catkin-runtime"
RDEPENDS_${PN} =+ "${@'' if d.getVar('BPN', True) in ('catkin', 'catkin-runtime') else 'catkin-runtime'}"
# Prepend run dependency on "catkin" for dev packages
# if the package is not "catkin" or "catkin-runtime"
RDEPENDS_${PN}-dev =+ "${@'' if d.getVar('BPN', True) in ('catkin', 'catkin-runtime') else 'catkin'}"
EXTRA_OECMAKE_CATKIN = "\
-DCMAKE_PREFIX_PATH='${STAGING_DIR_HOST}${ros_prefix};${STAGING_DIR_HOST}${prefix};${STAGING_DIR_NATIVE}${ros_prefix};${STAGING_DIR_NATIVE}${prefix}' \
-DCMAKE_INSTALL_PREFIX:PATH='${ros_prefix}' \
-DCATKIN_DEVEL_PREFIX='${WORKDIR}/devel' \
"
EXTRA_OECMAKE_CATKIN_class-native = "\
-DCMAKE_PREFIX_PATH='${ros_prefix}' \
-DCMAKE_INSTALL_PREFIX:PATH='${ros_prefix}' \
-DRT_LIBRARY=${libdir_native} \
-DCATKIN_DEVEL_PREFIX='${WORKDIR}/devel' \
"
EXTRA_OECMAKE_prepend = "\
${EXTRA_OECMAKE_CATKIN} \
-DCATKIN_BUILD_BINARY_PACKAGE=ON \
-DSETUPTOOLS_DEB_LAYOUT=OFF \
-DCATKIN_ENABLE_TESTING=0 \
"
OECMAKE_SOURCEPATH = "${S}"
OECMAKE_BUILDPATH = "${S}/build"
catkin.bbclass: adapt to binutils 2.29 After updating to binutils 2.29 builds fail with build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot-native/usr/bin/i586-oe-linux/../../libexec/i586-oe-linux/gcc/i586-oe-linux/7.2.0/ld: warning: libclass_loader.so, needed by /home/rojkov/work/ros/build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so, not found (try using -rpath or -rpath-link) build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot-native/usr/bin/i586-oe-linux/../../libexec/i586-oe-linux/gcc/i586-oe-linux/7.2.0/ld: warning: libroslib.so, needed by /home/rojkov/work/ros/build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so, not found (try using -rpath or -rpath-link) build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::ClassLoader::isLibraryLoaded()' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::MultiLibraryClassLoader::loadLibrary(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::MultiLibraryClassLoader::MultiLibraryClassLoader(bool)' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `ros::package::getPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::systemLibrarySuffix[abi:cxx11]()' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::class_loader_private::AbstractMetaObjectBase::isOwnedBy(class_loader::ClassLoader const*)' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::class_loader_private::getFactoryMapForBaseClass(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::MultiLibraryClassLoader::getAllAvailableClassLoaders()' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::ClassLoader::hasUnmanagedInstanceBeenCreated()' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::ClassLoader::unloadLibraryInternal(bool)' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::MultiLibraryClassLoader::unloadLibrary(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::class_loader_private::getPluginBaseToFactoryMapMapMutex()' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::MultiLibraryClassLoader::getRegisteredLibraries[abi:cxx11]()' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `ros::package::getPlugins(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, 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> > > >&, bool)' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::MultiLibraryClassLoader::~MultiLibraryClassLoader()' build/tmp-glibc/work/i586-oe-linux/kdl-parser/1.11.14-r0/recipe-sysroot/opt/ros/indigo/lib/liburdf.so: undefined reference to `class_loader::ClassLoader::loadLibrary()' because of wrong value of -Wl,-rpath provided to the cross-linker. This patch makes use of -Wl,-rpath-link option added unconditionally to all catkin-based builds to aleviate the problem. NB: The proper fix though should either replace -Wl,-rpath with -Wl,-rpath-link where it's needed or use correct path to target libs in -Wl,-rpath. Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
2017-08-28 22:11:08 +08:00
# 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
SYSROOT_PREPROCESS_FUNCS += "catkin_sysroot_preprocess"
catkin_sysroot_preprocess () {
sysroot_stage_dir ${D}${ros_sysconfdir} ${SYSROOT_DESTDIR}${ros_sysconfdir}
}