开发者

Compile native c binaries for Android - Eg: dosfsck

开发者 https://www.devze.com 2023-04-06 14:37 出处:网络
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 t

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

精彩评论

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