用ndk編譯C檔案
阿新 • • 發佈:2018-12-30
#!/bin/sh
OS='linux'
ANDROIDSDK='android-14'
PROGDIR='/home/guohai/dev/android-ndk-r7/'
PROGDIR=`cd $PROGDIR && pwd`
ARMEABIGCC=$PROGDIR/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
ARMEABILIB=$PROGDIR/platforms/$ANDROIDSDK/arch-arm/usr/lib
ARMEABIINC=$PROGDIR/platforms/$ANDROIDSDK/arch-arm/usr/include
ARMEABICRT=$PROGDIR/platforms/$ANDROIDSDK/arch-arm/usr/lib/crtbegin_dynamic.o
LINKER=/system/bin/linker
echo "GCC:"$ARMEABIGCC "LIB:"$ARMEABILIB "LINKER":$LINKER "PARAMS:" [email protected]
$ARMEABIGCC [email protected] -Wl,-rpath-link=$ARMEABILIB,-dynamic-linker=$LINKER -L$ARMEABILIB $ARMEABICRT -I$ARMEABIINC -nostdlib -lc
用法:
agcc smemcap.c -o a-smem
注意,修改 PROGDIR 的路徑