-
Notifications
You must be signed in to change notification settings - Fork 42
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
How do you force the build to set __ANDROID_API__ to something like 19. It defaults to 10000 #16
Comments
libboost_thread has some posix calls that are not defined before api 21 e.g.: |
I presume you mean the ndk platform (api) version as in Boost-for-Android builds boost with (ndk) api level 16 (by default). Which is the lowest version currently shipped with googles ndk. See You can change this if you want but it has the lowest possible value because (in contrast to the java api) binaries compiled with a lower version are
I can't confirm. This file just seems to have some checks as to whether the API_LEVEL is greater than 21 |
Not quite. This is not about the platforms, it's about controlling boost so that the code that calls posix pthreads doesn't get compiled in so the boost libs will work on the older OS's. The LOWEST_ND_API_LEVEL doesn't change the default ANDROID_API setting which is what the boost libs and the code in the ndk sysroots are basing their behavior off of. This is a pointer to the pull request in boost that fixed it as well as the boost issue: So, What I need is to set the ANDROID_API define. I could probably just pass it in as a cxxflag -D__ANDROID_API__=19 if I could get jam to do so, but I am not conversant enough with jam to know how to yet. I think I used to be able to set this in the .mk files. |
So you are targeting api 16. (The boost binaries thus built should work on any device with api >= 16). The patch should fix the issue with Is something actually not working for you? |
Yes, something is broken. Namely if I try to load libbosst_thread.so on a KitKat 4.4 system I get an exception because it still has pthread_condattr_setclock in the library and the OS (4.4) does not provide it. If I force the boost/thread/detail/config.hpp header file to dump the value of ANDROID_API using a stringify approach it shows ANDROID_API is set to 10000 (ANDROID_API_FUTURE) when this file gets preprocessed. I'm assuming this is due to the android unified headers change which means that the platform/android-16 isn't setting the ANDROID_API level as far as I can tell. see https://android-review.googlesource.com/c/platform/ndk/+/239934 If I call b2 in build-boost.sh with the additional line”
then my ANDROID_API stringify message comes out as 19 and libbosst_thread.so loads. I’m still in the process of determining if I’ve got full functionality. I tried modifying the project-config.jam but that didn’t work well for me given my very limited understanding of jam. This pre api 21 issue also applies to boost::filesystem, see: I was hoping there was a clean way to force api 19 on the 32 bit libraries and leave the 64 bit libraries as is. This is because the support for 64 bit cpu’s came in in 5.0 |
Seems like the build should define
I take it everything is working fine since you defined it manually? |
I just managed to do a full test on a 4.4.4 device and all seems well if I define the ANDROID_API=19. I have a commit in progress that allows you to set defines in doIt.sh and I have build_boost.sh takes in the list of defines as a command line argument. Similar to how you deal with ABIs. I'll try to submit the PR tomoro for comments. |
OK. Thanks. Please use the "dev" branch |
PR done. |
bump? |
Sorry for the late reply. Thanks for the pull request which has been merged. Even though its nice to be able to add defines like this, it does come at the cost of adding complexity to the interface, and I don't really see an application apart from defining ANDROID_API. And for ANDROID_API I think its not an ideal solution. |
Hmm, I see your point. Looking into the boost code there are only 2 breakpoints for the ANDROID_API: ANDROID_API= MAX(LOWEST_NDK_API_LEVEL,21 ) (right now it just sets it to 21. This would make the LOWEST_NDK_API_LEVEL actually work for lower levels and you could actually force boost filesystems to be 64 bit compatible as well if you want to. This seems cleaner to me and I'd be happy to do another PR if you agree with this approach. Please let me know if you like it or have a better suggestion :). |
Thanks for looking into that and well spotted. set
where and pass the Also test everything to see that the resulting boost binaries are working as expected If you want to do this and create a pull request to the dev branch that would be great. |
Do you mean '>24' ? |
Yes, defining it manually stops the missing symbol crash on old android
os's and it is running fine.
So, Should I go ahead with the approach of setting __ANDROID_API__ based
on LOWEST_NDK_API_LEVEL?
…-b
On Wed, Jan 23, 2019 at 3:01 PM Declan ***@***.***> wrote:
Seems like the build should define __ANDROID_API__
See here](android/ndk#407 (comment)
<android/ndk#407 (comment)>).
A standard android studio project (like the test app
<https://github.com/dec1/Boost-for-Android/tree/master/example_app>) has
this set, but as you say when building boost with Boost-for-Android its not.
I take it everything is working fine since you defined it manually?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#16 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACkxjaABcnBOioekR1aeDVpjzvtsiUYIks5vGOmtgaJpZM4aNZ9t>
.
|
You seem to not have read my messages above? |
You are correct, I missed some messages since I was reading the responses on my phone email... which worked poorly. I will go ahead and make a PR against dev sometime over the next few days doing what we outlined above. The "< 24 " part is just how the boost code is set up. It's not something we would need to deal with. Basically, if you set the ANDROID_API to 24 or more you get some additional 64 bit filesystem capabilities. Otherwise, they are not supported. I'll add a comment next to where you set the LOWEST_NDK_API_LEVEL so people know what they are picking between. |
Great. Thanks.
… On March 12, 2019 at 3:26 PM bavery22 ***@***.***> wrote:
You are correct, I missed some messages since I was reading the responses on my phone email... which worked poorly.
I will go ahead and make a PR against dev sometime over the next few days doing what we outlined above.
The "< 24 " part is just how the boost code is set up. It's not something we would need to deal with. Basically, if you set the ANDROID_API to 24 or more you get some additional 64 bit filesystem capabilities. Otherwise, they are not supported. I'll add a comment next to where you set the LOWEST_NDK_API_LEVEL so people know what they are picking between.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub #16 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/AFr8fSmcVaok7n81s7OiakdOBWA6p8IFks5vV8dDgaJpZM4aNZ9t .
|
Hello. Ive implemented this (defined Thanks in Advance |
No description provided.
The text was updated successfully, but these errors were encountered: