1



I have code base written in C++. Build system uses Android's ndk-build script with makefiles defined for shared lib and executable. Binary runs on Android device.

My Question is: is there possibility to use current build configuration and build this executable to run on my local host e.g. Ubuntu?
I tried (with simple example as "hello world") with ABI change to x86_64 but this doesn't work. Executable file uses dynamic linker from Android' environment.

Do you have any idea how to setup this?

2
  • 1
    Possible duplicate of How do I build a native (command line) executable to run on Android?
    – user6359267
    Oct 13, 2016 at 11:25
  • the problem you will have is with the dynamic link against the android libs. IIRC the android environment does not support the full standard libs and in any case they will be a different version. Your best bet is to add a second build step targeting linux. You will also need to do some googling to see which c/c++ features are available on a given android version. I've been caught out by that. My code ran on 4.1, 4.3, 5, and 6. but crashed on 4.0.
    – jhbh
    Oct 13, 2016 at 11:32

1 Answer 1

0

Not with the same build system. ndk-build can only build Android binaries.

If you migrate your build to another system (make, cmake, whatever) then your code might work. If the only pieces of the NDK you're using are libc/libm/libdl, then it should work (although there are a few Android extensions in libc and libdl). If you're relying on any of the Android framework libraries then it won't work because those don't exist on an Ubuntu system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.