gcc-4.6.0 breaks

Bill Cunningham billcun@suddenlink.net
Thu Jun 2 19:41:00 GMT 2011


Jonathan Wakely wrote:
> On 2 June 2011 13:17, Bill Cunningham wrote:
>>
>> Ok but I have another question concerning gcc. I would like to have 2
>> compilers. A default and one perhaps in /usr/local or another
>> directory. How can I switch back and forth between which compiler I
>> want?
>
> The same way you'd choose between any two programs in different
> locations.
>
> You could adjust your $PATH or write a script which calls the one you
> want.
>
> I have a handful of versions installed in ~/gcc/ and invoke them via a
> script like
>
> #!/bin/bash
>> ${ver:=4.7}
>> ${libdir:=lib64}
> $HOME/gcc/$ver/bin/g++ -Wl,-rpath,$HOME/gcc/$ver/$libdir -Wall -g "$@"

    I see in .bash_profile that there is a PATH variable set. I have to put 
all my binaries in /usr to get the shell to recognize it. I know nothing 
about bash and would like to run a script that would allow me to simply run 
a script that would switch back and forth between compilers, assemblers, and 
the linker. Maybe 2 scripts. But I can't find the file that lists all my 
path data. env shows the path as does echo $PATH. I always log in as root 
anyway. If I want single user mode I add init=/bin/bash to the kernel switch 
of grub.

Bill



More information about the Gcc-help mailing list