I tried to build LuaJIT with Android NDK as the official guide. But some problems happened. I have search for 2 days but can't solve them.
Here's my build.sh:
NDK=/opt/android/ndk
NDKABI=14
NDKVER=$NDK/toolchains/arm-linux-androideabi-4.9
NDKP=$NDKVER/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"
make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF $NDKARCH"
I'm sure the NDK path is correct and has be added to the environment variables. Also, the build.sh
is in the correct place. And gcc has be installed. When I run the build.sh
, some errors happened:
==== Building LuaJIT 2.0.5 ====
make -C src
gcc: Command not found/bin/arm-linux-androideabi-
make[1]: Entering directory `/root/LuaJIT-2.0.5/src'
gcc: Command not found/bin/arm-linux-androideabi-
gcc: Command not found/bin/arm-linux-androideabi-
gcc: Command not found/bin/arm-linux-androideabi-
gcc: Command not found/bin/arm-linux-androideabi-
gcc: Command not found/bin/arm-linux-androideabi-
Makefile:254: *** Unsupported target architecture. Stop.
make[1]: Leaving directory `/root/LuaJIT-2.0.5/src'
make: *** [default] Error 2
I have try my best but have no idea. Please help me, thanks.
I have solved it. Looks like the error caused by the variable reference. I just tried to write all the parameters in one line and it worked.
make HOST_CC="gcc -m32" CROSS=/opt/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- TARGET_FLAGS="--sysroot=/opt/android/ndk/platforms/android-14/arch-arm -march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"
I'm not very good at shell so I don't know how to use variables even now. Fortunately, I have built the LuaJIT successfully.