From: Rob Woolley <rob.woolley@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Cc: Rob Woolley <rob.woolley@windriver.com>, <alex.kanavin@gmail.com>
Subject: [PATCH v2 0/3] boost: Add Boost.Python NumPy
Date: Wed, 12 Aug 2026 13:34:30 -0700 [thread overview]
Message-ID: <20260812-fix-boost-v2-0-cbcb65f5e186@windriver.com> (raw)
UPDATE[v2]: I replaced the python-numpy-native trigger with a Boost b2
feature that skips the probing for NumPy if the numpy module's
include directory is supplied.
This was necessary as NumPy has a C extension which can't be safely
imported when cross-compiling.
----
The recipe for Boost does not support building Boost.Python NumPy.
There is a mistake in the variables supplied to test for numpy. A new
PACKAGECONFIG option is also provided to allow it to be optionally
enabled.
Below are the commit messages with additional debug information:
boost: Use python3-native executable
The Boost build system executes Python in the compile task to
import the Numpy module and print the include directory.
We must specify the python3-native executable in the user-config.jam
so that the python.jam can execute it properly.
Without this change, it specifies a non-existant python executable
and reports "No such file or directory" in log.do_compile.
```
$ grep -C4 "running" temp/log.do_compile
notice: [python-cfg] interpreter command: "/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master-poky-with-sstate-distro_poky-machine_qemuarm64/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/bin/python3"
notice: [python-cfg] include path: "/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master-poky-with-sstate-distro_poky-machine_qemuarm64/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/include/python3.14"
notice: [python-cfg] library path: "/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master-poky-with-sstate-distro_poky-machine_qemuarm64/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/lib/python3.14"
notice: [python-cfg] Checking for NumPy...
notice: [python-cfg] running command '/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master-poky-with-sstate-distro_poky-machine_qemuarm64/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/bin/python3 -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"'
sh: line 1: /ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master-poky-with-sstate-distro_poky-machine_qemuarm64/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/bin/python3: No such file or directory
notice: [python-cfg] NumPy disabled. Reason:
notice: [python-cfg] /ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master-poky-with-sstate-distro_poky-machine_qemuarm64/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/bin/python3 -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())" aborted with
notice: [python-cfg]
```
boost-build-native: Add python-numpy-include feature
The Boost python.jam file attempts to import the NumPy module to determine
whether the Boost.Python NumPy extension should be enabled. This approach
is problematic when cross-compiling, particularly when NumPy includes
native extensions built for the target architecture.
Introduce the new python-numpy-include feature to avoid probing for NumPy
at build time by allowing the include path to be specified explicitly.
This enables BitBake to provide the correct NumPy include directory from
the recipe sysroot, eliminating the need to import the target NumPy
module from site-packages.
boost: Add support for Boost.Python NumPy extension
Support for NumPy was added to Boost release 1.63.
This additional numpy PACKAGECONFIG ensures that python3-numpy
is added as build-time and run-time dependencies. It uses the
custom-made python-numpy-include feature to supply the directory
for the numpy module headers to the b2 build system.
If numpy is not added the PACKAGECONFIG it will still attempt the
probe and fail gracefully like before.
With this support in place we may add a PACKAGECONFIG to enable numpy.
Shown here in conf/local.conf:
```
PACKAGECONFIG:append:pn-boost = " numpy"
```
$ grep python-cfg -A10 log.do_compile
notice: [python-cfg] Configuring python...
notice: [python-cfg] user-specified version: "3.14"
notice: [python-cfg] user-specified cmd-or-prefix: "/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot-native/usr/bin/python3-native/python3"
notice: [python-cfg] user-specified includes: "/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/include/python3.14"
notice: [python-cfg] user-specified libraries: "/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/lib/python3.14"
notice: [python-cfg] user-specified condition: "<python-numpy-include>/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/lib/python3.14/site-packages/numpy/_core/include"
notice: [python-cfg] Details of this Python configuration:
notice: [python-cfg] interpreter command: "/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot-native/usr/bin/python3-native/python3"
notice: [python-cfg] include path: "/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/include/python3.14"
notice: [python-cfg] library path: "/ala-lpggp31/rwoolley/boost-fix/bitbake-builds/poky-master/build/tmp/work/cortexa57-poky-linux/boost/1.91.0/recipe-sysroot/usr/lib/python3.14"
notice: [python-cfg] Checking for NumPy...
notice: [python-cfg] NumPy enabled
notice: Searching '.' for project-config configuration file 'project-config.jam'.
notice: Loading project-config configuration file 'project-config.jam' from '.'.
Performing configuration checks
- default address-model : 64-bit [1]
- default architecture : arm [1]
Building the Boost C++ Libraries.
$ find image \( -name libboost_py* -o -name libboost_nu* \) | xargs ls -al
-rw-r--r-- 3 rwoolley users 3262 Aug 12 13:16 image/usr/lib/cmake/boost_numpy-1.91.0/libboost_numpy-variant-shared-py3.14.cmake
-rw-r--r-- 3 rwoolley users 3316 Aug 12 13:16 image/usr/lib/cmake/boost_numpy-1.91.0/libboost_numpy-variant-static-py3.14.cmake
-rw-r--r-- 3 rwoolley users 3280 Aug 12 13:16 image/usr/lib/cmake/boost_python-1.91.0/libboost_python-variant-shared-py3.14.cmake
-rw-r--r-- 3 rwoolley users 3334 Aug 12 13:16 image/usr/lib/cmake/boost_python-1.91.0/libboost_python-variant-static-py3.14.cmake
-rw-r--r-- 3 rwoolley users 1642060 Aug 12 13:15 image/usr/lib/libboost_numpy314.a
lrwxrwxrwx 1 rwoolley users 27 Aug 12 13:15 image/usr/lib/libboost_numpy314.so -> libboost_numpy314.so.1.91.0
-rwxr-xr-x 1 rwoolley users 702176 Aug 12 13:15 image/usr/lib/libboost_numpy314.so.1.91.0
-rw-r--r-- 3 rwoolley users 10658572 Aug 12 13:15 image/usr/lib/libboost_python314.a
lrwxrwxrwx 1 rwoolley users 28 Aug 12 13:15 image/usr/lib/libboost_python314.so -> libboost_python314.so.1.91.0
-rwxr-xr-x 1 rwoolley users 4727368 Aug 12 13:15 image/usr/lib/libboost_python314.so.1.91.0
Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
---
Rob Woolley (3):
boost: Use python3-native executable
boost-build-native: Add python-numpy-include feature
boost: Add support for Boost.Python NumPy extension
.../boost/boost-build-native_1.91.0.bb | 3 +-
.../add-python-numpy-include-feature.patch | 74 ++++++++++++++++++++++
meta/recipes-support/boost/boost.inc | 9 ++-
3 files changed, 84 insertions(+), 2 deletions(-)
---
base-commit: 96872cac87349528fa0516fa2f6265adf0a15dd7
change-id: 20260806-fix-boost-fca31915ebc4
Best regards,
--
Rob Woolley <rob.woolley@windriver.com>
next reply other threads:[~2026-08-12 20:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 20:34 Rob Woolley [this message]
2026-08-12 20:34 ` [PATCH v2 1/3] boost: Use python3-native executable Rob Woolley
2026-08-12 20:46 ` Patchtest results for " patchtest
2026-08-12 20:34 ` [PATCH v2 2/3] boost-build-native: Add python-numpy-include feature Rob Woolley
2026-08-12 20:34 ` [PATCH v2 3/3] boost: Add support for Boost.Python NumPy extension Rob Woolley
2026-08-12 20:46 ` Patchtest results for " patchtest
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260812-fix-boost-v2-0-cbcb65f5e186@windriver.com \
--to=rob.woolley@windriver.com \
--cc=alex.kanavin@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.