问题描述
我想为 startfile
指定GCC的搜索目录,并 endfile
: crt1.o
, crti.o
和 crtn.o
.在命令行上将 -B
传递给GCC驱动程序可以工作,但是不方便.如何修改规格文件( lib/gcc/x86_64-unknown-linux-gnu/4.9.2/specs
)指定 startfile
?
I'd like to specify GCC's search directory for the startfile
andendfile
: crt1.o
, crti.o
and crtn.o
. Passing -B
on the command line tothe GCC driver works, but is inconvenient. How do I modify the specsfile (lib/gcc/x86_64-unknown-linux-gnu/4.9.2/specs
) to specify the search path for startfile
?
我尝试在 startfile
规范中添加 -B
选项,但出现错误: ld:无法识别的选项'-B/gsc/btl/linuxbrew/lib'
I tried adding the -B
option to the startfile
spec and got the error:ld: unrecognized option '-B/gsc/btl/linuxbrew/lib'
然后我尝试将 -B
选项添加到 cc1
规范中,并得到错误消息: cc1:错误:命令行选项'-B/gsc/btl/linuxbrew/lib'有效对于驱动程序,但不适用于C
I then tried adding the -B
option to the cc1
spec and got the error:cc1: error: command line option '-B/gsc/btl/linuxbrew/lib' is validfor the driver but not for C
如果无法通过 specs
文件执行此操作,那么GCC是否有可以实现相同目标的环境变量或configure选项?
If it's not possible to do this via the specs
file, is there an environment variable or a configure option to GCC that accomplishes the same goal?
我在主目录中安装了最新版本的 glibc
.一切都很好.我已经修改了 specs
文件以链接到 glibc
的新版本,但是它仍然链接到/usr
中的旧系统版本. startfile
和 endfile
.
I've installed a recent version of glibc
in my home directory. Everything's working great. I've modified the specs
file to link against the new version of glibc
, but it's still linking against the old system version in /usr
of startfile
and endfile
.
以下是未解决的问题code> gcc-help 邮件列表.这是一个与Linuxbrew有关的错误, gfortran已被独立的Linuxbrew破坏,并提出了修复建议, gcc,binutils:链接到Cellar而不是系统库.
Here's a the unanswered question on the gcc-help
mailing list. Here's a related Linuxbrew bug, gfortran is broken with stand alone Linuxbrew, and a proposed fix, gcc, binutils: link to Cellar instead of system libs.
谢谢,
肖恩
推荐答案
您可以在规范的 * startfile:
和 * endfile:
部分中使用绝对路径文件,而不是默认的相对路径.这将覆盖GCC选择的默认位置.
You can use an absolute path in the *startfile:
and *endfile:
sections in the specs file, instead of the default relative paths. This will override GCC's choice of the default location.
这篇关于如何更改GCC的crti.o默认搜索目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!