Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork10.9k
BUILD: fix missing include for std::ptrdiff_t for C++23 language mode#27416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
5e314c7
intonumpy:maintenance/2.1.xUh oh!
There was an error while loading.Please reload this page.
sergiud commentedApr 18, 2025
Are there any plans backporting this fix to the FAILED: numpy/_core/_multiarray_umath.pypy39-pp73-darwin.so.p/src_umath_string_ufuncs.cpp.oc++ -Inumpy/_core/_multiarray_umath.pypy39-pp73-darwin.so.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/Users/runner/work/hogpp/hogpp/.cibuildwheel/pypy3.9-v7.3.16-macos_arm64/include/pypy3.9 -I/private/var/folders/_d/l5rp6h1s2bnfkdsrc1wc54t00000gn/T/pip-install-luog790t/numpy_f604cee84c334f3ebc194bdadda2dee7/.mesonpy-u82k8a4a/meson_cpu -fvisibility=hidden -fvisibility-inlines-hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c++17 -O3 -ftrapping-math -DNPY_HAVE_CLANG_FPSTRICT -DNPY_HAVE_NEON_VFPV4 -DNPY_HAVE_NEON_FP16 -DNPY_HAVE_NEON -DNPY_HAVE_ASIMD -flto=auto -DPYBIND11_DETAILED_ERROR_MESSAGES -F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework -idirafter/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework/Headers -DACCELERATE_NEW_LAPACK -DHAVE_CBLAS '-DBLAS_SYMBOL_SUFFIX=$NEWLAPACK' -DNPY_INTERNAL_BUILD -DHAVE_NPY_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__STDC_VERSION__=0 -fno-exceptions -fno-rtti -MD -MQ numpy/_core/_multiarray_umath.pypy39-pp73-darwin.so.p/src_umath_string_ufuncs.cpp.o -MF numpy/_core/_multiarray_umath.pypy39-pp73-darwin.so.p/src_umath_string_ufuncs.cpp.o.d -o numpy/_core/_multiarray_umath.pypy39-pp73-darwin.so.p/src_umath_string_ufuncs.cpp.o -c ../numpy/_core/src/umath/string_ufuncs.cppIn file included from ../numpy/_core/src/umath/string_ufuncs.cpp:20:../numpy/_core/src/umath/string_fastsearch.h:132:5: error: no type named 'ptrdiff_t' in namespace 'std'; did you mean simply 'ptrdiff_t'? 132 | std::ptrdiff_t | ^~~~~~~~~~~~~~ | ptrdiff_t/Applications/Xcode_16.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/__stddef_ptrdiff_t.h:18:26: note: 'ptrdiff_t' declared here 18 | typedef __PTRDIFF_TYPE__ ptrdiff_t; | ^ The failure is not C++23 specific and arises when compiling using the C++17 language standard. |
No, we are currently maintaining 2.2.x and 2.3.x will be out in June. |
Backport of#27361.
This tiny PR fixes a failure happening when building numpy in C++23 language mode.
This issue is caused by the ongoing cleanup of C++ standard library from transitive includes, if they aren't explicitely allowed by the standard.
In particular, instring_fastsearch.h we rely on
std::ptrdiff_t
but don't explicitely include its header,cstddef
, as prescribed bt thestandard.Before C++23, this worked fine as some other headers we included transitvely included
cstddef
.Without this fix, both on Clang/LLVM and GCC upstreams the following error is observed:
../numpy/_core/src/umath/string_fastsearch.h:132:5: error: no type named 'ptrdiff_t' in namespace 'std'; did you mean simply 'ptrdiff_t'?
Please, find the attached logs with full details.
log.txt