如何设置 gcc 4.3 默认规格文件?

发布于 2024-11-03 11:58:43 字数 797 浏览 1 评论 0原文

使用 gcc 版本 4.3.2 时,我了解如何使用以下方法生成规范:

$ /usr/local/gcc-4.3.2/bin/gcc -v
Using built-in specs

现在更改为与 libgcc 相同的目录:

cd /usr/local/gcc-4.3.2/lib/gcc/x86_64-unknown-linux-gnu/4.3.2
/usr/local/gcc-4.3.2/bin/gcc -dumpspecs > specs

我有一个可以修改的填充规范文件。然而,一旦完成,我仍然看到:

$ /usr/local/gcc-4.3.2/bin/gcc -v
Using built-in specs

我如何告诉 gcc 默认情况下使用该规范文件,而不是强迫我在每次编译时传递 -specs 参数?我希望它与我拥有的另一个系统匹配,我得到以下信息:

$ /usr/local/gcc-4.3.2/bin/gcc -v
Reading specs from /usr/local/gcc-4.3.2/lib/gcc/i686-pc-linux-gnu/4.3.2/specs</code>

如您所见,两个系统之间的主要区别是现有设置是 32 位,我现在尝试在 64 位上匹配它系统。 Linux 的版本在其他方面是相同的,并且我正在编译相同版本的 gcc。 (对于两个系统,gcc 4.3.2 是第二个 gcc 安装,4.1.2 用于编译 4.3.2)

When using gcc version 4.3.2, I see how to generate specs using:

$ /usr/local/gcc-4.3.2/bin/gcc -v
Using built-in specs

Now changing to the same directory as libgcc:

cd /usr/local/gcc-4.3.2/lib/gcc/x86_64-unknown-linux-gnu/4.3.2
/usr/local/gcc-4.3.2/bin/gcc -dumpspecs > specs

I have a populated specs file that I can modify. However, once that is done I still see that:

$ /usr/local/gcc-4.3.2/bin/gcc -v
Using built-in specs

How do I tell gcc to use that specs file by default rather than forcing me to pass a -specs parameter every compile? I would like it to match another system I have where I get the following:

$ /usr/local/gcc-4.3.2/bin/gcc -v
Reading specs from /usr/local/gcc-4.3.2/lib/gcc/i686-pc-linux-gnu/4.3.2/specs</code>

As you can see, the major difference between the two systems is that the existing setup is 32-bit and I am now trying to match that on a 64-bit system. The version of Linux is otherwise the same and I am compiling the same version of gcc. (With both systems gcc 4.3.2 is the second gcc installation, with 4.1.2 being used to compile 4.3.2)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

り繁华旳梦境 2024-11-10 11:58:44

正如 Johannes Schaub - litb 的 strace 建议所暗示的那样,这是编译器在何处查找文件的问题。事实证明,非工作安装在 .bashrc 中设置了一个环境变量,导致了混乱。

规格文件的正确位置确实与 libgcc 所在的目录相同。只要确保您正在查找那里即可。

As hinted at by the strace suggestion by Johannes Schaub - litb, it was a problem with where the compiler was looking for the file. As it turns out, the non-working installation had an environment variable set in the .bashrc that was causing the confusion.

The correct location for the specs file is indeed the same directory that libgcc is in. Just be sure you're looking there.

岁吢 2024-11-10 11:58:44

我使用了这个命令行:

/usr/bin/set-gcc-default-3.sh i686-pc-mingw32

但您可能需要:

/usr/bin/set-gcc-default-4.sh i686-pc-linux-gnu

(注意 -4 而不是 -3)

这是使用“alternatives”东西构建的,请参阅

/usr/sbin/alternatives.exe --help

另请参阅 http:// linux.about.com/library/cmd/blcmdl8_alternatives.htm

I used this command line:

/usr/bin/set-gcc-default-3.sh i686-pc-mingw32

but you'll probably want:

/usr/bin/set-gcc-default-4.sh i686-pc-linux-gnu

(Note the -4 instead of -3)

This is built using the "alternatives" stuff, please see

/usr/sbin/alternatives.exe --help

And also see pages such as http://linux.about.com/library/cmd/blcmdl8_alternatives.htm

↙温凉少女 2024-11-10 11:58:44

作为构建的一部分,您可以使用规范文件重建 gcc!

一个更简单的解决方案是创建一个别名:

alias gcc_Gary gcc -specs /<folder With Specs File>/newSpecsFile

You rebuild gcc with your specs file as part of the build!

A simpler solution is to create an alias:

alias gcc_Gary gcc -specs /<folder With Specs File>/newSpecsFile
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文