[CDRIVER-2407] Android NDK support Created: 25/Nov/17 Updated: 28/Oct/23 Resolved: 05/Dec/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | cmake, libbson |
| Affects Version/s: | 1.8.2 |
| Fix Version/s: | 1.9.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Jean-Marc Le Roux | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | feature | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Android NDK r13b+ |
||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Description |
|
libbson doesn't build with clang from the Android NDK r13b because of the missing `rand_r` symbol. How to reproduce
Fails with error:
FixWorking fix available here: https://github.com/aerys/libbson/tree/fix/android-undefined-rand_r |
| Comments |
| Comment by A. Jesse Jiryu Davis [ 05/Dec/17 ] | |||||||||||||
|
I'm marking this fixed. We'll release these changes in libbson 1.9.0 within the next few days. Let me know if there's any further changes required for Android. | |||||||||||||
| Comment by Githook User [ 05/Dec/17 ] | |||||||||||||
|
Author: {'username': 'ajdavis', 'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis'}Message: | |||||||||||||
| Comment by Jean-Marc Le Roux [ 04/Dec/17 ] | |||||||||||||
|
Jean-Marc, here's a branch that renames libbson's own gettid implementation to "bson_gettid", let me know if this works for you: It builds fine with the Android NDK. | |||||||||||||
| Comment by A. Jesse Jiryu Davis [ 04/Dec/17 ] | |||||||||||||
|
Jean-Marc, here's a branch that renames libbson's own gettid implementation to "bson_gettid", let me know if this works for you: | |||||||||||||
| Comment by Githook User [ 26/Nov/17 ] | |||||||||||||
|
Author: {'name': 'Jean-Marc Le Roux', 'username': 'promethe42', 'email': 'jeanmarc.leroux@aerys.in'}Message: | |||||||||||||
| Comment by Githook User [ 26/Nov/17 ] | |||||||||||||
|
Author: {'name': 'Jean-Marc Le Roux', 'username': 'promethe42', 'email': 'jeanmarc.leroux@aerys.in'}Message: | |||||||||||||
| Comment by A. Jesse Jiryu Davis [ 26/Nov/17 ] | |||||||||||||
|
Great, I’ll look again when I’m at my computer. I think our time with Autotools is coming to an end and it’s ok not to add Android support there. I think we shouldn’t have named our own function, gettid, it should be bson_gettid and it should have a consistent declaration. | |||||||||||||
| Comment by Jean-Marc Le Roux [ 25/Nov/17 ] | |||||||||||||
|
I followed the `OR APPLE` existing code here: https://github.com/mongodb/libbson/blob/master/CMakeLists.txt#L138 PR is here: https://github.com/mongodb/libbson/pull/210 Fix is specific to CMake. But I don't know how to cross-compile to Android with autotools. | |||||||||||||
| Comment by Jean-Marc Le Roux [ 25/Nov/17 ] | |||||||||||||
|
Removing the `static` qualifier for `gettid()` is not enough: clang still complains because `gettid()` is declared as :
Are those supposed to be the same `gettid()` ? | |||||||||||||
| Comment by Jean-Marc Le Roux [ 25/Nov/17 ] | |||||||||||||
|
New PR here for the same `rand_r` issues in the tests : https://github.com/mongodb/libbson/pull/209 Another issue now with Android NDK r16 is this one :
Problematic code is in bson-context.c: https://github.com/mongodb/libbson/blob/master/src/bson/bson-context.c#L50
| |||||||||||||
| Comment by A. Jesse Jiryu Davis [ 25/Nov/17 ] | |||||||||||||
|
I've merged the PR, which uses "rand" on Android where "rand_r" is unavailable. Jean-Marc is investigating if we need additional changes to handle BSON_HAVE_SYSCALL_TID properly. | |||||||||||||
| Comment by Jean-Marc Le Roux [ 25/Nov/17 ] | |||||||||||||
|
Here you go: https://github.com/mongodb/libbson/pull/208 | |||||||||||||
| Comment by A. Jesse Jiryu Davis [ 25/Nov/17 ] | |||||||||||||
|
Thanks, would you like to submit a pull request? |