diff options
author | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-03-10 14:31:17 +0100 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2025-03-10 09:41:56 -0700 |
commit | b66b1eb9f68407a2545a35788ca642f18e5c9aea (patch) | |
tree | 5963bb91960bc662ebaa29bda66b36ffd3ddbc21 /meta-python/recipes-devtools/python/python3-pandas_2.2.2.bb | |
parent | 72a041e46c124377300663654c7c255e7ce54239 (diff) | |
download | meta-openembedded-b66b1eb9f68407a2545a35788ca642f18e5c9aea.tar.gz |
python3-pandas: compile against target version of numpy
python3-numpy headers are required by pandas to compile successfully.
By default, this recipe used python3-numpy-native for compilation,
which usually works. However in case the bitness of the build-host
differs from the target, then problems arise.
For example when compiling for 32-bit ARM on a x86-64 machine, the following
error appears when trying to import the module:
ValueError: Buffer dtype mismatch, expected 'const int64_t' but got 'long long'
When running a diff on all numpy headers across native and target,
only one header differs, _numpyconfig.h, in a significant way.
This header defines the sizes of different datatypes used by numpy,
and these sizes strongly depend on the arch bitness.
This change switches from python3-numpy-native dependency to python3-numpy to
ensure that the correct headers are used. Beside this also patch the meson script,
so it accepts an option (numpy_inc_dir) to specify the location of these headers,
since it is not able to query them from the class-target module
The PYTHONPATH variable is extended with the target's RECIPE_SYSROOT, because
numpy is specified as a dependency in meson, and it needs to find the module
to continue successfully.
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-pandas_2.2.2.bb')
-rw-r--r-- | meta-python/recipes-devtools/python/python3-pandas_2.2.2.bb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/meta-python/recipes-devtools/python/python3-pandas_2.2.2.bb b/meta-python/recipes-devtools/python/python3-pandas_2.2.2.bb index c12a237653..ad9482e7dd 100644 --- a/meta-python/recipes-devtools/python/python3-pandas_2.2.2.bb +++ b/meta-python/recipes-devtools/python/python3-pandas_2.2.2.bb | |||
@@ -11,12 +11,14 @@ SRC_URI += " \ | |||
11 | file://0001-pyproject.toml-Downgrade-numpy-version-needs-to-1.x.patch \ | 11 | file://0001-pyproject.toml-Downgrade-numpy-version-needs-to-1.x.patch \ |
12 | " | 12 | " |
13 | 13 | ||
14 | SRC_URI:append:class-target = " file://0001-BLD-add-option-to-specify-numpy-header-location.patch " | ||
15 | |||
14 | SRC_URI[sha256sum] = "9e79019aba43cb4fda9e4d983f8e88ca0373adbb697ae9c6c43093218de28b54" | 16 | SRC_URI[sha256sum] = "9e79019aba43cb4fda9e4d983f8e88ca0373adbb697ae9c6c43093218de28b54" |
15 | 17 | ||
16 | inherit pkgconfig pypi python_mesonpy cython | 18 | inherit pkgconfig pypi python_mesonpy cython |
17 | 19 | ||
18 | DEPENDS += " \ | 20 | DEPENDS += " \ |
19 | python3-numpy-native \ | 21 | python3-numpy \ |
20 | python3-versioneer-native \ | 22 | python3-versioneer-native \ |
21 | " | 23 | " |
22 | 24 | ||
@@ -30,3 +32,8 @@ RDEPENDS:${PN} += " \ | |||
30 | python3-pytz \ | 32 | python3-pytz \ |
31 | python3-profile \ | 33 | python3-profile \ |
32 | " | 34 | " |
35 | |||
36 | PYTHONPATH:prepend:class-target = "${RECIPE_SYSROOT}${PYTHON_SITEPACKAGES_DIR}:" | ||
37 | export PYTHONPATH | ||
38 | |||
39 | EXTRA_OEMESON:append:class-target = " -Dnumpy_inc_dir=${RECIPE_SYSROOT}${PYTHON_SITEPACKAGES_DIR}/numpy/_core/include " | ||