First answer: Don't! In my experience, GCC 4.4.3 will not work properly on Snow Leopard. It will cause problems with zero-length strings.
Second answer: edit your symbolic links in /usr/bin to refer to the 4.4 stuff. Here's a script I wrote to do so:
rm /usr/bin/c++
ln -s /usr/bin/c++-${1} /usr/bin/c++
rm /usr/bin/cc
ln -s /usr/bin/cc-${1} /usr/bin/cc
rm /usr/bin/cpp
ln -s /usr/bin/cpp-${1} /usr/bin/cpp
rm /usr/bin/g++
ln -s /usr/bin/g++-${1} /usr/bin/g++
rm /usr/bin/gcc
ln -s /usr/bin/gcc-${1} /usr/bin/gcc
rm /usr/bin/gcov
ln -s /usr/bin/gcov-${1} /usr/bin/gcov
I called it chgCver, so to change my compiler to 4.4, I'd type chgCver 4.4
. Of course, before you run this, you'll also need to make sure that, for example, c++-4.4 points to the correct place (probably /opt/local/bin/gcc-mp-4.4
), etc. I can give you more specifics, if you're inclined to ignore my first and third answers.
Third answer: Don't! (See first answer.)
Didn't know GCC 4.4.3 had this problem, thanks! – hpy – 2010-03-28T19:10:38.193
3No need for this, just use
gcc_select
. – Adam Rosenfield – 2010-12-27T14:04:41.1833As we're talking about using MacPorts there's the "gcc_select" port that will do the same job and a little more. – anddam – 2011-03-26T06:00:06.380