-
Notifications
You must be signed in to change notification settings - Fork 257
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
can't #include <cstdio>
with __FILE_OFFSET_BITS=64
#480
Comments
This is similar to a problem that libandroid_support solves for libc++. We can add all the stuff that would be hidden in the |
Actually, worse, as |
Ugh. These hacks that should have been in libandroid_support were directly in the deprecated headers. |
Oh, no, that isn't correct. |
Yeah, I know ;) |
Actually, pretty sure the 64bits ones were also, as we used some hacks before unified headers to do LARGE_OFFSET |
Then I don't understand what you meant by
|
fgetpos64 wasn't available until N. _FILE_OFFSET_BITS=64 used to be a no-op until r15, so you're probably just confused. |
@DanAlbert Well, with current headers, nothing is defined.
|
@enh Might be that the code wasn't hit, but at least it compiled (we are a multi-platform app) |
Scroll down one more line. |
Sure, but this is in the context of |
i think you don't understand that until r15 you were using headers that just ignored _FILE_OFFSET_BITS. full story: https://android.googlesource.com/platform/bionic/+/master/#32_bit-ABI-bugs-is-32_bit-1 |
Certainly one of us has :) A trivial test case that just calls |
With |
No, without
I still encourage the beer either way :) |
So the plan is to revert to pre-r15 situation re LARGE_OFFSET, ie no support. Right? |
If you don't need 64-bit file offsets in your app, turn off That last bit (including We'll make it work well for libc++, but gnustl hasn't been getting updates/fixes for a while now and is going to be removed in a release or two anyway.
Yeah, it's a library that backports the things that libc++ needs to function. We've never tested it with any of the other STLs, and don't plan to (since the others are being removed soon). |
strictly: "if you don't need off_t to be 64-bit in your app, turn off _FILE_OFFSET_BITS=64" the link he showed above was using off64_t and blah64(), corresponding to |
Fixed in r16. |
@DanAlbert Link: https://dl.google.com/android/repository/android-ndk-r16-beta1-linux-x86_64.zip Thanks |
@DanAlbert try using CMake 3.10 with Android NDK r16, libc++_static and API version 14. As soon as i define __ANDROID_API__=14, the entire build is breaking, because of missing fseeko (and friends) in the universal headers. This got fixed by the macro i pasted above. And no, i can't use the toolchain file provided with the NDK for good reasons. |
Including things like cstdio requires that we have a decl for everything that header needs to pull into the std namespace. We don't actually have these functions available in this release, but we can at least make this header includable. Adding a test to make sure all of the C++ C headers can be included in _FILE_OFFSET_BITS=64 mode. Test: ./run_tests.py Bug: android/ndk#480 Change-Id: Icfd319b293736249e5840fee7efbce1d3b69e20b
This issue seems to be back on NDK r17. #define _FILE_OFFSET_BITS 64
#include <cstdio> I'm then building six standalone toolchains ( ~/android-ndk-r15c/build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androidabi-4.9 --arch=arm --stl=libc++ --platform=android-22 --install-dir=./ndk-r15-API22
~/android-ndk-r15c/build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androidabi-4.9 --arch=arm --stl=libc++ --platform=android-24 --install-dir=./ndk-r15-API24
~/android-ndk-r16b/build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androidabi-4.9 --arch=arm --stl=libc++ --platform=android-22 --install-dir=./ndk-r16-API22
~/android-ndk-r16b/build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androidabi-4.9 --arch=arm --stl=libc++ --platform=android-24 --install-dir=./ndk-r16-API24
~/android-ndk-r17/build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androidabi-4.9 --arch=arm --stl=libc++ --platform=android-22 --install-dir=./ndk-r17-API22
~/android-ndk-r17/build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androidabi-4.9 --arch=arm --stl=libc++ --platform=android-24 --install-dir=./ndk-r17-API24 These toolchains are able to build ./ndk-r15-API24/bin/clang -c test.cpp
./ndk-r16-API22/bin/clang -c test.cpp
./ndk-r16-API24/bin/clang -c test.cpp
./ndk-r17-API24/bin/clang -c test.cpp But these toolchains are unable to build
While this issue was fixed for |
API 24 works, because you're asking for a 64-bit
API 22 doesn't work because they're not.
what changed in r17 is that (even before then, i'm not sure why there was a special case for these, but not for the other late additions. huh, looking at i guess we'll have to move this hack into bionic then. preferably with a slightly improved comment explicitly saying "this doesn't matter because you'll still get a link-time error if you mistakenly try to actually use these". |
This is probably deserving of an r17b :( No timeline on that yet. We generally want to give the release a week or two of soak time (not counting last week since I/O means lots of Android developers were ooo) to make sure we catch as many regressions as possible in the hotfix rather than having to release a dozen hotfixes. |
waiting for r17b... |
I'm getting this exact problem too with boost :( I'll patiently wait for r17b.
Based on these comments above, wouldn't it make more sense to keep using libandroid_support above API 21? I can see similar problems to this if the team keeps adding standard POSIX C and C++ methods to the newer Android APIs that will be missing below API 27 and more, and the point of libandroid_support was to implement missing standard methods not present in the lower APIs. |
The point of libandroid_support is to backport just enough for libc++ to work. We'd once discussed backporting everything we could, but when we asked if that was even a thing people wanted the answer was "not if it increases APK size", which is unavoidable: #456. |
what about a support library for libc++, like it is right now and a opt-in support library for backports? this does not increase code size for people who care about it but is really helpful for people who want to utilize features across the platforms without caring about code size. |
i think you're misunderstanding what's going on here: no implementations have been taken away. you never had 64-bit the bug here is that we took away a declaration for a function you don't have, but whose declaration is required by a libc++ header. that's just a bug, and we'll fix that. @DanAlbert --- am i supposed to be making that change or are you? |
To clarify:
I already have it more or less ready. |
For the time being I've modified libc++ rather than bionic: https://android-review.googlesource.com/c/platform/external/libcxx/+/691583 We need to decide if we want to try ton get this change upstream (given that it's forcing libc++ to workaround a bionic bug, I sort of doubt it), push most of the libandroid_support crap into bionic, or something else. Also added an additional test case since we were missing the configuration of LP32 21+. |
Sorry, i did not mean the 64-bit off_t, i was just speaking in generally about the whole idea of an android backport library. Wrong place and wrong time to discuss this though :) |
Any updates on r17b? |
On 32-bit Linux/Android, fseek and ftell only works well for trace file smaller than 2GB which will cause problem when geting file length and using portability table. This change fixed above issue in replaying large trace file using 32-bit vkreplay on Linux/Android. For x86 version: Use fseeko and ftello instead of fseek and ftell. "-D_FILE_OFFSET_BITS=64" has been defined in vktrace's CMakeList.txt to make those functions support large file. For 32-bit Android version: Implement vktrace_fseek and vktrace_ftell using lseek64 which is available in NDK. For the NDK problem of using fseeko and ftello, refer to android/ndk#480
On 32-bit Linux/Android, fseek and ftell only works well for trace file smaller than 2GB which will cause problem when geting file length and using portability table on a large trace file. This change fixes the issue by: * x86 version: ** Use fseeko and ftello instead of fseek and ftell. "-D_FILE_OFFSET_BITS=64" has been defined in vktrace's CMakeList.txt to make those functions support large file. * 32-bit Android version: ** Implement vktrace_fseek and vktrace_ftell using lseek64 which is available in NDK. For the NDK problem of using fseeko and ftello, refer to android/ndk#480
On 32-bit Linux/Android, fseek and ftell only works well for trace file smaller than 2GB which will cause problem when geting file length and using portability table on a large trace file. This change fixes the issue by: * x86 version: ** Use fseeko and ftello instead of fseek and ftell. "-D_FILE_OFFSET_BITS=64" has been defined in vktrace's CMakeList.txt to make those functions support large file. * 32-bit Android version: ** Implement vktrace_fseek and vktrace_ftell using lseek64 which is available in NDK. For the NDK problem of using fseeko and ftello, refer to android/ndk#480
Refiling @koying's follow up on #442:
The text was updated successfully, but these errors were encountered: