-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
clang predefines a wrong __ANDROID_API__ #6176
Comments
That's intended behavior for now. Since all packages are built with API 24, clang will specify API 24 as well - hardcoded in headers. Also this seems like a duplicate of #2469. |
Please, please reconsider. This is crucially incompatible with a typical build process by using
I know the packages are built with API 24. But I think you don't use Termux's clang to build Termux packages. So, it is irrelevant. Clang in Termux should respect the device version instead of the package's. Or, please predefine nothing. If so, I can work around the issue by manually specifying the device version as follows.
|
The recent Termux's clang predefines `__ANDROID_API__` as a fixed number 24. However, when it is lower to the current device version, some functions that "configure" detemines available are not declared correctly in the header files. This change forces to overwrite the predefined `__ANDROID_API__` macro with the current device version. ref: termux/termux-packages#6176
I've thought of the following workaround to force to overwrite the predefined macro without a warning, and pushed it to Ruby's configure. (Just FYI, the next major version of Ruby, 3.0.0, will be released tomorrow.)
If this issue is not fixed, I believe many OSS developers have to use this kind of dirty hack if they want to build on Termux. |
Problem description
The recent Termux's clang seems to define a
__ANDROID_API__
macro as24
by default, even though my Android version is 9.Because many header files are using
__ANDROID_API__
to determine whether a function prototype is declared or not, this mismatch makes it impossible to build some OSS packages. For example, I cannot build ruby.lutimes
is declared only#if __ANDROID_API__ >= 26
in /data/data/com.termux/files/usr/include/sys/time.h.Steps to reproduce
Expected behavior
Or, nothing defined by default is better than the wrong version.
Additional information
The text was updated successfully, but these errors were encountered: