Skip to content

Commit

Permalink
fix: add explicit API level definition and PIC flag for NDK compatibi…
Browse files Browse the repository at this point in the history
…lity
  • Loading branch information
whitecostume committed Dec 3, 2024
1 parent 72e440a commit 5c759c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build_arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ NDKTRIPLE=armv7a-linux-androideabi$NDKABI
NDKP=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/
NDKCC=$NDKP/clang
NDKCXX=$NDKP/clang++
NDKF="--sysroot $NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot"
NDKF="--sysroot $NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot -D__ANDROID_API__=$NDKABI"
NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"

make clean
make HOST_CC="gcc -m32" CROSS_CC="$NDKCC -target $NDKTRIPLE" TARGET_SYS=Linux TARGET_FLAGS="$NDKF $NDKARCH"
make HOST_CC="gcc -m32" CROSS_CC="$NDKCC -target $NDKTRIPLE" TARGET_SYS=Linux TARGET_FLAGS="$NDKF $NDKARCH" TARGET_CFLAGS="-fPIC"
cp ./libluajit.a ../../android/jni/libluajit.a
make clean

Expand Down
4 changes: 2 additions & 2 deletions build_arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ NDKTRIPLE=aarch64-linux-android$NDKABI
NDKP=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/
NDKCC=$NDKP/clang
NDKCXX=$NDKP/clang++
NDKF="--sysroot $NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot"
NDKF="--sysroot $NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot -D__ANDROID_API__=$NDKABI"
NDKARCH="-DLJ_ABI_SOFTFP=0 -DLJ_ARCH_HASFPU=1"

make clean
make HOST_CC="gcc -m64" CROSS_CC="$NDKCC -target $NDKTRIPLE" TARGET_SYS=Linux TARGET_FLAGS="$NDKF $NDKARCH"
make HOST_CC="gcc -m64" CROSS_CC="$NDKCC -target $NDKTRIPLE" TARGET_SYS=Linux TARGET_FLAGS="$NDKF $NDKARCH" TARGET_CFLAGS="-fPIC"
cp ./libluajit.a ../../android/jni/libluajit.a
make clean

Expand Down

0 comments on commit 5c759c9

Please sign in to comment.