mbox series

[0/2] boost: Add Boost.Python NumPy

Message ID 20260810-fix-boost-v1-0-4e838b3d43b4@windriver.com
Headers show
Series boost: Add Boost.Python NumPy | expand

Message

Woolley, Rob Aug. 10, 2026, 5:35 p.m. UTC
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-existent 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: 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.

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 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-poky-with-sstate-distro_poky-machine_qemuarm64/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-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]   user-specified libraries: "/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] Details of this Python configuration:
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-native/usr/bin/python3-native/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-native/usr/bin/python3-native/python3 -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"'
notice: [python-cfg] NumPy enabled

$ find image \( -name libboost_py* -o -name libboost_nu* \) | xargs  ls -al
-
-rw-r--r-- 3 rwoolley users     3262 Aug  4 14:07 image/usr/lib/cmake/boost_numpy-1.91.0/libboost_numpy-variant-shared-py3.14.cmake
-rw-r--r-- 3 rwoolley users     3316 Aug  4 14:07 image/usr/lib/cmake/boost_numpy-1.91.0/libboost_numpy-variant-static-py3.14.cmake
-rw-r--r-- 3 rwoolley users     3280 Aug  4 14:07 image/usr/lib/cmake/boost_python-1.91.0/libboost_python-variant-shared-py3.14.cmake
-rw-r--r-- 3 rwoolley users     3334 Aug  4 14:07 image/usr/lib/cmake/boost_python-1.91.0/libboost_python-variant-static-py3.14.cmake
-rw-r--r-- 3 rwoolley users  1642060 Aug  4 14:05 image/usr/lib/libboost_numpy314.a
lrwxrwxrwx 1 rwoolley users       27 Aug  4 14:05 image/usr/lib/libboost_numpy314.so -> libboost_numpy314.so.1.91.0
-rwxr-xr-x 1 rwoolley users   702176 Aug  4 14:05 image/usr/lib/libboost_numpy314.so.1.91.0
-rw-r--r-- 3 rwoolley users 10658572 Aug  4 14:05 image/usr/lib/libboost_python314.a
lrwxrwxrwx 1 rwoolley users       28 Aug  4 14:05 image/usr/lib/libboost_python314.so -> libboost_python314.so.1.91.0
-rwxr-xr-x 1 rwoolley users  4727368 Aug  4 14:05 image/usr/lib/libboost_python314.so.1.91.0

The Python one-liner which imports numpy uses the python3-numpy-native module,
however the return value doesn't appear to be used.  The supplied include path
pointing to the target sysroot seems to be used for compliation.

Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
---
Rob Woolley (2):
      boost: Use python3-native executable
      boost: Add support for Boost.Python NumPy extension

 meta/recipes-support/boost/boost.inc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
base-commit: 96872cac87349528fa0516fa2f6265adf0a15dd7
change-id: 20260806-fix-boost-fca31915ebc4

Best regards,
--  
Rob Woolley <rob.woolley@windriver.com>