ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I've never build a ROS 2 only ROOTFS/toolchain, it was always included in the company internal project. And it is also not really finished or reviewed, so there might be clutter or better solutions to get stuff done. With this it is possible to link against packages within the toolchain, to create an full overlay workspace with several packages depending on each other isn't yet finished (but this might work for you as well, it is just currently incompatible with out company internal crosscompile workflow) Feel free to improve this.

The following description is taken from my git history, so this might not be the optimal step for everything, but here it goes.

  • Created a new packagegroup for the ROS related stuff.
  • Add the following to the RDEPENDS_${PN} of this packagegroup: ros-base, ros-workspace-implicitworkspace, foonathan-memory-staticdev.
  • Added this packagegroup to the SDK_RDEPENDS (this might be called differently, we use an alias in our yocto project)
  • Added nativesdk-ament-package, nativesdk-ament-cmake, nativesdk-rosidl-default-generators, nativesdk-rosidl-typesupport-fastrtps-c, nativesdk-rosidl-typesupport-fastrtps-cpp and nativesdk-colcon-ros to the RDEPENDS_${PN} of the nativesdk- of this packagegroup
  • Added the following files

ament-cmake_%.bbappend

RDEPENDS_${PN}_append = " \
    ament-cmake-core \
    ament-cmake-export-definitions \
    ament-cmake-export-dependencies \
    ament-cmake-export-include-directories \
    ament-cmake-export-interfaces \
    ament-cmake-export-libraries \
    ament-cmake-export-link-flags \
    ament-cmake-export-targets \
    ament-cmake-libraries \
    ament-cmake-python \
    ament-cmake-target-dependencies \
    ament-cmake-test \
    ament-cmake-version \
    ament-cmake-include-directories \
"

spdlog_%.bbappend

BUILDSDK_CXXFLAGS_append = " -fuse-ld=gold"

BBCLASSEXTEND = " nativesdk "

spdlog-vendor_%.bbappend (I'm not sure if everything is required from that, spdlog was driving me crazy)

ROS_BUILD_DEPENDS_remove = "spdlog"
ROS_EXPORT_DEPENDS_remove = "spdlog"
DEPENDS_append_class-target = " spdlog "
DEPENDS_append_class-nativesdk = " spdlog "
#DEPENDS_append = "spdlog"
# spdlog is header only library and PN is empty, so it wasn't created
RDEPENDS_${PN}_remove = "spdlog"
RDEPENDS_${PN}_remove = "nativesdk-spdlog"

rcl-logging-spdlog_%.bbappend

# spdlog is header only library and PN is empty, so it wasn't created
ROS_BUILD_DEPENDS_remove = "spdlog"
DEPENDS_append_class-target = " spdlog "
RDEPENDS_${PN}_remove = "spdlog"
RDEPENDS_${PN}_remove = "nativesdk-spdlog"

foonathan-memory_%.bbappend

BUILDSDK_CXXFLAGS_append = " -fPIC "

python3-pytest-cov_%.bbappend

RDEPENDS_${PN}_append = " \
    ${PYTHON_PN}-pytest \
    ${PYTHON_PN}-coverage \
"

python3-coverage_5.2.1.bb

SUMMARY = "Code coverage measurement for Python"
HOMEPAGE = "https://coverage.readthedocs.io"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=2ee41112a44fe7014dce33e26468ba93"

SRC_URI[md5sum] = "9e6165146b9bda60a779953c79e8ca54"
SRC_URI[sha256sum] = "a34cb28e0747ea15e82d13e14de606747e9e484fb28d63c999483f5d5188e89b"

inherit pypi setuptools3

python3-pytest-rerunfailures_10.2.bb

inherit setuptools3

SUMMARY = "pytest-rerunfailures is a plugin for pytest that re-runs tests to eliminate intermittent failures."
HOMEPAGE = "https://github.com/pytest-dev/pytest-rerunfailures"
LICENSE = "MPL-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=06238b648baf0545473491607f3093c5"

RDEPENDS_${PN}_append = " \
    ${PYTHON_PN}-pytest \
    ${PYTHON_PN}-setuptools \
"

SRC_URI = "git://github.com/pytest-dev/pytest-rerunfailures.git;tag=${PV};protocol=https"
S="${WORKDIR}/git"

BBCLASSEXTEND = "nativesdk"

python3-pytest-repeat_0.9.1.bb

inherit setuptools3

SUMMARY = "pytest-repeat is a plugin for pytest that makes it easy to repeat a single test, or multiple tests, a specific number of times."
HOMEPAGE = "https://github.com/pytest-dev/pytest-repeat"
LICENSE = "MPL-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=2a0bb0f2949a8babbc1df9a81a569b25"

DEPENDS_append = " \
    ${PYTHON_PN}-setuptools-scm-native \
"

RDEPENDS_${PN}_append = " \
    ${PYTHON_PN}-pytest \
    ${PYTHON_PN}-setuptools-scm \
"

SRC_URI = " git://github.com/pytest-dev/pytest-repeat.git;tag=v${PV};protocol=https; "
S="${WORKDIR}/git"

BBCLASSEXTEND = "nativesdk"

python3-distlib_0.3.2.bb

inherit setuptools3

SUMMARY = "Distlib is a library which implements low-level functions that relate to packaging and distribution of Python software. It is intended to be used as the basis for third-party packaging tools. The documentation is available at."
HOMEPAGE = "https://github.com/vsajip/distlib"
LICENSE = "Python-2.0"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=f6a11430d5cd6e2cd3832ee94f22ddfc"

SRC_URI = "git://github.com/vsajip/distlib.git;tag=${PV};protocol=https"
S="${WORKDIR}/git"

BBCLASSEXTEND = "nativesdk"

files/python3-pytest-repeat-setuptools-scm-import.patch

--- a/setup.py
+++ b/setup.py
@@ -1,3 +1,4 @@ setup(name='pytest-repeat',
 from setuptools import setup
+import setuptools_scm

 setup(name='pytest-repeat',
       use_scm_version=True,

files/python3-pytest-repeat-setup-requires.patch

diff --git a/setup.py b/setup.py
index 4b3db37..ec8d06d 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,6 @@ setup(name='pytest-repeat',
       url='https://github.com/pytest-dev/pytest-repeat',
       py_modules=['pytest_repeat'],
       entry_points={'pytest11': ['repeat = pytest_repeat']},
-      setup_requires=['setuptools_scm'],
       install_requires=['pytest>=3.6'],
       license='Mozilla Public License 2.0 (MPL 2.0)',
       keywords='pytest pytest repeat',

colcon-test-result_0.3.8.bb

inherit setuptools3

SUMMARY = "An extension for colcon-core to provide information about the test results."
HOMEPAGE = "https://github.com/colcon/colcon-test-result"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

RDEPENDS_${PN}_append = " \
    colcon-core \
"

SRC_URI = "git://github.com/colcon/colcon-test-result.git;tag=${PV};protocol=https"
S="${WORKDIR}/git"
#SRC_URI = "https://github.com/colcon/colcon-test-result/archive/refs/tags/${PV}.tar.gz"
#SRC_URI[sha256sum] = "b10643fd8de667e320843558aafbf7dd4f756b6addbbe7e03e08f5de6e375d06"

BBCLASSEXTEND = "nativesdk"

colcon-ros_0.3.21.bb

inherit setuptools3

SUMMARY = "An extension for `colcon-core <https://github.com/colcon/colcon-core>`_ to support `ROS packages <http://www.ros.org>`_."
HOMEPAGE = "https://github.com/colcon/colcon-ros"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

RDEPENDS_${PN}_append = " \
    ${PYTHON_PN}-catkin-pkg \
    colcon-cmake \
    colcon-core \
    colcon-pkg-config \
    colcon-python-setup-py \
    colcon-recursive-crawl \
"

SRC_URI = "git://github.com/colcon/colcon-ros.git;tag=${PV};protocol=https"
S="${WORKDIR}/git"
#SRC_URI = "https://github.com/colcon/colcon-ros/archive/refs/tags/${PV}.tar.gz"
#SRC_URI[sha256sum] = "b0f13861e5adc9b89db686caf3d8b66cb3c40f803917925be2846d7fafe43499"

BBCLASSEXTEND = "nativesdk"

colcon-recursive-crawl_0.2.1.bb

inherit setuptools3

SUMMARY = "An extension for colcon-core to recursively crawl for packages."
HOMEPAGE = "https://github.com/colcon/colcon-recursive-crawl"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

RDEPENDS_${PN}_append = " \
    colcon-core \
"

SRC_URI = "git://github.com/colcon/colcon-recursive-crawl.git;tag=${PV};protocol=https"
S="${WORKDIR}/git"
#SRC_URI = "https://github.com/colcon/colcon-recursive-crawl/archive/refs/tags/${PV}.tar.gz"
#SRC_URI[sha256sum] = "cdce1cd4e1c6f64b6f48425189a94a7c405e62ce3adf447a114c98881fff6730"

BBCLASSEXTEND = "nativesdk"

colcon-python-setup-py_0.2.7.bb

inherit setuptools3

SUMMARY = "An extension for colcon-core to identify packages with a setup.py file by introspecting the arguments to the setup() function call of setuptools."
HOMEPAGE = "https://github.com/colcon/colcon-python-setup-py"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

RDEPENDS_${PN}_append = " \
    colcon-core \
    ${PYTHON_PN}-setuptools \
"

SRC_URI = "git://github.com/colcon/colcon-python-setup-py.git;tag=${PV};protocol=https"
S="${WORKDIR}/git"
#SRC_URI = "https://github.com/colcon/colcon-python-setup-py/archive/refs/tags/${PV}.tar.gz"
#SRC_URI[sha256sum] = "892d5d5870521689e578f5da6fb17bb914a89b9a5c61ba3b3fa774c911522bc5"

BBCLASSEXTEND = "nativesdk"

colcon-pkg-config_0.1.0.bb

inherit setuptools3

SUMMARY = "An extension for colcon-core to set an environment variable to find pkg-config files."
HOMEPAGE = "https://github.com/colcon/colcon-pkg-config"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

RDEPENDS_${PN}_append = " \
    colcon-core \
"

SRC_URI = "git://github.com/colcon/colcon-pkg-config.git;tag=${PV};protocol=https"
S="${WORKDIR}/git"
#SRC_URI = "https://github.com/colcon/colcon-pkg-config/archive/refs/tags/${PV}.tar.gz"
#SRC_URI[sha256sum] = "c1d864aef5aa6209cb574eaac8fc7b6374f59a50f5c08d23d00684463926f33b"

BBCLASSEXTEND = "nativesdk"

colcon-library-path_0.2.1.bb

inherit setuptools3

SUMMARY = "An extension for colcon-core to set an environment variable to find shared libraries at runtime."
HOMEPAGE = "https://github.com/colcon/colcon-library-path"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

RDEPENDS_${PN}_append = " \
    colcon-core \
"

SRC_URI = "git://github.com/colcon/colcon-library-path.git;tag=${PV};protocol=https"
S="${WORKDIR}/git"
#SRC_URI = "https://github.com/colcon/colcon-library-path/archive/refs/tags/${PV}.tar.gz"
#SRC_URI[sha256sum] = "6948297878f17dd1f8fd94feb1451202977b68275ea9bcfe55a00125a2f70edf"

BBCLASSEXTEND = "nativesdk"

colcon-core_0.6.1.bb

inherit setuptools3

SUMMARY = "``colcon`` is a command line tool to improve the workflow of building, testing and using multiple software packages. It automates the process, handles the ordering and sets up the environment to use the packages."
HOMEPAGE = "https://github.com/colcon/colcon-core"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

RDEPENDS_${PN}_append = " \
    ${PYTHON_PN}-coloredlogs \
    ${PYTHON_PN}-distlib \
    ${PYTHON_PN}-empy \
    ${PYTHON_PN}-pytest \
    ${PYTHON_PN}-pytest-cov \
    ${PYTHON_PN}-pytest-repeat \
    ${PYTHON_PN}-pytest-rerunfailures \
    ${PYTHON_PN}-setuptools \
"

SRC_URI = "git://github.com/colcon/colcon-core.git;tag=${PV};protocol=https"
S="${WORKDIR}/git"

BBCLASSEXTEND = "nativesdk"

colcon-cmake_0.2.26.bb

inherit setuptools3

SUMMARY = "An extension for colcon-core to support CMake projects."
HOMEPAGE = "https://github.com/colcon/colcon-cmake"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

RDEPENDS_${PN}_append = " \
    colcon-core \
    colcon-library-path \
    colcon-test-result \    
"

SRC_URI = "git://github.com/colcon/colcon-cmake.git;tag=${PV};protocol=https"
S="${WORKDIR}/git"
#SRC_URI = "https://github.com/colcon/colcon-cmake/archive/refs/tags/${PV}.tar.gz"
#SRC_URI[sha256sum] = "5e392f1fe1dc6870d7f67859c233946b2383b75c4bc989ef751b8befe0152b95"

BBCLASSEXTEND = "nativesdk"

fastrtps_%.bbappend

# when build for the SDK fastrtps failed with relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
#CXXFLAGS += "-fPIC"
#BUILD_CXXFLAGS += "-fPIC"
  • And then there is a problem with the way superflore exports the package.xml to openembedded recepies. Because of this, there are a lot (all?) of recepies which require the extention BBCLASSEXTEND = "native nativesdk". In my workspace I have a lot of changed files, but I also experimented with automating this with an python function. Unforenetly I can't remember which worked, so you could try the automated version. But if this dosn't work, expect to create hunders of %.bbappend files with the above mentioned extention.

    For the automated version I've did the following

Create the file classes/ros_nativesdk_pkg_fix.bbclass

GSETTINGS_PACKAGE ?= "${PN}"
ROS_NATIVESDK_PACKAGES = ""
python __anonymous() {
    pkg = d.getVar("GSETTINGS_PACKAGE")
    exports = d.getVar("ROS_EXPORT_DEPENDS") + " " + d.getVar("ROS_BUILDTOOL_EXPORT_DEPENDS")
    nativeLen = len("-native")
    for export in exports.split():
        totalLen = len(export)
        if totalLen <= nativeLen:
            continue
        if export[totalLen-nativeLen:] != "-native":
            continue
        packageName = export[:totalLen-nativeLen]
        if packageName in ["gtest", "chrpath-replacement", "spdlog", "spdlog-vendor"]:
            continue
        d.appendVar("ROS_NATIVESDK_PACKAGES", " "+packageName+" ")
}

RDEPENDS_${PN} += " ${ROS_NATIVESDK_PACKAGES} "
BBCLASSEXTEND = " nativesdk "

Added this file to meta-ros2/classes/ros_ament_python.bbclass and meta-ros2/classes/ros_ament_cmake.bbclass by inserting inherit ros_nativesdk_pkg_fix into these files. Unforenetly bbclass files can not be appended and hence the original files need to be changed.

I hope that I didn't forget anything and this will be usefull for you. Have fun and good luck ;)

best regards Tobias