diff mbox series

[meta-lts-mixins,kirkstone/rust,1/2] python3-awscrt: fix unsafe include path error during cross-compilation

Message ID 20250618132937.4119240-1-soumya.sambu@windriver.com
State New
Headers show
Series [meta-lts-mixins,kirkstone/rust,1/2] python3-awscrt: fix unsafe include path error during cross-compilation | expand

Commit Message

Sambu, Soumya June 18, 2025, 1:29 p.m. UTC
From: Soumya Sambu <soumya.sambu@windriver.com>

After meta-lts-mixins introduced a newer setuptools, python3-awscrt is failing
to build due to unsafe include path

cc1: error: include location "/usr/include/python3.10" is unsafe for cross-compilation [-Werror=poison-system-directories]

The issue is resolved by explicitly forcing setuptools to use distutils

Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
---
 conf/layer.conf                                                | 3 ++-
 .../iot-cloud/recipes-aws/python/python3-awscrt_%.bbappend     | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
 create mode 100644 dynamic-layers/iot-cloud/recipes-aws/python/python3-awscrt_%.bbappend

Comments

Scott Murray June 18, 2025, 3:36 p.m. UTC | #1
On Wed, 18 Jun 2025, Soumya via lists.yoctoproject.org wrote:

> From: Soumya Sambu <soumya.sambu@windriver.com>
>
> After meta-lts-mixins introduced a newer setuptools, python3-awscrt is failing
> to build due to unsafe include path
>
> cc1: error: include location "/usr/include/python3.10" is unsafe for cross-compilation [-Werror=poison-system-directories]
>
> The issue is resolved by explicitly forcing setuptools to use distutils

Can you elaborate a bit further, I can see that forcing the non-vendored
distutils (i.e. OE's copy) would have an effect, but if the default
setuptools behavior is broken with respect to leaking that include path,
I'd kind of expect wider spread breakage.  As well, things seem to be
working on scarthgap with python3-grpcio, and that's where the setuptools
backport is from...

Thanks,

Scott
Scott Murray July 23, 2025, 7:18 p.m. UTC | #2
On Wed, 18 Jun 2025, Soumya via lists.yoctoproject.org wrote:

> From: Soumya Sambu <soumya.sambu@windriver.com>
>
> After meta-lts-mixins introduced a newer setuptools, python3-awscrt is failing
> to build due to unsafe include path
>
> cc1: error: include location "/usr/include/python3.10" is unsafe for cross-compilation [-Werror=poison-system-directories]
>
> The issue is resolved by explicitly forcing setuptools to use distutils
>
> Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>

I tested building python3-awscrt and python-grpcio without these fixes,
and they built fine for me (iirc, even with Rust 1.85.1, but definitely
with the 1.86/1.87 updates I just posted).  Can you perhaps try to
reproduce the failures with them and python3-strict-rfc3339 again to see
if they still happen for you, and if so please provide specific setup
information for reproduction (i.e. build host and specific layers and
commits used)?  Also, please see my comments about the mozjs-* dynamic
layer bbappends in my kirkstone/rust update cover letter, they are
issues there that need investigation.

Thanks,

Scott


> ---
>  conf/layer.conf                                                | 3 ++-
>  .../iot-cloud/recipes-aws/python/python3-awscrt_%.bbappend     | 3 +++
>  2 files changed, 5 insertions(+), 1 deletion(-)
>  create mode 100644 dynamic-layers/iot-cloud/recipes-aws/python/python3-awscrt_%.bbappend
>
> diff --git a/conf/layer.conf b/conf/layer.conf
> index 4fe4ec4..280393d 100644
> --- a/conf/layer.conf
> +++ b/conf/layer.conf
> @@ -28,7 +28,8 @@ BBMASK:append = " meta/recipes-devtools/python/python3-setuptools-rust-native_%"
>
>  BBFILES_DYNAMIC += " \
>      meta-python:${LAYERDIR}/dynamic-layers/meta-python/recipes-*/*/*.bbappend \
> -    openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bbappend"
> +    openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bbappend \
> +    iot-cloud:${LAYERDIR}/dynamic-layers/iot-cloud/recipes-*/*/*.bbappend"
>
>  # These are in bitbake.conf in langdale and up, adding them here to make
>  # using the layer more turn-key seems reasonable.
> diff --git a/dynamic-layers/iot-cloud/recipes-aws/python/python3-awscrt_%.bbappend b/dynamic-layers/iot-cloud/recipes-aws/python/python3-awscrt_%.bbappend
> new file mode 100644
> index 0000000..bd0b910
> --- /dev/null
> +++ b/dynamic-layers/iot-cloud/recipes-aws/python/python3-awscrt_%.bbappend
> @@ -0,0 +1,3 @@
> +do_compile:prepend() {
> +    export SETUPTOOLS_USE_DISTUTILS=stdlib
> +}
>
Sambu, Soumya July 25, 2025, 12:29 p.m. UTC | #3
Thanks for the update — and apologies for missing your earlier message; I was occupied with other tasks.
Regarding the previous question, I suspect "restoring local distutils as default" caused the issue - https://github.com/pypa/setuptools/commit/b6fcbbd00cb6d5607c9272dec452a50457bdb292

I attempted to rebuild python3-grpcio, python3-awscrt, and python3-strict-rfc3339 using the following setup:

Layers:
poky: kirkstone [f4219fb3e291eaffbb475b91ad4a8c4772a9c7d3]
meta-openembedded: kirkstone [06fc0278f10d630838d703dde707bbf0e2999873]
meta-lts-mixins: kirkstone/rust [dcc60f3115a8133c4013ce36cb6fe0969c07d6f5]
meta-iot-cloud: kirkstone [e381dc2067c1500eb417bc1ce3009b3ff4125c69]

Host details:
OS: Ubuntu 22.04.2 LTS
Kernel: 5.15.0-122-generic

I'm still seeing the same build failures with python3-grpcio, python3-awscrt, and python3-strict-rfc3339 with above setup.

Let me know if any more details are needed.

I will also look into the mozjs comments and provide an update shortly.

Best regards,
Soumya
diff mbox series

Patch

diff --git a/conf/layer.conf b/conf/layer.conf
index 4fe4ec4..280393d 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -28,7 +28,8 @@  BBMASK:append = " meta/recipes-devtools/python/python3-setuptools-rust-native_%"
 
 BBFILES_DYNAMIC += " \
     meta-python:${LAYERDIR}/dynamic-layers/meta-python/recipes-*/*/*.bbappend \
-    openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bbappend"
+    openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bbappend \
+    iot-cloud:${LAYERDIR}/dynamic-layers/iot-cloud/recipes-*/*/*.bbappend"
 
 # These are in bitbake.conf in langdale and up, adding them here to make
 # using the layer more turn-key seems reasonable.
diff --git a/dynamic-layers/iot-cloud/recipes-aws/python/python3-awscrt_%.bbappend b/dynamic-layers/iot-cloud/recipes-aws/python/python3-awscrt_%.bbappend
new file mode 100644
index 0000000..bd0b910
--- /dev/null
+++ b/dynamic-layers/iot-cloud/recipes-aws/python/python3-awscrt_%.bbappend
@@ -0,0 +1,3 @@ 
+do_compile:prepend() {
+    export SETUPTOOLS_USE_DISTUTILS=stdlib
+}