静态链接gcc

问题描述 投票:1回答:1

是否有任何方法来构建静态链接的gcc编译器?如果是,我应该使用configure / make的哪些标志?我希望获得gcc和g ++二进制文件,这些文件应该是“不是动态可执行文件”(例如,在使用ldd工具检查时)。

linux gcc makefile configure
1个回答
0
投票

禁用所有共享选项是一个良好的开端。然后用例如可以使用--with-stage1-ldflags--with-boot-ldflags来设置链接标志以静态链接。 - 一些程序员老兄

有效!这里使用配置标志:

../configure --prefix=/home/myuser/soft/gcc-6.2.0/myusr/ --enable-multilib --enable-languages=c,c++ --disable-shared --disable-host-shared --with-boot-ldflags=-static --with-stage1-ldflags=-static

- AccumPlus

© www.soinside.com 2019 - 2024. All rights reserved.