-
Notifications
You must be signed in to change notification settings - Fork 266
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
Broken feature detection with unified headers #332
Comments
for the POSIX* stuff, does boost do the right thing and fall back to sysconf if we leave them undefined (since deleting these lines would be the quick fix)? i'm assuming not. the sqlite one doesn't make sense. did you copy & paste the wrong section of the file? |
@jmgao: think you could use the versioner to apply guards to all the sysconf stuff? |
Don't think so, this probably has to be annotated by hand. |
I'm guessing no volunteers for that... |
@enh updated the description to include links to relevant code. If those macros are undefined, the features won't be used even if they are available for the API level. Regarding sqlite3, it just assumes that sys/mman.h:
And in my case I think I happen to have |
Ah, so same problem as we had in #324 for |
Without this, setting `__USE_FILE_OFFSET64` and targeting pre-L made mmap entirely unavailable. Test: make checkbuild Bug: android/ndk#332 Change-Id: I9f61c44f8d9ab5c7cae845c9f89a7d889c6df365
https://android-review.googlesource.com/355702 should fix these and others. |
Bug: android/ndk#332 Test: builds Change-Id: I249c214d34244a1149ba6b1160e8eafc2cdbcdea
I'm also having an error building SQLite in SQLiteCpp. Not sure if it's the same issue, or if I should open another issue.
Environment Details NDK Version: 14.0.3770861 |
@4brunu, looks the same, you are missing |
Just a heads up: this is going to be in r15 but won't be in beta 1. We've got a bunch of new code in the headers (better |
r16 - Remove deprecated headers <- Does this imply that the specific |
@Zingam yes, the duplicated headers will be removed as soon as we can get folks switched over to the up-to-date unified headers (which are basically the same headers we use to build the OS itself). |
FWIW, we build SQlite3 adding |
We had several bugs filed saying "if I set _FILE_OFFSET_BITS=64 when targeting an API < L, various functions are missing". Instead of saying "yes, they are", we quietly just modified the header files to expose the non-64-bit variants. This makes no sense. We can't just say "oh, yeah, we don't have a version of this function that agrees with your calling code about how large off_t is, but here's a version that doesn't: I'm sure it'll be fine". _FILE_OFFSET_BITS=64 on Android LP32 has always been a game of chance, but that game should be "are all the functions my code needs available at compile time?", not "will my code actually work at run time?". Bug: android/ndk#449 Bug: android/ndk#442 Bug: android/ndk#333 Bug: android/ndk#332 Bug: android/ndk#324 Test: builds Change-Id: Ib095251d3e21e77ed50cc3575388107fecec4ecd
@alexcohn , how Adding -D_FILE_OFFSET_BITS=32 solves the issue ? This solution is working but how ? |
he means it fixes "missing mmap" problems, because there was a 32-bit |
updated to NDK 16 release today and got this in sqlite.c: sqlite3.c:27147:14: error: call to 'mmap' declared with attribute error: mmap is not available with _FILE_OFFSET_BITS=64 when using GCC until android-21. Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or switch to Clang. solved by adding #ifdef __ANDROID__ #define SQLITE_DISABLE_LFS #endif to head of sqlite.c. |
switching to clang would be a better choice. we're removing GCC in r18, so the sooner you switch the better. (we might want to change the error message to just say "switch to clang"...) |
Without this, setting `__USE_FILE_OFFSET64` and targeting pre-L made mmap entirely unavailable. Test: make checkbuild Bug: android/ndk#332 Change-Id: I9f61c44f8d9ab5c7cae845c9f89a7d889c6df365
We had several bugs filed saying "if I set _FILE_OFFSET_BITS=64 when targeting an API < L, various functions are missing". Instead of saying "yes, they are", we quietly just modified the header files to expose the non-64-bit variants. This makes no sense. We can't just say "oh, yeah, we don't have a version of this function that agrees with your calling code about how large off_t is, but here's a version that doesn't: I'm sure it'll be fine". _FILE_OFFSET_BITS=64 on Android LP32 has always been a game of chance, but that game should be "are all the functions my code needs available at compile time?", not "will my code actually work at run time?". Bug: android/ndk#442 Bug: android/ndk#333 Bug: android/ndk#332 Bug: android/ndk#324 Test: builds Change-Id: Ib095251d3e21e77ed50cc3575388107fecec4ecd
Description
I've encountered a couple of issues with unified headers in r14 that I didn't see using r13b.
Boost Log
Missing:
pthread_spin_init
Detection:
#if defined(_POSIX_SPIN_LOCKS) && _POSIX_SPIN_LOCKS > 0
Code: https://github.com/boostorg/log/blob/boost-1.58.0/include/boost/log/detail/spin_mutex.hpp#L198
Available in API >= 24
Boost Thread
Missing:
pthread_mutex_timedlock
Detection:
#if _POSIX_TIMEOUTS >= 0 && _POSIX_TIMEOUTS>=200112L
Code: https://github.com/boostorg/thread/blob/develop/include/boost/thread/pthread/mutex.hpp#L251
Available in API >= 21
Sqlite3
Missing:
mmap
Detection:
Available in API >= 21
Environment Details
The text was updated successfully, but these errors were encountered: