-
Notifications
You must be signed in to change notification settings - Fork 254
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 Rolling #1203
base: master
Are you sure you want to change the base?
Conversation
The python nodes are not functional:
The file |
Hi @sgstreet
Could you please full build https://github.com/ros2/examples or https://github.com/ros2/demos with SDK env? |
Yes. I can build |
Hi @sgstreet
|
@@ -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}/opt/ros/${ROS_DISTRO};${STAGING_DIR_NATIVE}${ros_prefix};${STAGING_DIR_NATIVE}${prefix}' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ${ros_prefix} to replace opt/ros/${ROS_DISTRO}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I will test and feedback. Sorry for the delay, my attention has been distracted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change still allows the SDK to build and run, but I suspect it is not used in my case.
@@ -25,11 +25,13 @@ export AMENT_PREFIX_PATH="${STAGING_DIR_HOST}${prefix};${STAGING_DIR_NATIVE}${pr | |||
|
|||
inherit cmake python3native | |||
|
|||
PYTHONPATH:prepend:class-nativesdk = "${STAGING_DIR_NATIVE}/opt/ros/${ROS_DISTRO}/lib/python3.12/site-packages:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Use ${ros_prefix} to replace opt/ros/${ROS_DISTRO}
- Use ${PYTHON_BASEVERSION} instead of python3.12 is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I will test and feedback. Sorry for the delay, my attention has been distracted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 1. fails to build the SDK with the following error for the packages rosidl-typesupport-interface
, rosidl-cmake
, rcutils
and rosidl-generator-type-description
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_configure
| -- Found ament_cmake: 2.6.0 (/home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-cmake/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake/cmake)
| -- Found Python3: /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-cmake/4.7.0-1/recipe-sysroot-native/usr/bin/python3-native/python3 (found version "3.12.3") found components: Interpreter
| Traceback (most recent call last):
| File "/home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-cmake/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py", line 21, in <module>
| from ament_package.templates import get_environment_hook_template_path
| ModuleNotFoundError: No module named 'ament_package'
| CMake Error at /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-cmake/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
|
| execute_process(/home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-cmake/4.7.0-1/recipe-sysroot-native/usr/bin/python3-native/python3
| /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-cmake/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
| /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-cmake/4.7.0-1/build/ament_cmake_package_templates/templates.cmake)
| returned error code 1
| Call Stack (most recent call first):
| /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-cmake/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:41 (include)
| /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-cmake/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:15 (find_package)
| /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-cmake/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake/cmake/ament_cmakeConfig.cmake:41 (include)
| CMakeLists.txt:5 (find_package)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a corollary, remove ${STAGING_DIR_NATIVE}/opt/ros/${ROS_DISTRO}
from EXTRA_OECMAKE:prepend:class-nativesdk -D-DCMAKE_PREFIX_PATH
line results in similar errors:
| CMake Error at CMakeLists.txt:5 (find_package):
| By not providing "Findament_cmake.cmake" in CMAKE_MODULE_PATH this project
| has asked CMake to find a package configuration file provided by
| "ament_cmake", but CMake did not find one.
|
| Could not find a package configuration file provided by "ament_cmake" with
| any of the following names:
|
| ament_cmakeConfig.cmake
| ament_cmake-config.cmake
|
| Add the installation prefix of "ament_cmake" to CMAKE_PREFIX_PATH or set
| "ament_cmake_DIR" to a directory containing one of the above files. If
| "ament_cmake" provides a separate development package or SDK, be sure it
| has been installed.
for rosidl/rosidl-typesupport-interface
and rosidl-cmake
while the following error generated for rcutils
:
| CMake Error at CMakeLists.txt:16 (find_package):
| By not providing "Findament_cmake_python.cmake" in CMAKE_MODULE_PATH this
| project has asked CMake to find a package configuration file provided by
| "ament_cmake_python", but CMake did not find one.
|
| Could not find a package configuration file provided by
| "ament_cmake_python" with any of the following names:
|
| ament_cmake_pythonConfig.cmake
| ament_cmake_python-config.cmake
|
| Add the installation prefix of "ament_cmake_python" to CMAKE_PREFIX_PATH or
| set "ament_cmake_python_DIR" to a directory containing one of the above
| files. If "ament_cmake_python" provides a separate development package or
| SDK, be sure it has been installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The appear to be a problem with the ${ros_prefix} value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 2. generates the variation of the following error for packages rosidl-typesupport-interface
, rosidl-cmake
, rcutils
, rosidl-parser
and rosidl-generator-type-description
:
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_configure
| -- Found ament_cmake: 2.6.0 (/home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake/cmake)
| -- Found Python3: /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/usr/bin/python3-native/python3 (found version "3.12.3") found components: Interpreter
| Traceback (most recent call last):
| File "/home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py", line 21, in <module>
| from ament_package.templates import get_environment_hook_template_path
| ModuleNotFoundError: No module named 'ament_package'
| CMake Error at /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
|
| execute_process(/home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/usr/bin/python3-native/python3
| /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
| /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/build/ament_cmake_package_templates/templates.cmake)
| returned error code 1
| Call Stack (most recent call first):
| /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:41 (include)
| /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:15 (find_package)
| /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/opt/ros/rolling/share/ament_cmake/cmake/ament_cmakeConfig.cmake:41 (include)
| CMakeLists.txt:5 (find_package)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Investigating value of '${ros_prefix}' for the native-sdk
$ bitbake-getvar -r nativesdk-rosidl-typesupport-interface --value ros_prefix
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/opt/ros/rolling
while for the target:
$ bitbake-getvar -r rosidl-typesupport-interface --value ros_prefix
/opt/ros/rolling
These values are prefixed with STAGING_DIR_NATIVE
bitbake-getvar -r rosidl-typesupport-interface --value STAGING_DIR_NATIVE
/home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/cortexa76-oe-linux/rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native
The actual value being used is /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/opt/ros/rolling
which is not present in the build path for the package
ls -al /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native//usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/opt/ros/rolling
ls: cannot access '/home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native//usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/opt/ros/rolling': No such file or directory
while the path /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/cortexa76-oe-linux/rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native//opt/ros/rolling
is present:
$ ls -al /home/stephen/Workspace/yocto/pi5/build/tmp-glibc/work/cortexa76-oe-linux/rosidl-typesupport-interface/4.7.0-1/recipe-sysroot-native/opt/ros/rolling
total 16
drwxr-xr-x 4 stephen stephen 4096 Aug 27 09:46 .
drwxr-xr-x 3 stephen stephen 4096 Aug 27 09:46 ..
drwxr-xr-x 3 stephen stephen 4096 Aug 27 09:46 lib
drwxr-xr-x 20 stephen stephen 4096 Aug 27 09:46 share
My interpretation is that '${ros_prefix}' is incorrect for the building the nativesdk recipes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Search meta-ros for ros_prefix
yields the following definition in meta-ros-common/classes/ros_opt_prefix.bbclass
:
ros_prefix ?= "${base_prefix}/opt/ros/${ROS_DISTRO}"
I did not find (could be wrong here) any other prior definitions of ros_prefix
so base_prefix
must be the governing variable. I found base_prefix
in openembedded-core/meta/classes-recipe/nativesdk.bbclass
:
base_prefix = "${SDKPATHNATIVE}"
Tracking SDKPATHNATIVE
to openembedded-core/meta/conf/bitbake.conf
the definition is
SDK_SYS = "${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}"
SDKPATH = "/usr/local/oe-sdk-hardcoded-buildpath"
SDKPATHNATIVE = "${SDKPATH}/sysroots/${SDK_SYS}"
Which starts to make sense in explaining the observed behavior. I think that the current value of ros_prefix
is wrong for building the SDK. Unfortunately I'm not sure the correct way to fix this would be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your details. I didn't realize the prefix_xx are changed in nativesdk.bbclass.
base_prefix = "${SDKPATHNATIVE}"
prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
My intention is to use the variables defined in ros_opt_prefix.bbclass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems right, may be we need to add an variable with it's default value as /opt/ros/${ROS_DISTRO}
. This would allow the some flexibility when constructing paths for the nativesdk.
@jiaxshi Still hacking on the shebang path. |
python executor can be found after changing shebang path. And one more thing, if you build python-library, you should add PYTHON_SOABI to rename library which is named with "x86".
You can refer to #1204 for details. |
@jiaxshi here is the contents of my talker executor (are these correct words?)
As you pointed out the shebang is clearly wrong. Can you point out the code which generates this |
I tried this, how should I verify the impact? Further, for none python ROS2 packages the following warnings are generated:
which is harmless but annoying. I think we need another place to add the |
I think the shebang path is added by native python interpreter.
The warning is because is not used by none-python packages. If there's way to add the default value to native interpreter is better. |
Or maybe superflores could add during recipe generation. |
I patched colcon build to generate a better/correct shebang for python packages builds. See 5965ca6 |
Signed-off-by: Stephen Street <[email protected]>
Signed-off-by: Stephen Street <[email protected]>
…ions Signed-off-by: Stephen Street <[email protected]>
Signed-off-by: Stephen Street <[email protected]>
Signed-off-by: Stephen Street <[email protected]>
Signed-off-by: Stephen Street <[email protected]>
Hi @sgstreet
Talker executor is running on target(e.g. RPI-4 board) device, the path python3 executor is /usr/bin/python3 not /home/stephen/Workspace/ros2-dev/sdk/sysroots/x86_64-oesdk-linux/usr/bin/python3 which is your HOST python3 executor of SDK.
without HOST path prefix(/home/stephen/Workspace/ros2-dev/sdk/sysroots/x86_64-oesdk-linux) included. |
@jiaxshi Sorry for the confusing and incomplete post. Building python nodes with 5965ca results in the following talker code:
Which has the correct SHEBANG line. |
5965ca6
to
6c93749
Compare
Joy, cpp and python code rolling [email protected] and [email protected] are functional against origin/scarthgap-next using oe scarthgap release on a raspberry pi 5. |
@robwoolley @jiaxshi This is almost ready to go, what are the next steps for getting this pull request merged? Jazzy, Humble? What about Kirkstone, master, Scarthgap? What addition changes are needed? |
That's cool. To merge the PR, my opinion is that we should test on other ROS2 distros (Humble, Jazzy, Iron, Rolling) and then propagate to the other branch (Kirkstone). And one more topic is image recipe: |
I will work on this over the next couple of days, I suspect that Humble and Jazzy will need some specific patches for fastrtp and tinyxml. I was planning to ignore Iron as it will EOL in November. @robwoolley Thoughts? |
This PR tries to resurrect PR #988 for Rolling to enable OpenEmbedded SDK cross-compilation. These changes allow demos, examples and examples_interfaces packages to be built using the resulting SDK. To build the SDK use:
Install the resulting SDK, setup a ROS2 workspace containing demos, examples and example_interfaces and build the workspace using the follow script:
Install the $PWD/install/arm64 on the target device. Setup the device workspace:
Run any of the rclcpp examples to demonstrate the valid cross-compilation.