xiongyihui / notes

Notes
https://xiongyihui.github.io/notes/
3 stars 0 forks source link

libc版本 #35

Open xiongyihui opened 1 year ago

xiongyihui commented 1 year ago

Run ls -lah /lib/x86_64-linux-gnu/libc.so.6

xiongyihui commented 1 year ago

check debian version cat /etc/issue

xiongyihui commented 1 year ago

下载 linaro 的gcc工具链或llvm工具链要注意 libc 的版本:

image

llvm 不同的版本是基于不同的系统构建的,比如:

image

xiongyihui commented 1 year ago

在 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