BUILD: fix missing include for std::ptrdiff_t for C++23 language mode#27416
Merged
charris merged 1 commit intonumpy:maintenance/2.1.xfrom Sep 18, 2024
Merged
BUILD: fix missing include for std::ptrdiff_t for C++23 language mode#27416charris merged 1 commit intonumpy:maintenance/2.1.xfrom
charris merged 1 commit intonumpy:maintenance/2.1.xfrom
Conversation
|
Are there any plans backporting this fix to the FAILED: numpy/_core/_multiarray_umath.pypy39-pp73-darwin.so.p/src_umath_string_ufuncs.cpp.o
c++ -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.cpp
In 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. |
Member
Author
No, we are currently maintaining 2.2.x and 2.3.x will be out in June. |
mkoeppe
added a commit
to passagemath/passagemath
that referenced
this pull request
May 2, 2025
This was referenced May 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, in string_fastsearch.h we rely on
std::ptrdiff_tbut don't explicitely include its header,cstddef, as prescribed bt the standard.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