-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fail if we try to crosscompile while PYTHON_SOABI is not set. #12
base: rolling
Are you sure you want to change the base?
Fail if we try to crosscompile while PYTHON_SOABI is not set. #12
Conversation
Signed-off-by: Alexis Paques <[email protected]>
include(cmake/Modules/CheckCrossCompilingSoabi.cmake) | ||
CheckCrossCompilingSoabi() |
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.
Fail early instead of on usage of this library (which is after compiling the rmw middleware).
…rom the CMakelists.txt of this package. Signed-off-by: Alexis Paques <[email protected]>
355300f
to
25839ff
Compare
Signed-off-by: Alexis Paques <[email protected]>
…n crosscompiling to allow Python version upgrades. Signed-off-by: Alexis Paques <[email protected]>
a5294be
to
b1862e2
Compare
if(DEFINED CMAKE_SYSROOT) | ||
set(PYTHON_MODULE_EXTENSION ${PythonExtra_EXTENSION_SUFFIX}${PythonExtra_EXTENSION_EXTENSION}) | ||
endif() |
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.
If we are cross-compiling, we need to bypass the PYTHON_MODULE_EXTENSION definition done by pybind11 too, or this fix will not have effect on libraries using pybind11 directly (aka rclpy).
[NOTE: This would be a workaround until python_cmake_module#7, which I couldn't make work locally]
When cross-compiling, we need the PYTHON_SOABI variable to be set.
The current method was using the system python interpreter instead of the target one, causing incorrect variable naming as in: #9 and ros2/pybind11_vendor#16
The current methodology is to provide to people cross-compiling with a sysroot (found using CMAKE_SYSROOT) with an user friendly error message to explain which variable should be set. (PYTHON_SOABI)
The possibly better way would be to execute the target python version with qemu-${ARCH}-static. This means we need to find the arch, check for qemu for this arch, find Python within the sysroot and execute it.
One argument against it is often a the DevOps creating the sysroot will have qemu, but it is not systematic for the developer side, thus creating possibly a "it works on my machine" clash against the DevOps.
Another consideration is, as we are using a sysroot, the python version will likely be fixed;
Sample output: