This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc-4.6.0 breaks


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]