编译器x86_64-linux-musl-gcc是用这个工具生成的:
https://github.com/richfelker/musl-cross-make然后用x86_64-linux-musl-gcc在ubuntu上本地编译一个测试程序。
如果不加-static,编译出来的a.out就无法运行,设置LD_LIBRARY_PATH也没用:
LD_LIBRARY_PATH=/opt/cross/lib:/opt/cross/x86_64-linux-musl/lib:$LD_LIBRARY_PATH
加上-static生成全静态的a.out没问题。难道这个编译器只能用来搞全静态链接的ELF?
happy@ubuntu:~$ x86_64-linux-musl-gcc 1.c
happy@ubuntu:~$ ./a.out
bash: ./a.out: No such file or directory
happy@ubuntu:~$ ldd a.out
linux-vdso.so.1 (0x00007ffe51025000)
libc.so => /opt/cross/x86_64-linux-musl/lib/libc.so (0x00007f039b400000)
happy@ubuntu:~$ ls -la a.out
-rwxrwxr-x 1 happy happy 7456 Jan 6 13:38 a.out
--
FROM 222.130.137.*