keystone icon indicating copy to clipboard operation
keystone copied to clipboard

cross compiling for Android but got a wrong architecture

Open uqsme opened this issue 5 years ago • 0 comments

echo $ANDROID_CMAKE # v3.10
/home/tis/Android/Sdk/cmake/3.10.2.4988404/
echo $ANDROID_NDK # r21b
/home/tis/Android/Sdk/ndk/21.3.6528147/
uname -s # under Linux
Linux

I run the following command under the dir "build", and then compile it with make provided by NDK, under the dir "NATIVE":

$ANDROID_CMAKE/bin/cmake .. \
                -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
                -DANDROID_ABI=arm64-v8a \
                -DANDROID_NATIVE_API_LEVEL=21 \
                -DBUILD_SHARED_LIBS=1 \
                -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86;Mips" \
                -DCMAKE_BUILD_TYPE=Release

cd NATIVE/
$ANDROID_NDK/prebuilt/linux-x86_64/bin/make -j16

When the compilation is complete, I check it with the file command and find that it is an incorrect arch it was x86-64 rather than arm64

file '/home/tis/keystone/build/NATIVE/llvm/lib64/libkeystone.so' 
/home/tis/keystone/build/NATIVE/llvm/lib64/libkeystone.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

uqsme avatar Jul 19 '20 08:07 uqsme