使用zig作为rust的linker
背景
glibc的动态链接库存在版本问题
./hello: /lib64/libc.so.6: version GLIBC_2.28' not found (required by ./hello) ./hello: /lib64/libc.so.6: version
GLIBC_2.33’ not found (required by ./hello)
./hello: /lib64/libc.so.6: version GLIBC_2.18' not found (required by ./hello) ./hello: /lib64/libc.so.6: version
GLIBC_2.32’ not found (required by ./hello)
./hello: /lib64/libc.so.6: version `GLIBC_2.34’ not found (required by ./hello)
我们可以使用zig作为rust的linker使程序链接到低版本的glibc
方法
- 安装zig。下载并解压,设置好PATH
cargo install --locked cargo-zigbuild
cargo zigbuild --release --target=x86_64-unknown-linux-gnu.2.17
这样就能正常链接,并在低版本的glic系统上运行了。
1 |
|
使用zig作为rust的linker
http://grasscube.top/2025/01/29/使用zig作为rust的linker/