简体   繁体   中英

How to build host static library with Android NDK?

I'm trying to build android adb tool from the sources . Since file Android.mk is presented i'm running ndk-build tool to build it. But unfortunately i'm having following errors:

/Users/user/Documents/dev/tmp/adb/jni/Android.mk:95: /softdev/android-ndk-r10c/build/core/build-host-static-library.mk: No such file or directory
/Users/user/Documents/dev/tmp/adb/jni/Android.mk:183: /softdev/android-ndk-r10c/build/core/build-host-executable.mk: No such file or directory
Android NDK: Trying to define local module 'adbd' in /Users/user/Documents/dev/tmp/adb/jni/Android.mk.    
Android NDK: But this module was already defined by /Users/user/Documents/dev/tmp/adb/jni/Android.mk.    
/softdev/android-ndk-r10c/build/core/build-module.mk:34: *** Android NDK: Aborting.    .  Stop.

I've checked files ( build-host-*-*.mk ) are absent for some reason. I've found them in someone's git repo , but it's for windows. After copying build-host-*-*.mk to my local ndk folder i'm getting another errors:

Android NDK: /Users/user/Documents/dev/tmp/adb/jni/Android.mk:adb: Unknown LOCAL_MODULE_CLASS value: HOST_STATIC_LIBRARY    
/softdev/android-ndk-r10c/build/core/build-module.mk:29: *** Android NDK: Aborting    .  Stop.

So it seems that just copying that files is not enough. How can i make it built?

adb is a host tool (which runs on your PC rather than on the Android device), and NDK has no support for building host executables. It does provide some stubs but the feature was never fully implemented.

The git repo you are linking to is not the official NDK r7b but a patched version with host target support added. This includes a bit more than just a single file – see the full diff here .

You will need to apply this patch (or copy all the scripts which were modified) to your local NDK setup. If you are running an NDK version other than r7b, you may have to make some additional modifications.

See also my question , in which I basically ran into the same issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM