DRAFT ament.bbclass: Fix PYTHON_SOABI

* Make it conditional on the configured MACHINE. Otherwise needs to be
    reworked to avoid getting the SOABI from python3-native.

  * See:
    4b6bb78633
    https://github.com/ros2/rosidl_python/blob/master/python_cmake_module/cmake/Modules/FindPythonExtra.cmake
    https://discourse.ros.org/t/import-error-no-module-named-rclpy-rclpy-cross-compiling/2463/

  * With the patch ros2 cli works well for all listed MACHINE(s):

    root@qemuarm64:~# ros2 topic list
    /parameter_events
    /rosout

     root@qemuarm64:~# ros2 topic pub /chatter std_msgs/String "data: Hello world"
     publisher: beginning loop
     publishing #1: std_msgs.msg.String(data='Hello world')

     publishing #2: std_msgs.msg.String(data='Hello world')

     ...

     root@qemuarm64:~# ros2 topic echo /chatter
     data: Hello world

     data: Hello world

     ...
This commit is contained in:
Andre Rosa 2019-04-05 19:15:04 -07:00 committed by Herb Kuta
parent ed9f19161e
commit 192d384233
1 changed files with 15 additions and 1 deletions

View File

@ -1,5 +1,19 @@
EXTRA_OECMAKE_append = " -DBUILD_TESTING=OFF -DPYTHON_SOABI=cpython-35m-${TUNE_ARCH}-${TARGET_OS}${ARMPKGSFX_EABI}" def ament__get_python_soabi(d):
machine = d.getVar('MACHINE', True)
pysoabi_prefix = 'cpython-' + d.getVar('PYTHON_BASEVERSION', True).replace('.', '') + d.getVar('PYTHON_ABI', True)
machine_pysoabi_map = {
'qemux86': (d.getVar('QB_SYSTEM_NAME_x86', True) or '').rsplit('-')[-1] + '-${TARGET_OS}-gnu',
'qemux86-64': (d.getVar('QB_SYSTEM_NAME_x86-64', True) or '').rsplit('-')[-1] + '-${TARGET_OS}-gnu',
'qemuarm64': '${TUNE_ARCH}-${TARGET_OS}${ARMPKGSFX_EABI}-gnu',
'raspberrypi3': '${TUNE_ARCH}-${TARGET_OS}${ARMPKGSFX_EABI}',
}
try:
return pysoabi_prefix + '-' + machine_pysoabi_map[machine]
except KeyError:
bb.fatal('Unknown MACHINE name: ' + machine + '; can not determine the PYTHON_SOABI value.')
EXTRA_OECMAKE_append = " -DBUILD_TESTING=OFF -DPYTHON_SOABI=${@ament__get_python_soabi(d)}"
# XXX Without STAGING_DIR_HOST path included, rmw-implementation:do_configure() fails with: # XXX Without STAGING_DIR_HOST path included, rmw-implementation:do_configure() fails with:
# #
# "Could not find ROS middleware implementation 'NOTFOUND'" # "Could not find ROS middleware implementation 'NOTFOUND'"