如何设置gcc 4.3默认specs文件?

时间:2023-01-22 07:07:33

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

使用gcc版本4.3.2时,我看到如何使用以下命令生成规范:

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

Now changing to the same directory as libgcc:

现在更改为与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:

我如何告诉gcc默认使用该specs文件而不是强迫我在每次编译时传递一个-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>

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)

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

3 个解决方案

#1


5  

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.

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

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

specs文件的正确位置确实与libgcc所在的目录相同。请确保您在那里查看。

#2


1  

I used this command line:

我使用了这个命令行:

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

/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

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

(Note the -4 instead of -3)

(注意-4而不是-3)

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

这是使用“替代”的东西建立的,请参阅

/usr/sbin/alternatives.exe --help

/usr/sbin/alternatives.exe --help

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

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

#3


0  

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

您使用specs文件重建gcc作为构建的一部分!

A simpler solution is to create an alias:

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

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

#1


5  

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.

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

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

specs文件的正确位置确实与libgcc所在的目录相同。请确保您在那里查看。

#2


1  

I used this command line:

我使用了这个命令行:

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

/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

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

(Note the -4 instead of -3)

(注意-4而不是-3)

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

这是使用“替代”的东西建立的,请参阅

/usr/sbin/alternatives.exe --help

/usr/sbin/alternatives.exe --help

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

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

#3


0  

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

您使用specs文件重建gcc作为构建的一部分!

A simpler solution is to create an alias:

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

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