-
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
(stdio.h:36:25) invalid token at start of a preprocessor expression #501
Comments
If you change that to |
Yes, that error goes away. However now this occurs:
|
Okay, even on a Mac, building via Studio, I still can't repro this. |
Adding boost (fresh checkout from master) to the mix doesn't change things. |
isn't there some compiler flag that changes the interpretation of undefined macros? i'm guessing it's being replaced with 0 for us, but not for the submitter? can we see the submitter's compiler flags? |
I think a header that's getting included before is doing |
I'm going to go ahead and add the As for your other errors:
I wish the r16 blog post wasn't blocked behind process. Here's the thing I would be pointing you toward: _FILE_OFFSET_BITS=64tl;dr: Don’t set
Support for If you’re targeting a release that does not support the 64-bit off_t variant of a function you are using and have set Note that the 64-bit Finally, since this feature is new to the NDK with unified headers, if you just want to return to the pre-unified headers behavior, all you need to do is stop setting For more information about |
yeah, or -D__USE_FILE_OFFSET64 ... it's not clear to me from the snippet of the failure whether the submitter is building boost or building something that's using boost, and i'm beginning to suspect the latter... |
I'm building boost from the sources (1.60) |
here's how i build boost 1.64 from source: https://gist.github.com/enh/b2dc8e2cbbce7fffffde2135271b10fd |
The origin of the error from boost/libs/filesystem/src/operations.cpp:18:
chaging the file sources/android/support/include/stdio.h from: into: fix the issue |
fixed in master, cherrypick to r16 release: https://android-review.googlesource.com/#/c/platform/ndk/+/479579/ |
will be fixed in r16beta2. |
Not sure if I should open another issue for this. This seems very related (maybe the same issue) so I'll start here. Here's my command line (using CMake):
I'm using android NDK r16b. I'm building boost from the following github repository (which supports building boost using CMake): https://github.com/Orphis/boost-cmake I get the following compiler error:
Is this the same issue? I found this issue by following through a series of other github issues that make these seem connected: |
Forgot to mention @DanAlbert just in case email notifications are turned off for closed issues. Please let me know if I should open a new issue. |
Could we create legacy inlines for I think we're generally trying to avoid having programs access system calls directly, in favor of accessing them via |
@DanAlbert: Sorry to ping you again, I know you're busy. If you get a moment I'd love a response to my earlier post related to the boost filesystem truncate issue. |
@rcdailey your analysis looks correct to me. |
@DanAlbert Based on that confirmation, then why do I still see the issue on r16b? @enh stated it was fixed in r16 beta 2. Where do I go from here? I haven't seen any further progress on this specific issue in months (I guess because everyone believes it to be fixed). I'm not sure where the discrepancy is. Not sure at this point if it's a boost.filesystem issue or an NDK issue. |
@rcdailey: Because unfortunately that's a boost bug, not an NDK bug. |
@DanAlbert Quote from someone in the other thread:
The filesystem issue says it's an NDK bug. The NDK issue says it's a boost bug. Honestly I don't know much about the actual issue or its root cause, but this back and forth can't go on forever can it? Where is the actual issue? |
this is the mistake:
no, it wasn't. in older NDKs, if they want their old behavior back 100%, just don't define |
(commented on the boost bug too.) |
IMO, ndk headers are buggy (all that std::to_string, log2, 64 bit file io fails) that it's difficult to take serious stuff like things like that don't even compile with current latest r16b NDK:
Lots of projects have all kinds of bug reports revolving around these issues and it's not even clear what the definite answer to all those, what all these projects need to do to handle these ndk/android issues and how to make code portable across different versions of NDK versions and api targets. |
That test case works fine if you use a supported STL. We even have a test case to prove it: https://android.googlesource.com/platform/ndk/+/master/tests/build/libcxx_headers_file_offset_bits_64/jni |
This also works if you use a supported STL. The bugs are in the deprecated components, not the NDK headers. |
what is |
Yes. |
In the case I've been linking to over on the boost side, I was using libc++ and it didn't work. Not sure if that's the same case Dan is talking about, though. I still haven't heard the NDK and boost developers come to a consensus on what the root cause of the issue is and where the bug lies. A patch was proposed on the boost side that still blames this on the NDK as a bug on their side, so I'm not sure what the long term resolution is. |
it really comes down to whether the boost folks want to ignore reality or accept it :-) |
Yes, that issue is a boost bug. The test case @pps83 gave is unrelated to that issue. |
With r16b so much code fails to compile, that I'm starting to think that my NDK download was corrupted while downloading :) Just about every library in my project fails to compile. I guess, all of them had bugs?
And just about every project fails with these random erros in std headers, lots of google own projects fail with similar errors. Compile error fest. Is there some magic thing that should have been defined, like |
You seem to have both sets of headers on the compiler search path at the same time. That won't work -- you need to use only a single STL to compile your code. Maybe your project's build system is adding one (or both) of the above directories using |
Bug: android/ndk#501 Test: builds Change-Id: Id658375db5c52f9153c203f011f187dd692facde
i have the same problem [armeabi-v7a] Compile++ thumb: cryptopp <= network.cpp [armeabi-v7a] Compile++ thumb: cryptopp <= rc2.cpp [armeabi-v7a] Compile++ thumb: cryptopp <= seal.cpp [armeabi-v7a] Compile++ thumb: cryptopp <= square.cpp In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/src/posix/fs.cpp:26: In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/include/mega.h:33: In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/include/mega/types.h:45: In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/include/mega/posix/megasys.h:45: /home/john/Android/Ndk/sources/cxx-stl/llvm-libc++/include/fstream:824:9: error: use of undeclared identifier 'fseeko' if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence)) ^ /home/john/Android/Ndk/sources/cxx-stl/llvm-libc++/include/fstream:197:5: note: in instantiation of member function 'std::__ndk1::basic_filebuf >::seekoff' requested here basic_filebuf(); ^ /home/john/Android/Ndk/sources/cxx-stl/llvm-libc++/include/fstream:1019:14: note: in instantiation of member function 'std::__ndk1::basic_filebuf >::basic_filebuf' requested here explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in); ^ /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/src/posix/fs.cpp:1425:14: note: in instantiation of member function 'std::__ndk1::basic_ifstream >::basic_ifstream' requested here ifstream infile(configFile); ^ In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/src/posix/fs.cpp:26: In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/include/mega.h:33: In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/include/mega/types.h:45: In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/include/mega/posix/megasys.h:45: /home/john/Android/Ndk/sources/cxx-stl/llvm-libc++/include/fstream:826:20: error: use of undeclared identifier 'ftello' pos_type __r = ftello(__file_); ^ /home/john/Android/Ndk/sources/cxx-stl/llvm-libc++/include/fstream:842:9: error: use of undeclared identifier 'fseeko' if (fseeko(__file_, __sp, SEEK_SET)) ^ /home/john/Android/Ndk/sources/cxx-stl/llvm-libc++/include/fstream:197:5: note: in instantiation of member function 'std::__ndk1::basic_filebuf >::seekpos' requested here basic_filebuf(); ^ /home/john/Android/Ndk/sources/cxx-stl/llvm-libc++/include/fstream:1019:14: note: in instantiation of member function 'std::__ndk1::basic_filebuf >::basic_filebuf' requested here explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in); ^ /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/src/posix/fs.cpp:1425:14: note: in instantiation of member function 'std::__ndk1::basic_ifstream >::basic_ifstream' requested here ifstream infile(configFile); ^ In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/src/posix/fs.cpp:26: In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/include/mega.h:33: In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/include/mega/types.h:45: In file included from /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/include/mega/posix/megasys.h:45: /home/john/Android/Ndk/sources/cxx-stl/llvm-libc++/include/fstream:906:13: error: use of undeclared identifier 'fseeko' if (fseeko(__file_, -__c, SEEK_CUR)) ^ /home/john/Android/Ndk/sources/cxx-stl/llvm-libc++/include/fstream:197:5: note: in instantiation of member function 'std::__ndk1::basic_filebuf >::sync' requested here basic_filebuf(); ^ /home/john/Android/Ndk/sources/cxx-stl/llvm-libc++/include/fstream:1019:14: note: in instantiation of member function 'std::__ndk1::basic_filebuf >::basic_filebuf' requested here explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in); ^ /home/john/AndroidStudioProjects/android/app/src/main/jni/mega/sdk/src/posix/fs.cpp:1425:14: note: in instantiation of member function 'std::__ndk1::basic_ifstream >::basic_ifstream' requested here ifstream infile(configFile); ^ 4 errors generated. make: *** [/home/john/AndroidStudioProjects/android/app/src/main/obj/local/armeabi-v7a/objs/megasdk/sdk/src/posix/fs.o] Error 1 make: *** Waiting for unfinished jobs.... |
Did you try the fixes mentioned in this bug? |
I personally was able to get past this issue using NDK r17 and the newest version of Boost. Several issues on the boost side were filed, this was a boost bug not an NDK problem from what I could deduce. I think it's fair to close the issue, although the topic has deviated a bit, so I'm not sure which issue we're tracking here anymore. |
Description
With ndk 16.0.4293906 rc1 I now receive this build error:
Environment Details
NDK Version: 16.0.4293906 rc1
Build System: cmake (invoked from ./gradlew)
Host: Mac
Compiler: Clang
ABI: x86_64 and arm64-v8a
SDL: c++_shared
NDK API Level: 21
The text was updated successfully, but these errors were encountered: