问题描述
在我的Linux平台,我有 GCC
的多个版本。
在 USR /斌
我有:
-
gcc34表示
-
gcc44
-
GCC
下面是一些输出:
$ GCC --version
海湾合作委员会(GCC)4.1.2 20080704(红帽4.1.2-48)$ gcc44 --version
gcc44(GCC)4.4.0 20090514(红帽4.4.0-6)
我需要使用4.4版本<$ C $ C>的gcc 但是默认似乎到4.1之一。
我有没有办法来取代的/ usr / bin中/海湾合作委员会
,使 gcc44
中的默认的编译器的未使用符号链接以的/ usr / bin中/ gcc44
?
为什么我不能用一个符号链接的原因是因为我的code将用模拟
RPM软件包被运。 模拟
从头创建一个最小的Linux安装和编译我的code在它之前刚刚安装指定的依赖关系。我不能自定义这个最小化安装。
在理想情况下,完美的解决办法是安装一个官方RPM包,取代 GCC
与 gcc44
为默认的编译器。有这样的包?这甚至可能/好?
其他信息
我必须使用(A 制作
替代)和它不让我指定二进制用于 GCC
。
我也会接受任何答案会告诉我如何指定 GCC
二进制在我的 SConstruct
文件。
-
一个办法是编译并从源代码安装
GCC
。 -
请参见
这是:
ENV =环境()
env.Replace来对它(CC =my_cc_compiler)
或者,根据答案this问题,
CC = ENV ['gcc44']
On my Linux platform, I have several versions of gcc
.
Under usr/bin
I have:
gcc34
gcc44
gcc
Here are some outputs:
$ gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
$ gcc44 --version
gcc44 (GCC) 4.4.0 20090514 (Red Hat 4.4.0-6)
I need to use the 4.4 version of gcc
however the default seems to the 4.1 one.
I there a way to replace /usr/bin/gcc
and make gcc44
the default compiler not using a symlink to /usr/bin/gcc44
?
The reason why I can't use a symlink is because my code will have to be shipped in a RPM package using mock
. mock
creates a minimal linux installation from scratch and just install the specified dependencies before compiling my code in it. I cannot customize this "minimal installation".
Ideally, the perfect solution would be to install an official RPM package that replaces gcc
with gcc44
as the default compiler. Is there such a package ? Is this even possible/good ?
Additional information
I have to use SCons (a make
alternative) and it doesn't let me specify the binary to use for gcc
.
I will also accept any answer that will tell me how to specify the gcc
binary in my SConstruct
file.
One way is to compile and install
gcc
from source.
From that:
env = Environment()
env.Replace(CC = "my_cc_compiler")
Or, as per the answer to this question,
cc = env['gcc44']
这篇关于更改默认的C编译器在Linux中,使用SCons的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!