Skip to content

BUG: Build failure with -mcpu=power9: error: '__builtin_vsx_vextract_fp_from_shorth' requires the '-mcpu=power9' and '-mvsx' options #29622

Open

Description

@mgorny

Describe the issue:

When CFLAGS contains -mcpu=power9 on a PPC64LE system, NumPy autodetects VSX3 baseline, but afterwards fails to compile due to missing -mvsx.

Reproduce the code example:

CFLAGS='-mcpu=power9' python -m build -w

Error message:

* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - Cython>=3.0.6
  - meson-python>=0.18.0
* Getting build dependencies for wheel...
* Installing packages in isolated environment:
  - patchelf >= 0.11.0
* Building wheel...
+ /tmp/build-env-utyu_4s1/bin/python /home/mgorny/numpy/vendored-meson/meson/meson.py setup /home/mgorny/numpy /home/mgorny/numpy/.mesonpy-xh32ria7 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/home/mgorny/numpy/.mesonpy-xh32ria7/meson-python-native-file.ini
The Meson build system
Version: 1.8.3
Source dir: /home/mgorny/numpy
Build dir: /home/mgorny/numpy/.mesonpy-xh32ria7
Build type: native build
Project name: NumPy
Project version: 2.4.0.dev0+git20250824.388b918
C compiler for the host machine: ccache cc (gcc 14.3.0 "cc (Gentoo Hardened 14.3.0 p8) 14.3.0")
C linker for the host machine: cc ld.bfd 2.44
C++ compiler for the host machine: ccache c++ (gcc 14.3.0 "c++ (Gentoo Hardened 14.3.0 p8) 14.3.0")
C++ linker for the host machine: c++ ld.bfd 2.44
Cython compiler for the host machine: cython (cython 3.1.3)
Host machine cpu family: ppc64
Host machine cpu: ppc64le
Program python found: YES (/tmp/build-env-utyu_4s1/bin/python)
Found pkg-config: YES (/usr/bin/pkg-config) 2.5.1
Run-time dependency python found: YES 3.13
Has header "Python.h" with dependency python-3.13: YES 
Compiler for C supports arguments -fno-strict-aliasing: YES 
Message: Appending option "detect" to "cpu-baseline" due to detecting global architecture c_arg "-mcpu=power9"
Test features "VSX VSX2 VSX3 VSX4" : Parial support, missing(VSX4) 
Message: During parsing cpu-dispatch: The following CPU features were ignored due to platform incompatibility or lack of support:
"XOP FMA4"
Test features "VSX VSX2 VSX3" : Supported 
Test features "VSX4" : Supported 
Configuring npy_cpu_dispatch_config.h using configuration
Message: 
CPU Optimization Options
  baseline:
    Requested : min+detect
    Enabled   : VSX VSX2 VSX3
  dispatch:
    Requested : max -xop -fma4
    Enabled   : VSX4

Library m found: YES
Run-time dependency scipy-openblas found: NO (tried pkgconfig)
Found CMake: /usr/bin/cmake (3.31.7)
Run-time dependency openblas found: NO (tried pkgconfig, pkgconfig, pkgconfig, system and cmake)
Run-time dependency flexiblas found: NO (tried pkgconfig and cmake)
Run-time dependency blis found: NO (tried pkgconfig and cmake)
Run-time dependency blas found: NO (tried pkgconfig and system)
Run-time dependency openblas found: NO (tried pkgconfig, pkgconfig, pkgconfig, system and cmake)
Run-time dependency flexiblas found: NO (tried pkgconfig and cmake)
Run-time dependency lapack found: NO (tried pkgconfig and system)
Checking if "Check atomic builtins without -latomic" links: YES 
Program _build_utils/process_src_template.py found: YES (/tmp/build-env-utyu_4s1/bin/python /home/mgorny/numpy/numpy/_build_utils/process_src_template.py)
Program _build_utils/tempita.py found: YES (/tmp/build-env-utyu_4s1/bin/python /home/mgorny/numpy/numpy/_build_utils/tempita.py)
Configuring __config__.py using configuration
../numpy/meson.build:445: WARNING: The variable(s) 'BLAS_INCLUDEDIR', 'BLAS_LIBDIR', 'BLAS_OPENBLAS_CONFIG', 'BLAS_PCFILEDIR', 'BLAS_TYPE_NAME', 'BLAS_VERSION', 'LAPACK_INCLUDEDIR', 'LAPACK_LIBDIR', 'LAPACK_OPENBLAS_CONFIG', 'LAPACK_PCFILEDIR', 'LAPACK_TYPE_NAME', 'LAPACK_VERSION' in the input file 'numpy/__config__.py.in' are not present in the given configuration data.
Checking for size of "short" : 2 
Checking for size of "int" : 4 
Checking for size of "long" : 8 
Checking for size of "long long" : 8 
Checking for size of "float" : 4 
Checking for size of "double" : 8 
Checking for size of "long double" : 16 
Checking for size of "size_t" : 8 
Checking for size of "size_t" : 8 (cached)
Checking for size of "wchar_t" : 4 
Checking for size of "off_t" : 8 
Checking for size of "Py_intptr_t" with dependency python-3.13: 8 
Checking for size of "PY_LONG_LONG" with dependency python-3.13: 8 
Has header "complex.h" : YES 
Checking for type "complex float" : YES 
Checking for size of "complex float" : 8 
Checking for type "complex double" : YES 
Checking for size of "complex double" : 16 
Checking for type "complex long double" : YES 
Checking for size of "complex long double" : 32 
Checking for function "sin" with dependency -lm: YES 
Checking for function "cos" with dependency -lm: YES 
Checking for function "tan" with dependency -lm: YES 
Checking for function "sinh" with dependency -lm: YES 
Checking for function "cosh" with dependency -lm: YES 
Checking for function "tanh" with dependency -lm: YES 
Checking for function "fabs" with dependency -lm: YES 
Checking for function "floor" with dependency -lm: YES 
Checking for function "ceil" with dependency -lm: YES 
Checking for function "sqrt" with dependency -lm: YES 
Checking for function "log10" with dependency -lm: YES 
Checking for function "log" with dependency -lm: YES 
Checking for function "exp" with dependency -lm: YES 
Checking for function "asin" with dependency -lm: YES 
Checking for function "acos" with dependency -lm: YES 
Checking for function "atan" with dependency -lm: YES 
Checking for function "fmod" with dependency -lm: YES 
Checking for function "modf" with dependency -lm: YES 
Checking for function "frexp" with dependency -lm: YES 
Checking for function "ldexp" with dependency -lm: YES 
Checking for function "expm1" with dependency -lm: YES 
Checking for function "log1p" with dependency -lm: YES 
Checking for function "acosh" with dependency -lm: YES 
Checking for function "asinh" with dependency -lm: YES 
Checking for function "atanh" with dependency -lm: YES 
Checking for function "rint" with dependency -lm: YES 
Checking for function "trunc" with dependency -lm: YES 
Checking for function "exp2" with dependency -lm: YES 
Checking for function "copysign" with dependency -lm: YES 
Checking for function "nextafter" with dependency -lm: YES 
Checking for function "cbrt" with dependency -lm: YES 
Checking for function "log2" with dependency -lm: YES 
Checking for function "pow" with dependency -lm: YES 
Checking for function "hypot" with dependency -lm: YES 
Checking for function "atan2" with dependency -lm: YES 
Checking for function "csin" with dependency -lm: YES 
Checking for function "csinh" with dependency -lm: YES 
Checking for function "ccos" with dependency -lm: YES 
Checking for function "ccosh" with dependency -lm: YES 
Checking for function "ctan" with dependency -lm: YES 
Checking for function "ctanh" with dependency -lm: YES 
Checking for function "creal" with dependency -lm: YES 
Checking for function "cimag" with dependency -lm: YES 
Checking for function "conj" with dependency -lm: YES 
Checking for function "strtoll" : YES 
Checking for function "strtoull" : YES 
Checking for function "cabs" with dependency -lm: YES 
Checking for function "cabsf" with dependency -lm: YES 
Checking for function "cabsl" with dependency -lm: YES 
Checking for function "cacos" with dependency -lm: YES 
Checking for function "cacosf" with dependency -lm: YES 
Checking for function "cacosl" with dependency -lm: YES 
Checking for function "cacosh" with dependency -lm: YES 
Checking for function "cacoshf" with dependency -lm: YES 
Checking for function "cacoshl" with dependency -lm: YES 
Checking for function "carg" with dependency -lm: YES 
Checking for function "cargf" with dependency -lm: YES 
Checking for function "cargl" with dependency -lm: YES 
Checking for function "casin" with dependency -lm: YES 
Checking for function "casinf" with dependency -lm: YES 
Checking for function "casinl" with dependency -lm: YES 
Checking for function "casinh" with dependency -lm: YES 
Checking for function "casinhf" with dependency -lm: YES 
Checking for function "casinhl" with dependency -lm: YES 
Checking for function "catan" with dependency -lm: YES 
Checking for function "catanf" with dependency -lm: YES 
Checking for function "catanl" with dependency -lm: YES 
Checking for function "catanh" with dependency -lm: YES 
Checking for function "catanhf" with dependency -lm: YES 
Checking for function "catanhl" with dependency -lm: YES 
Checking for function "cexp" with dependency -lm: YES 
Checking for function "cexpf" with dependency -lm: YES 
Checking for function "cexpl" with dependency -lm: YES 
Checking for function "clog" with dependency -lm: YES 
Checking for function "clogf" with dependency -lm: YES 
Checking for function "clogl" with dependency -lm: YES 
Checking for function "cpow" with dependency -lm: YES 
Checking for function "cpowf" with dependency -lm: YES 
Checking for function "cpowl" with dependency -lm: YES 
Checking for function "csqrt" with dependency -lm: YES 
Checking for function "csqrtf" with dependency -lm: YES 
Checking for function "csqrtl" with dependency -lm: YES 
Checking for function "csin" with dependency -lm: YES (cached)
Checking for function "csinf" with dependency -lm: YES 
Checking for function "csinl" with dependency -lm: YES 
Checking for function "csinh" with dependency -lm: YES (cached)
Checking for function "csinhf" with dependency -lm: YES 
Checking for function "csinhl" with dependency -lm: YES 
Checking for function "ccos" with dependency -lm: YES (cached)
Checking for function "ccosf" with dependency -lm: YES 
Checking for function "ccosl" with dependency -lm: YES 
Checking for function "ccosh" with dependency -lm: YES (cached)
Checking for function "ccoshf" with dependency -lm: YES 
Checking for function "ccoshl" with dependency -lm: YES 
Checking for function "ctan" with dependency -lm: YES (cached)
Checking for function "ctanf" with dependency -lm: YES 
Checking for function "ctanl" with dependency -lm: YES 
Checking for function "ctanh" with dependency -lm: YES (cached)
Checking for function "ctanhf" with dependency -lm: YES 
Checking for function "ctanhl" with dependency -lm: YES 
Checking for function "isfinite" with dependency -lm: YES 
Header "Python.h" has symbol "isfinite" with dependency python-3.13: YES 
Checking for function "isinf" with dependency -lm: YES 
Header "Python.h" has symbol "isinf" with dependency python-3.13: YES 
Checking for function "isnan" with dependency -lm: YES 
Header "Python.h" has symbol "isnan" with dependency python-3.13: YES 
Checking for function "signbit" with dependency -lm: YES 
Header "Python.h" has symbol "signbit" with dependency python-3.13: YES 
Checking if "thread_local" compiles: NO 
Checking if "_Thread_local" compiles: YES 
Checking if "__thread" compiles: YES 
Checking if "__declspec(thread)" compiles: NO 
Checking for function "fallocate" : YES 
Header "Python.h" has symbol "HAVE_FTELLO" with dependency python-3.13: YES 
Header "Python.h" has symbol "HAVE_FSEEKO" with dependency python-3.13: YES 
Checking for function "backtrace" : YES 
Checking for function "madvise" : YES 
Has header "features.h" : YES 
Has header "xlocale.h" : NO 
Has header "dlfcn.h" : YES 
Has header "execinfo.h" : YES 
Has header "libunwind.h" : NO 
Has header "sys/mman.h" : YES 
Checking for function "strtold_l" : YES 
Checking if "__attribute__((optimize("unroll-loops")))" compiles: YES 
Checking if "__attribute__((optimize("O3")))" compiles: YES 
Checking if "__attribute__((nonnull(1)))" compiles: YES 
Compiler for C supports arguments -O3: YES 
Message: Long double format: IEEE_QUAD_LE
Has header "endian.h" : YES 
Has header "sys/endian.h" : NO 
Compiler for C supports function attribute visibility:hidden: YES 
Configuring config.h using configuration
Configuring _numpyconfig.h using configuration
Configuring npymath.ini using configuration
Configuring mlib.ini using configuration
Configuring numpy.pc using configuration
Generating multi-targets for "_umath_tests.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "argfunc.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "x86_simd_argsort.dispatch.h" 
  Enabled targets: 
Generating multi-targets for "x86_simd_qsort.dispatch.h" 
  Enabled targets: 
Generating multi-targets for "x86_simd_qsort_16bit.dispatch.h" 
  Enabled targets: 
Generating multi-targets for "highway_qsort.dispatch.h" 
  Enabled targets: VSX2
Generating multi-targets for "highway_qsort_16bit.dispatch.h" 
  Enabled targets: VSX2
Generating multi-targets for "loops_arithm_fp.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_arithmetic.dispatch.h" 
  Enabled targets: VSX4, baseline
Generating multi-targets for "loops_comparison.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_exponent_log.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_hyperbolic.dispatch.h" 
  Enabled targets: VSX4, baseline
Generating multi-targets for "loops_logical.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_minmax.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_modulo.dispatch.h" 
  Enabled targets: VSX4, baseline
Generating multi-targets for "loops_trigonometric.dispatch.h" 
  Enabled targets: VSX4, baseline
Generating multi-targets for "loops_umath_fp.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_unary.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_unary_fp.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_unary_fp_le.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_unary_complex.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_autovec.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "loops_half.dispatch.h" 
  Enabled targets: baseline
Generating multi-targets for "_simd.dispatch.h" 
  Enabled targets: VSX4, baseline
Build targets in project: 70

NumPy 2.4.0.dev0+git20250824.388b918

  User defined options
    Native files: /home/mgorny/numpy/.mesonpy-xh32ria7/meson-python-native-file.ini
    b_ndebug    : if-release
    b_vscrt     : md
    buildtype   : release

Found ninja-1.12.1 at /usr/bin/ninja
+ /usr/bin/ninja
[137/363] Compiling C++ object numpy/_core/libhighway_qsort_16bit.dispatch.h_VSX2.a.p/src_npysort_highway_qsort_16bit.dispatch.cpp.o
FAILED: numpy/_core/libhighway_qsort_16bit.dispatch.h_VSX2.a.p/src_npysort_highway_qsort_16bit.dispatch.cpp.o 
ccache c++ -Inumpy/_core/libhighway_qsort_16bit.dispatch.h_VSX2.a.p -Inumpy/_core -I../numpy/_core -Inumpy/_core/include -I../numpy/_core/include -I../numpy/_core/src/common -I../numpy/_core/src/multiarray -I../numpy/_core/src/npymath -I../numpy/_core/src/umath -I../numpy/_core/src/highway -I/usr/include/python3.13 -I/home/mgorny/numpy/.mesonpy-xh32ria7/meson_cpu -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c++17 -O3 -mcpu=power9 -DNPY_HAVE_VSX -DNPY_HAVE_VSX_ASM -DNPY_HAVE_VSX3 -DNPY_HAVE_VSX3_HALF_DOUBLE -fPIC -DNPY_INTERNAL_BUILD -DHAVE_NPY_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -fno-exceptions -fno-rtti -O3 -DNPY_HAVE_VSX2 -mcpu=power8 -DNPY_MTARGETS_CURRENT=VSX2 -MD -MQ numpy/_core/libhighway_qsort_16bit.dispatch.h_VSX2.a.p/src_npysort_highway_qsort_16bit.dispatch.cpp.o -MF numpy/_core/libhighway_qsort_16bit.dispatch.h_VSX2.a.p/src_npysort_highway_qsort_16bit.dispatch.cpp.o.d -o numpy/_core/libhighway_qsort_16bit.dispatch.h_VSX2.a.p/src_npysort_highway_qsort_16bit.dispatch.cpp.o -c ../numpy/_core/src/npysort/highway_qsort_16bit.dispatch.cpp
In file included from ../numpy/_core/src/common/common.hpp:10,
                 from ../numpy/_core/src/npysort/highway_qsort.hpp:4,
                 from ../numpy/_core/src/npysort/highway_qsort_16bit.dispatch.cpp:5:
../numpy/_core/src/common/half.hpp: In member function 'np::Half::operator float() const':
../numpy/_core/src/common/half.hpp:76:54: error: '__builtin_vsx_vextract_fp_from_shorth' requires the '-mcpu=power9' and '-mvsx' options
   76 |         return vec_extract(vec_extract_fp_from_shorth(vec_splats(bits_)), 0);
      |                                                      ^
../numpy/_core/src/common/half.hpp:76:54: note: overloaded builtin '__builtin_vec_vextract_fp_from_shorth' is implemented by builtin '__builtin_vsx_vextract_fp_from_shorth'
[139/363] Compiling C++ object numpy/_core/libhighway_qsort.dispatch.h_VSX2.a.p/src_npysort_highway_qsort.dispatch.cpp.o
FAILED: numpy/_core/libhighway_qsort.dispatch.h_VSX2.a.p/src_npysort_highway_qsort.dispatch.cpp.o 
ccache c++ -Inumpy/_core/libhighway_qsort.dispatch.h_VSX2.a.p -Inumpy/_core -I../numpy/_core -Inumpy/_core/include -I../numpy/_core/include -I../numpy/_core/src/common -I../numpy/_core/src/multiarray -I../numpy/_core/src/npymath -I../numpy/_core/src/umath -I../numpy/_core/src/highway -I/usr/include/python3.13 -I/home/mgorny/numpy/.mesonpy-xh32ria7/meson_cpu -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c++17 -O3 -mcpu=power9 -DNPY_HAVE_VSX -DNPY_HAVE_VSX_ASM -DNPY_HAVE_VSX3 -DNPY_HAVE_VSX3_HALF_DOUBLE -fPIC -DNPY_INTERNAL_BUILD -DHAVE_NPY_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -fno-exceptions -fno-rtti -O3 -DNPY_HAVE_VSX2 -mcpu=power8 -DNPY_MTARGETS_CURRENT=VSX2 -MD -MQ numpy/_core/libhighway_qsort.dispatch.h_VSX2.a.p/src_npysort_highway_qsort.dispatch.cpp.o -MF numpy/_core/libhighway_qsort.dispatch.h_VSX2.a.p/src_npysort_highway_qsort.dispatch.cpp.o.d -o numpy/_core/libhighway_qsort.dispatch.h_VSX2.a.p/src_npysort_highway_qsort.dispatch.cpp.o -c ../numpy/_core/src/npysort/highway_qsort.dispatch.cpp
In file included from ../numpy/_core/src/common/common.hpp:10,
                 from ../numpy/_core/src/npysort/highway_qsort.hpp:4,
                 from ../numpy/_core/src/npysort/highway_qsort.dispatch.cpp:5:
../numpy/_core/src/common/half.hpp: In member function 'np::Half::operator float() const':
../numpy/_core/src/common/half.hpp:76:54: error: '__builtin_vsx_vextract_fp_from_shorth' requires the '-mcpu=power9' and '-mvsx' options
   76 |         return vec_extract(vec_extract_fp_from_shorth(vec_splats(bits_)), 0);
      |                                                      ^
../numpy/_core/src/common/half.hpp:76:54: note: overloaded builtin '__builtin_vec_vextract_fp_from_shorth' is implemented by builtin '__builtin_vsx_vextract_fp_from_shorth'
[154/363] Compiling C object numpy/_core/libloops_autovec.dispatch.h_baseline.a.p/meson-generated_loops_autovec.dispatch.c.o
ninja: build stopped: subcommand failed.

ERROR Backend subprocess exited when trying to invoke build_wheel

Python and NumPy Versions:

Python: 3.13.5 (main, Aug 25 2025, 00:15:29) [GCC 14.3.0]
NumPy: 388b918

Runtime Environment:

No response

Context for the issue:

Original bug report: https://bugs.gentoo.org/937757

Activity

  1. added 2 commits that reference this issue on Aug 25, 2025
    db7f15a
    bf4d1f4
  2. SumitkCodes commented on Aug 25, 2025

    @SumitkCodes

    @mgorny can you check #29627

  3. mgorny commented on Aug 25, 2025

    @mgorny
    ContributorAuthor

    I can confirm that it fixes our problems. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions