Android cross compiling C with no configure file -
i've started cross compile couple of c applications android. i've done image conversion software using following pseudo-instructions:
- build android toolchain
- compile automake , autoconf
- set cc , cxx environment variables
- build source package (delete configure, configure.sub, configure.guess, run
autoconf configure.ac > configure, run configure cflags using arm-linux-androideabi, make , make install)
i trying ocr library written in c. problem running library has no configure, configure.guess, or configure.sub. has makefile.
i not familiar c, there different process should following in situation?
the ./configure step:
cflags=’-march=armv7-a –mfloat-abi=softfp’ ./configure –prefix=/home/user/downloads/install/usr/local –host=arm-eabi –enable-shared=no –with-modules --enable-delegate-build
is there different process should following in situation?
not really. mean, if plan work android standalone toolchain, need is:
- create toolchain ad hoc target, e.g
--platform=android-9 - add toolchain directory
path(for convenience) - export sysroot path, e.g.
export sysroot=/tmp/my-android-toolchain/sysroot(for convenience) - set c compiler (
export cc="arm-linux-androideabi-gcc --sysroot $sysroot") , archiver, if target static library (export ar=arm-linux-androideabi-ar)
then depends how makefile has been written, i.e targets? influential environment variables? etc. in practice, if default target fits need, need run make while overriding c flags set target architecture (armv7 here):
make cflags="-march=armv7-a" that's it. repeat other archs (armeabi, x86, etc) if needed.
you can see complete example jsmn - lightweight json parse written in c, here: http://git.io/ndk-jsmn.
i've set of slides cover topic may find useful.
Comments
Post a Comment