当前位置: 首页 > 工具软件 > OpenFst > 使用案例 >

android 编译 openfst openblas arm64

倪鹏
2023-12-01

android 编译 openfst openblas arm64

1  ubuntu 下载 android-ndk-r21b-linux-x86_64.zip

2 下载Openblas-develop 和 openfst-1.6.7

cd  / home/android-ndk-r21b/build/tools

python make_standalone_toolchain.py --arch arm64 --api 23 --stl=libc++ --install-dir /tmp/my-android-toolchain


export PATH=/tmp/my-android-toolchain/bin:$PATH

cd openfst-1.6.7

CXX=clang++ ./configure --prefix=`pwd` --enable-static --enable-shared  --enable-ngram-fsts --host=aarch64-linux-android LIBS="-ldl"

make -j 4

make install

cd OpenBLAS

根据官网编译 https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android   Build ARMV8 with clang

# Set path to ndk-bundle
export NDK_BUNDLE_DIR=/home/android-ndk-r21

# Export PATH to contain directories of clang and aarch64-linux-android-* utilities
export PATH=${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/:${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH

# Setup LDFLAGS so that loader can find libgcc and pass -lm for sqrt
export LDFLAGS="-L${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x -lm"

# Setup the clang cross compile options
export CLANG_FLAGS="-target aarch64-linux-android --sysroot ${NDK_BUNDLE_DIR}/platforms/android-23/arch-arm64 -gcc-toolchain ${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/"

# Compile
make TARGET=ARMV8 ONLY_CBLAS=1 AR=ar CC="clang ${CLANG_FLAGS}" HOSTCC=gcc -j4

 会出现找不到 一些头文如 stdio.h , 将/ home/android-ndk-r21b/ 目录的 sysroot/usr 的include 对应拷贝到 ${NDK_BUNDLE_DIR}/platforms/android-23/arch-arm64/usr

 类似资料: