Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable SDK for ROS2 on Scarthgap #1241

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4325055
{common} Add native sdk class extentions
sgstreet Jul 23, 2024
81a4ec2
{rolling} Patch fastrtps to use find TinyXML2
sgstreet Aug 12, 2024
ac43ef9
{common}{ros2} Ensure EXTRA_OECMAKE overrides correctly handle multip…
sgstreet Aug 12, 2024
4394b6e
{common} Add ros2 sdktest
sgstreet Aug 12, 2024
f520b99
{ros2} Use yocto PYTHON_BASEVERSION variable to build PYTHONPATH
sgstreet Aug 28, 2024
f247193
{common} Make colcon python package builds use correct shebang for me…
sgstreet Oct 2, 2024
ba938c6
{jazzy} Add Find TinyXML2 patch
sgstreet Oct 22, 2024
ffd16bc
{humble} Add Find TinyXML2 patch
sgstreet Oct 22, 2024
09a8170
{common} Move SDK variables to ros2 releases
sgstreet Oct 23, 2024
89b3be1
{rolling} Move SDK variables to ros2 releases
sgstreet Oct 23, 2024
ed14b53
{jazzy} Move SDK variables to ros2 releases
sgstreet Oct 23, 2024
ce8b3c1
{humble} Move SDK variables to ros2 releases
sgstreet Oct 23, 2024
30aa939
{humble} Use find package for yaml to prevent sdk build failures
sgstreet Nov 5, 2024
d2cd3da
{infrastructure} Stop chatter about newline in package descriptions
sgstreet Nov 5, 2024
8eaaf43
Do not leak build directoy path into the sdk
sgstreet Nov 5, 2024
15d5b61
{common,humble,jazzy,rolling} Cleanup SDK configuration for ros-core …
sgstreet Nov 5, 2024
a55d4f8
{common} Remove duplicate path
sgstreet Nov 6, 2024
51c47ec
{common} Adjust PCL patches to not use OECORE_TARGET_SYSROOT variable
sgstreet Nov 6, 2024
f60c234
{common,ros2} Allow alternative ROS install paths
sgstreet Nov 11, 2024
5efc734
{rolling,jazzy,humble,ros2} Add ROS environment variables to SDK
sgstreet Nov 18, 2024
9c32b48
Remove duplicate and empty values
sgstreet Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion meta-ros-common/classes/ros_cmake.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

inherit cmake

EXTRA_OECMAKE:prepend = "\
EXTRA_OECMAKE:prepend:class-target = "\
-DCMAKE_PREFIX_PATH='${STAGING_DIR_HOST}${ros_prefix};${STAGING_DIR_HOST}${prefix}' \
-DCMAKE_INSTALL_PREFIX:PATH='${ros_prefix}' \
-DCMAKE_MODULE_PATH='${STAGING_DIR_HOST}${ros_datadir}/cmake/Modules/' \
Expand All @@ -13,3 +13,8 @@ EXTRA_OECMAKE:prepend:class-native = "\
-DCMAKE_PREFIX_PATH='${STAGING_DIR_NATIVE}${ros_prefix};${STAGING_DIR_NATIVE}${prefix}' \
-DCMAKE_INSTALL_PREFIX:PATH='${ros_prefix}' \
"

EXTRA_OECMAKE:prepend:class-nativesdk = "\
-DCMAKE_PREFIX_PATH='${STAGING_DIR_NATIVE}${ros_prefix};${STAGING_DIR_NATIVE}${prefix}' \
-DCMAKE_INSTALL_PREFIX:PATH='${ros_prefix}' \
"
3 changes: 2 additions & 1 deletion meta-ros-common/classes/ros_opt_prefix.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved
#

ros_prefix ?= "${base_prefix}/opt/ros/${ROS_DISTRO}"
ros_base_prefix ?= "/opt/ros/${ROS_DISTRO}"
ros_prefix = "${base_prefix}${ros_base_prefix}"

ros_bindir = "${ros_prefix}/bin"
ros_sbindir = "${ros_prefix}/sbin"
Expand Down
33 changes: 33 additions & 0 deletions meta-ros-common/recipes-core/images/ros2-image-sdktest.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
SUMMARY = "ROS2 SDK Image"
DESCRIPTION = "${SUMMARY}"

inherit core-image
inherit ros_distro_${ROS_DISTRO}
inherit ${ROS_DISTRO_TYPE}_image

IMAGE_INSTALL:append = " \
packagegroup-core-boot \
${CORE_IMAGE_EXTRA_INSTALL} \
"

TOOLCHAIN_TARGET_TASK:append = " \
opencv-staticdev \
python3-numpy-staticdev \
libeigen \
eigen3-cmake-module \
boost \
libstdc++-staticdev \
pcl-dev \
python3-pykdl \
bullet \
qhull-staticdev \
orocos-kdl \
yaml-cpp-vendor \
pybind11-vendor \
rttest \
tlsf-staticdev \
tlsf-cpp \
python-cmake-module \
python3-opencv \
tinyxml-vendor \
"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/colcon_core/task/python/build.py b/colcon_core/task/python/build.py
index 7181d20..eb82058 100644
--- a/colcon_core/task/python/build.py
+++ b/colcon_core/task/python/build.py
@@ -73,7 +73,7 @@ class PythonBuildTask(TaskExtensionPoint):
os.path.realpath(args.build_base),
os.path.realpath(args.path)),
'build', '--build-base', os.path.join(
- args.build_base, 'build'),
+ args.build_base, 'build'), '--executable', '/usr/bin/env python3',
'install', '--prefix', args.install_base,
'--record', os.path.join(args.build_base, 'install.log'),
# prevent installation of dependencies specified in setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://setup.cfg;beginline=22;endline=22;md5=3d0bd1ac53c1dd5

SRC_URI += "file://0001-Remove-optional-pytest-dependencies.patch \
file://0002-Fix-regression-when-enitre-workspace-is-symlinked.patch \
file://0003-Force-shebang-to-usr-bin-env-python3.patch \
"
SRC_URI[sha256sum] = "fc14534b2ce745fcc332afc0bb0ddf3e45d5d69c15da15b9471cfb7b0b9edbe9"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BBCLASSEXTEND += "nativesdk"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BBCLASSEXTEND += "nativesdk"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BBCLASSEXTEND += "nativesdk"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BBCLASSEXTEND += "nativesdk"
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
require python-lark-parser.inc

inherit setuptools3

BBCLASSEXTEND = "native nativesdk"
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From 4dc28976e88af60e273e670f824cf9b30281e86d Mon Sep 17 00:00:00 2001
From: Stephen Street <[email protected]>
Date: Tue, 5 Nov 2024 09:04:23 -0800
Subject: [PATCH] Do not leak build directory paths in sdk

Signed-off-by: Stephen Street <[email protected]>
---
PCLConfig.cmake.in | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in
index 1e923a3e9..4a8a3a35e 100644
--- a/PCLConfig.cmake.in
+++ b/PCLConfig.cmake.in
@@ -23,6 +23,7 @@ if(POLICY CMP0074)
# NEW behavior, we need to push a policy stack.
cmake_policy(SET CMP0074 NEW)
endif()
+cmake_policy(SET CMP0144 NEW)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Modules")

@@ -91,9 +92,9 @@ macro(find_boost)
if(PCL_ALL_IN_ONE_INSTALLER)
set(BOOST_ROOT "${PCL_ROOT}/3rdParty/Boost")
elseif(NOT BOOST_INCLUDEDIR)
- set(BOOST_INCLUDEDIR "@Boost_INCLUDE_DIR@")
+ set(BOOST_INCLUDEDIR "/usr/include")
endif()
-
+
set(Boost_ADDITIONAL_VERSIONS
"@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@.@Boost_SUBMINOR_VERSION@" "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@"
"1.84.0" "1.84" "1.83.0" "1.83" "1.82.0" "1.82" "1.81.0" "1.81" "1.80.0" "1.80"
@@ -117,7 +118,7 @@ macro(find_eigen)
if(PCL_ALL_IN_ONE_INSTALLER)
set(EIGEN_ROOT "${PCL_ROOT}/3rdParty/Eigen")
elseif(NOT EIGEN_ROOT)
- get_filename_component(EIGEN_ROOT "@EIGEN_INCLUDE_DIRS@" ABSOLUTE)
+ get_filename_component(EIGEN_ROOT "/usr/include/eigen3" ABSOLUTE)
endif()
find_package(Eigen 3.1)
endmacro()
@@ -225,7 +226,7 @@ macro(find_flann)
if(PCL_ALL_IN_ONE_INSTALLER)
set(FLANN_ROOT "${PCL_ROOT}/3rdParty/Flann")
elseif(NOT FLANN_ROOT)
- set(FLANN_ROOT "@FLANN_ROOT@")
+ set(FLANN_ROOT "/usr")
endif()

set(PCL_FLANN_REQUIRED_TYPE @PCL_FLANN_REQUIRED_TYPE@)
--
2.43.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From 15cfff0eb7fb7ca58550f6259f0935ca7710a6b4 Mon Sep 17 00:00:00 2001
From: Stephen Street <[email protected]>
Date: Tue, 5 Nov 2024 08:47:17 -0800
Subject: [PATCH] Do not leak build directory paths in sdk

Signed-off-by: Stephen Street <[email protected]>
---
PCLConfig.cmake.in | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in
index b6322c623..b7e290c23 100644
--- a/PCLConfig.cmake.in
+++ b/PCLConfig.cmake.in
@@ -23,6 +23,7 @@ if(POLICY CMP0074)
# NEW behavior, we need to push a policy stack.
cmake_policy(SET CMP0074 NEW)
endif()
+cmake_policy(SET CMP0144 NEW)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Modules")

@@ -91,9 +92,9 @@ macro(find_boost)
if(PCL_ALL_IN_ONE_INSTALLER)
set(BOOST_ROOT "${PCL_ROOT}/3rdParty/Boost")
elseif(NOT BOOST_INCLUDEDIR)
- set(BOOST_INCLUDEDIR "@Boost_INCLUDE_DIR@")
+ set(BOOST_INCLUDEDIR "/usr/include")
endif()
-
+
set(Boost_ADDITIONAL_VERSIONS
"@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@.@Boost_SUBMINOR_VERSION@" "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@"
"1.84.0" "1.84" "1.83.0" "1.83" "1.82.0" "1.82" "1.81.0" "1.81" "1.80.0" "1.80"
@@ -117,7 +118,7 @@ macro(find_eigen)
if(PCL_ALL_IN_ONE_INSTALLER)
set(EIGEN_ROOT "${PCL_ROOT}/3rdParty/Eigen")
elseif(NOT EIGEN_ROOT)
- get_filename_component(EIGEN_ROOT "@EIGEN_INCLUDE_DIRS@" ABSOLUTE)
+ get_filename_component(EIGEN_ROOT "/usr/include/eigen3" ABSOLUTE)
endif()
find_package(Eigen 3.3)
endmacro()
@@ -225,7 +226,7 @@ macro(find_flann)
if(PCL_ALL_IN_ONE_INSTALLER)
set(FLANN_ROOT "${PCL_ROOT}/3rdParty/Flann")
elseif(NOT FLANN_ROOT)
- set(FLANN_ROOT "@FLANN_ROOT@")
+ set(FLANN_ROOT "/usr")
endif()

set(PCL_FLANN_REQUIRED_TYPE @PCL_FLANN_REQUIRED_TYPE@)
--
2.43.0

1 change: 1 addition & 0 deletions meta-ros-common/recipes-extended/pcl/pcl_1.12.1.bb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require pcl.inc

SRC_URI += "file://0001-Make-PCL-compatible-with-Boost-1.84-1.12.1.patch"
SRC_URI += "file://0002-Do-not-leak-build-directory-paths-1.12.1.patch"

PV = "1.12.1+git${SRCPV}"
SRCREV = "e8ed4be802f7d0b1acff2f8b01d7c5f381190e05"
1 change: 1 addition & 0 deletions meta-ros-common/recipes-extended/pcl/pcl_1.13.0.bb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require pcl.inc

SRC_URI += "file://0001-Make-PCL-compatible-with-Boost-1.84-1.13.0.patch"
SRC_URI += "file://0002-Do-not-leak-build-directory-paths-1.13.0.patch"

PV = "1.13.0+git${SRCPV}"
SRCREV = "371a8e1373f7b2f66bbb92291be2f3e50dc19856"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/src/catkin_pkg/package.py b/src/catkin_pkg/package.py
index da2b1b8..e2c8f2d 100644
--- a/src/catkin_pkg/package.py
+++ b/src/catkin_pkg/package.py
@@ -253,9 +253,6 @@ class Package(object):

if not self.description:
errors.append('Package description must not be empty')
- else:
- if '\n' in self.description:
- new_warnings.append('Package "%s" has newlines in the description')

if not self.maintainers:
errors.append("Package '{0}' must declare at least one maintainer".format(self.name))
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require python-catkin-pkg.inc

SRC_URI += "file://0001-python_setup.py-fix-build-with-setuptools-v59.0.0-an.patch"
SRC_URI += "file://0002-package-py-remove-newline-in-description-warning.patch"

inherit setuptools3
2 changes: 1 addition & 1 deletion meta-ros-common/recipes-support/asio/asio_%.bbappend
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) 2019-2020 LG Electronics, Inc.

BBCLASSEXTEND = "native"
BBCLASSEXTEND = "native nativesdk"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BBCLASSEXTEND += "nativesdk"
1 change: 1 addition & 0 deletions meta-ros2-humble/conf/layer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ LAYERDEPENDS_ros2-humble-layer = " \
LAYERSERIES_COMPAT_ros2-humble-layer = "scarthgap"

require conf/ros-distro/include/humble/ros-distro.inc
require conf/ros-distro/include/humble/ros-sdk.inc
62 changes: 62 additions & 0 deletions meta-ros2-humble/conf/ros-distro/include/humble/ros-sdk.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
TOOLCHAIN_HOST_TASK:append = " \
nativesdk-ament-package \
nativesdk-python3-colcon-common-extensions \
nativesdk-python3-numpy \
nativesdk-rosidl-adapter \
nativesdk-rosidl-cli \
nativesdk-rosidl-cmake \
nativesdk-rosidl-default-generators \
nativesdk-rosidl-generator-c \
nativesdk-rosidl-generator-cpp \
nativesdk-rosidl-parser \
nativesdk-rosidl-typesupport-c \
nativesdk-rosidl-typesupport-cpp \
nativesdk-rosidl-typesupport-fastrtps-c \
nativesdk-rosidl-typesupport-fastrtps-cpp \
nativesdk-rosidl-typesupport-introspection-c \
nativesdk-rosidl-typesupport-introspection-cpp \
nativesdk-ros-sdk-env \
"

TOOLCHAIN_TARGET_TASK:append = " \
ament-cmake-python \
ament-cmake-ros \
ament-package \
ament-lint \
ament-cmake \
ament-cmake-auto \
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-gen-version-h \
ament-cmake-gmock \
ament-cmake-gtest \
ament-cmake-include-directories \
ament-cmake-libraries \
ament-cmake-pytest \
ament-cmake-python \
ament-cmake-target-dependencies \
ament-cmake-test \
ament-cmake-vendor-package \
ament-cmake-version \
foonathan-memory-staticdev \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list is incomplete. At the very minimum we need python-cmake-module, possibly others as well. At the moment I'm using the "kitchen sink" task list from previous versions of this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice that python-cmake-module is present in the target sysroot, which is why this might work.

One challenge that we have is in defining which packages are "host" dependencies and which are "target" dependencies. I need to do an audit of this, because I'm pretty sure that I have made this mistake when adding ROS_BUILD_DEPENDS and ROS_EXEC_DEPENDS in the various bbappends files to satisfy the builds.

The tricky party is that if you intend to do target-side builds then ament-cmake-* should be in the target list. However, for an SDK it probably should be only present in the host. I think if you are building an SDK for an image that supports target-side builds, then it should probably exist in both and the PYTHONPATH should be ordered to grab the host module first. (AFAIK)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to trim this down the the bare minimum. I think the correct approach is packagegroups for the SDK functionality. Which should be up next.

\
rclcpp \
rclcpp-lifecycle \
rclcpp-action \
rclcpp-components \
builtin-interfaces \
common-interfaces \
fastrtps-cmake-module \
rosidl-default-generators \
rosidl-generator-c \
rosidl-generator-cpp \
rosidl-cmake \
ros-workspace \
pluginlib \
"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/cmake/modules/FindTinyXML2.cmake b/cmake/modules/FindTinyXML2.cmake
index 44b8e645..ba964578 100644
--- a/cmake/modules/FindTinyXML2.cmake
+++ b/cmake/modules/FindTinyXML2.cmake
@@ -39,7 +39,10 @@ else()
if(TINYXML2_FROM_SOURCE)
find_path(TINYXML2_SOURCE_DIR NAMES tinyxml2.cpp NO_CMAKE_FIND_ROOT_PATH)
else()
- find_library(TINYXML2_LIBRARY tinyxml2)
+ find_library(TINYXML2_LIBRARIES tinyxml2)
+ add_library(tinyxml2 SHARED IMPORTED)
+ set_property(TARGET tinyxml2 APPEND PROPERTY IMPORTED_LOCATION "${TINYXML2_LIBRARIES}")
+ set(TINYXML2_LIBRARY tinyxml2)
endif()

include(FindPackageHandleStandardArgs)
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Copyright (c) 2019-2021 LG Electronics, Inc.
# Copyright (c) 2023 Wind River Systems, Inc.

inherit ros_insane_dev_so

FILES:${PN} += "${prefix}/tools"
# ERROR: fastrtps-2.10.2-1-r0 do_package: QA Issue: fastrtps: Files/directories were installed but not shipped in any package:
FILES:${PN} += "${datadir}/fastRTPS_profiles.xsd ${datadir}/fastdds_static_discovery.xsd"

# CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the
# following cache variables appropriately:
Expand All @@ -19,3 +22,6 @@ EXTRA_OECMAKE += " -DSM_RUN_RESULT=0 -DSM_RUN_RESULT__TRYRUN_OUTPUT=PTHREAD_RWLO
sysroot_stage_all:append() {
sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir}
}

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-FindTinyXML2.cmake-fix-find_library-libtinyxml2.patch"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 96ef1b3e..b7487bf6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,7 @@ find_package(ament_cmake_ros REQUIRED)
find_package(rcutils REQUIRED)
find_package(rmw REQUIRED)
find_package(libyaml_vendor REQUIRED)
+find_package(yaml)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
Loading