Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
charris merged 1 commit intonumpy:maintenance/2.1.xfromcharris:backport-27361
Sep 18, 2024

Conversation

charris
Copy link
Member

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 onstd::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 includedcstddef.

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

@charrischarris added 08 - BackportUsed to tag backport PRs 36 - BuildBuild related PR labelsSep 18, 2024
@charrischarris added this to the2.1.2 release milestoneSep 18, 2024
@charrischarris merged commit5e314c7 intonumpy:maintenance/2.1.xSep 18, 2024
65 checks passed
@sergiud
Copy link

Are there any plans backporting this fix to themaintenance/2.0.x branch? pypy 3.9 builds of NumPy 2.0.2 started failing recently on macOS 15 Clang 16.0.0 due to

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.

agriyakhetarpal reacted with thumbs up emoji

@charris
Copy link
MemberAuthor

any plans backporting this fix to the maintenance/2.0.x branch

No, we are currently maintaining 2.2.x and 2.3.x will be out in June.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
08 - BackportUsed to tag backport PRs36 - BuildBuild related PR
Projects
None yet
Milestone
2.1.2 release
Development

Successfully merging this pull request may close these issues.

3 participants
@charris@sergiud@gorloffslava

[8]ページ先頭

©2009-2025 Movatter.jp