Changing default compiler in Linux, using SCons

Posted by ereOn on Stack Overflow See other posts from Stack Overflow or by ereOn
Published on 2010-05-31T14:45:37Z Indexed on 2010/05/31 15:43 UTC
Read the original article Hit count: 251

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about c

    Related posts about linux