开发者

Compile native c binaries for Android - Eg: dosfsck

I am trying to compile the binary dosfsck and mkdosfs for Android, using Linux and Android NDK and SDK. I've setup NDK and SDK properly, the path to the NDK gcc is in my path. I've also downloaded the correct SDK for my device (HTC Desire).

I first tried compiling the file with a simple make:

make CROSS_COMPILE=/home/droidzone/android/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc

I need to be able to run the binary fr开发者_高级运维om my device. As it is, the app compiles and runs on Ubuntu, but not my device. I get the error message from sh: Cannot run binary

Could someone please explain how I can link libraries, where I should get them from (within the SDK) and what changes if any to make to the Makefile, and the final syntax to compile this properly for Android


I found this was easiest to do using the agcc script script which you can use by exporting CC=agcc. Lots of projects will not properly support CROSS_COMPILE as you have tried. The agcc script is oriented around using the Android build tree files so I modified it to use the NDK tools. With this you should be able to build most things using make CC=agcc or CC=agcc ./configure

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜