Android NDK compile c++ module
#1
Hello guys, once more i need your help!
After many tries, i succefully built my module for windows/linux os using pybind11.

Now it's time to port my lib to android!! And here's the pain... Again!!
Reading some documentation, i found a good tutorial, (i think someone of you, should knows it very well)!!
So i tried with ndk-build from android-ndk(r16), but i got a ton of errors.

In my jni folder i created Android.mk and Application.mk

Running ndk-build command from jni folder, i get ndk.log

Relevant part (at least for what i understood!):
Code:

/opt/android-ndk/sysroot/usr/include/signal.h:96:18: error: expected ';' at end of declaration list
 sighandler_t sa_handler;

What i can see, it's __LP64__ is defined in signal.h import, but it shouldn't, since my build target should be armeabi-v7a.
I think i'm am missing something...
Do you think i am using the right approach? Or there's something better to compile c++ libs?

Thank you again in advance! And... as always if you need more infos, just ask!
Reply
#2
This error is not familiar to me. Try to google it and maybe you'll find something useful.

I experimented with building binary Python modules for Android a while ago and shared my experience in my blog that you linked. However, it is known that in some recent Android builds (including the recent firmware for my Samsung tablet) the magic workaround for importing Python binary modules no longer works. So even if you manage to compile the module correctly, there's absolutely no guarantee that it will work.
Reply
#3
Hi @Roman_V_M, thanks for your reply!
I Already serached for this error but i didn't find anything useful about that. Btw can you confirm what i was doing to compile it is right?
Reply
#4
Have you seen this link: https://github.com/timwr/CVE-2016-5195/issues/5 ? Also, in my experiments I used CrystaX NDK that is an alternative Android NDK implementation.
 
(2018-04-07, 19:05)thepasto Wrote: Btw can you confirm what i was doing to compile it is right?

My honest advice is to forget about binary modules on Android. I experimented a while ago when I had my Acer tablet with Android 4 ICS, and now all those recipes no longer work on my Samsung with Android 7.0 Nougat. So for me all this experience has only historical value. And even if you manage to make it work somehow, there's no guarantee that the next OTA firmware update won't break everything. Python is a foreign citizen on Android and nothing you can do about that.
Reply
#5
I found below docker quite usefull for cross compiling.

https://github.com/dockcross/dockcross/t...ndroid-arm

however when i had done cross compiling for ndk, i had shamelesly modified distutils to find correct compiler, linker and dynamic libs etc..
Reply

Logout Mark Read Team Forum Stats Members Help
Android NDK compile c++ module0