Installing and using gcc > v4.2.1

Hi All,

FreeBSD-9.2

I've installed lang/gcc47, gcc47 --version reports v4.7.4, Yet gcc --version still reports v4.2.1, everything uses gcc how does one make gcc use the gcc47 toolchain.

Following the page http://www.freebsd.org/doc/en/articles/custom-gcc/article.html I have added to /etc/make.conf the following:
Code:
CC=gcc47
CXX=g++47
CPP=cpp47

And to libmap.conf
Code:
libgcc_s.so.1   gcc47/libgcc_s.so.1
libgomp.so.1    gcc47/libgomp.so.1
libobjc.so.3    gcc47/libobjc.so.4
libssp.so.0     gcc47/libssp.so.0
libstdc++.so.6  gcc47/libstdc++.so.6

Without success.

Thanks
fh : )_~
 
For just running the newer gcc from the command line, you need to specify the proper command, since installing the port does NOT overwrite the version in the base system: for gcc version 4.7, the command installed from the port is gcc47.
Those entries in /etc/make.conf only take effect when you build something using a makefile that defines the compiler command as $(CC) or $(CXX).
 
gcc --version will always return 4.2.1 under 9.2 (unless you do cruel things to your system).

The whole reason to modify /etc/make.conf is to tell everything that uses it (i.e. Makefiles) not to use gcc but gcc47. In other words, you do not replace gcc but add another compiler and then tell everybody to use the new one.

And if you really want to change the default compiler this way be sure to have working backups. Things will break and very few people will be willing (or even able) to help you. On the other hand, if you like reading man pages and code then replacing your default compiler is a nice way to learn more about your BSD, compilers, C and Makefiles. :)
 
worldi said:
gcc --version will always return 4.2.1 under 9.2 (unless you do cruel things to your system).
Not everything uses BSD style makefiles, so Thy evil and wicked ways cometh as ... aliases!
Seems to be getting the job done, at least so far, Qt5.3.1 from git repo is building. (with one minor source change)

worldi said:
Things will break and very few people will be willing (or even able) to help you.
I wouldn't admit to it, I'd just rebuild the system ... besides I ain't no fool, I test on a lab box first, Thus I always start on a fresh box as well. I like fresh boxes! :P

worldi said:
On the other hand, if you like reading man pages and code then replacing your default compiler it's a nice way to learn more about your BSD, compilers, C and Makefiles. :)
I do ... I'm all about feeding the brain!

-Enjoy
fh : )_~
 
Check your $PATH. /usr/bin is before /usr/local/bin so typing gcc --version at a shell will run the system GCC. Additionally, I don't believe the lang/gcc port installs a generic gcc. Try the whole path, /usr/local/bin/gcc47 when you run from a shell. Not sure about the make.conf stuff as I've never modified that myself.
 
Back
Top