Open xiongyihui opened 1 year ago
check debian version cat /etc/issue
下载 linaro 的gcc工具链或llvm工具链要注意 libc 的版本:
llvm 不同的版本是基于不同的系统构建的,比如:
在 x86 上用 clang 编译 aarch64 应用
CLANG_HOME=/path/to/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-16.04
# CLANG_HOME=/path/to/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04
GCC_HOME=/path/to/aarch64-buildroot-linux-gnu_sdk-buildroot
SYSROOT=${GCC_HOME}/aarch64-buildroot-linux-gnu/sysroot
CC=${CLANG_HOME}/bin/clang
${CC} --target=aarch64-buildroot-linux-gnu --gcc-toolchain=${GCC_HOME} --sysroot=${SYSROOT} -fuse-ld=lld -o hello hello.c -v
Run
ls -lah /lib/x86_64-linux-gnu/libc.so.6
ubuntu 16.04: libc-2.23.so
ubuntu 20.04: libc-2.31.so
debian 11 (aarch64): libc-2.31.so