-
Notifications
You must be signed in to change notification settings - Fork 264
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stddef.h: No such file or directory #215
Comments
I forgot to call this out in the known issues in the changelog: https://android.googlesource.com/platform/ndk/+/master/tests/build/standalone-toolchain/test_config.py#11 Unfortunately that refers to an internal bug (filed against our GCC folks), but I'll paste some of the relevant details here: The default header ordering with g++ is (taken from
Note that the C++ headers come after the compiler headers. libc++ provides its own stddef.h that wraps the compiler's, but the ordering of the default headers prevents that from happening. is found in the middle path, which does an Trying to include libc++'s stddef.h instead of cstddef doesn't work either. It doesn't fail, but the compiler finds its own copy rather than the one in libc++. Clang has the following search order (c++ headers first):
My system's g++ has the following search order (c++ headers first):
It's a little strange to me that the compiler headers come between the c++ headers and the libc headers. I would think the correct ordering is c++ -> libc -> compiler (in case libc needs to override some compiler headers), but both clang and (non-android) g++ seem to agree on that. |
A workaround for this in case the above is tl;dr: Clang is unaffected by this, and GCC will work with the other STLs, and only standalone toolchains hit this. If you're stuck in a situation where you have to use GCC and libc++ and you need to use a standalone toolchain, the only workaround I can think of would be adding |
(I'll add this to the known issues list in case anyone else stumbles on to it) |
Well, gcc has a long history of wanting to override your libc's headers, c.f. fixincludes.
Yep, due to #156. But with all the trouble I've had with
Well, I don't have to but it sure is nicer. Better
Indeed. But that workaround will work, yeah. |
Actually, I did include this in the known issues list: https://github.com/android-ndk/ndk/wiki/Changelog-r13
|
Indeed, a simple
Oops, sorry! Should have read the release notes. |
Given GCC's deprecation, this has been moved to the "won't fix" list. |
change include/c++/4.9.x/cstddef line 44 from |
great |
great |
FYI this issue persists in ndk 21e with the same file -- I'm getting it when I try to compile an OpenCV 4.5.2 plugin using its llvm toolchain and gnu c++ 11. There's a bunch of other errors if I use the fix above (using ::signbit; using ::fpclassify; using ::isfinite, and a bounch of others like isgreater, islessthan, and other comparators are all throwing "no member named ----- in the global namespace") |
Gnu libstdc++ hasn't been included in the NDK since r17, so there's your problem. |
Since updating to r13, I get this:
The text was updated successfully, but these errors were encountered: