libosmocore no longer builds with Android NDK
When building libosmocore with the Android NDK, it fails complaining about this line (103) in src/gsm/gsm_utils.c:
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2,25)
This code doesn't work as intended -- if __GLIBC_PREREQ isn't defined, then the preprocessor will be unable to parse that expression.
I've attached a suggested fix which breaks up this check into multiple lines.
Thank you for the patch. Right now we're using gerrit for code review and patch submission as described in here:
If you by any chance have some time - please submit it via gerrit (I recommend using git-review for convenience) otherwise I (or someone else) will take care of that but it might take somewhat longer.
Out of curiosity, could you share any details on your project? It's the first time I hear about anyone using libosmocore on Android. Would be cool to add this use-case to our CI setup to prevent this from reoccurring but that's a subject for another ticket of course.
I've submitted the change to gerrit: https://gerrit.osmocom.org/#/c/libosmocore/+/13209/
We are working on releasing an app called SeaGlass that uses cell_log and a OsmocomBB-compatible phone connected via USB OTG to scan for suspicious and rogue cell sites. Initially we ran osmocon as well, but that required a USB serial driver to be baked into the kernel as well as permissions set to access the device. We ended up rewriting some of the osmocon and USB driver functionality in Java (before we realized that Android's unix socket and USB APIs were somewhat lacking) so that we could access the USB port directly on unmodified phones.
The source code for that project is available here: https://github.com/seaglass-project/seaglass-app
As for whether Android should be supported and tested, that sounds like a policy question. The comments in gsm_utils.c seems to suggest that eventually glibc 2.25+ will become a requirement.
- Status changed from New to In Progress
- % Done changed from 0 to 50
The comments in gsm_utils.c seems to suggest that eventually glibc 2.25+ will become a requirement.
Let me clarify this since I was the one who wrote it initially: the part of the code in question deals with random id generation. We either make it via getrandom (1), via GnuTLS (2) or fallback to insecure random (3).
Option (1) requires GNU/Linux kernel and glibc which support getrandom. However, there's a trick which let's you use it when your kernel have getrandom implemented but glibc does not support it (it took quite some time for getrandom support to land in glibc). So the comment you're referring too is about that specific workaround for one particular option which indeed should be dropped once odd combination of kernel supporting getrandom with glibc not supporting it would become oddball instead of mainstream (which was the case when this code was merged).
The libosmocore however is also intended to be used in OsmocomBB (which ATM uses it's own copy of libosmocore because nobody had time yet to port it to master version) via '--enable-embedded' configure option which builds it without glibc.
To summarize, I don't think we'll have any glibc version as a strict dependency of libosmocore so Android SDK is a viable option in foreseeable future.