# There any problem using other compilers instead the one in base system?



## wisdown (May 2, 2015)

Hey guys,

I'm on my second week of tries and error in get the FreeBSD 10.1 runing on my old laptop with gnome 3 and till now without success...

Looking on internet how to get gcc working, I have found how to make it as default compiler too..

Was compiling all packages at least 3 times more faster, but, in 2 packages I got an problem:

1 - OpenJDK7
2 - amd64-binutils & binutil

On the first (OpenJDK7) seems exists an problem with an gcc49 header file.
For get OpenJDK7 working then, I have disabled gcc+ and used the default system compiler.

On the second (amd64-binutils & binutil) the gcc49 compiler crashed saying not be able to make executable files...

Till Java my choice was being keep using gcc49 to compile all...
But, after see gcc49 cannot create executable files, I started worry about have lost my time since some compiled programs would not be able to execute (there no warn or error in the logs)

So, my question is:

If I keep using gcc49 to compile all, would I have the system working like desired?

Or

Building the packages with gcc49 only (except in situations like openjdk and binutils for example) will make useless programs and bug the system?


----------



## kpa (May 2, 2015)

I don't see a big problem with that since much of the software in ports comes from Linux or is developed primarily on Linux where GCC is the default compiler. This all assuming you can get the GCC compiler working without too much trouble. Don't use GCC for compiling the OS though, you might trigger some hidden bugs that are only reveal themselves when code is compiled with GCC and not with Clang. Clang is the default compiler for the base system for a good reason.


----------



## Oko (May 3, 2015)

kpa said:


> Don't use GCC for compiling the OS though, you might trigger some hidden bugs that are only reveal themselves when code is compiled with GCC and not with Clang.


I would hope that such tests, as well as compiling FreeBSD on platforms other than amd64 (in particular big endian) and the whole slue of automatic regression tests were done as the part of release process and continuous quality assurance process. If compiling  FreeBSD with GCC  exposes bugs which are not the bugs in GCC itself than something is very wrong with FreeBSD or LLVM (clang is just a front end).


----------



## wisdown (May 3, 2015)

> Don't use GCC for compiling the OS though, you might trigger some hidden bugs that are only reveal themselves when code is compiled with GCC and not with Clang.



Going to use a snapshot to clean base system and redo all the compilation without gcc as default compiler so, thanks for the support guys!!!

To get everything compiled with gcc49 I did:

Installing from ports:

```
cd /usr/ports/lang/gcc49
make deinstall clean rmconfig config-recursive install clean > /root/logs/gcc49.log
libtool --finish /usr/local/lib
libtool --finish /usr/local/lib/gcc49
```

# Check the version
`gcc49 --version`

Setup gcc49 as default compiler:

```
ee /etc/make.conf
# Setup gcc49 compiler
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc49)
CC=gcc49
CXX=g++49
CPP=cpp49
.endif
```

Set up some libraries:

```
ee /etc/libmap.conf
libgcc_s.so.1  gcc49/libgcc_s.so.1
libgomp.so.1  gcc49/libgomp.so.1
libobjc.so.3  gcc49/libobjc.so.4
libssp.so.0  gcc49/libssp.so.0
libstdc++.so.6  gcc49/libstdc++.so.6
```


----------

