# Can I use 4.9/4.8 versions of GCC to rebuild the world/kernel?



## r619 (Jun 16, 2013)

I've noticed that FreeBSD has gcc version 4.2.1 in its base system. (Quite a surprise: it's almost 6 years old!) Quick googling says that's because of GPL/BSD license controversy. But *I*'m wondering - are 4.9/4.8 versions technically supported for world/kernel compiling? Are they unstable like clang?


----------



## kpa (Jun 16, 2013)

I don't think they are supported at the moment.

clang(1) works fine for world/kernel building on 9.1-RELEASE and on 9-STABLE. On the HEAD branch (10-CURRENT in other words) things can be pretty broken at times. Read the freebsd-current mailing list if you intend to use the HEAD branch.


----------



## Crivens (Jun 16, 2013)

r619 said:
			
		

> I've noticed that FreeBSD has gcc version 4.2.1 in its base system. (Quite a surprise: it's almost 6 years old!) Quick googling says that's because of GPL/BSD license controversy. But *I*'m wondering - are 4.9/4.8 versions technically supported for world/kernel compiling? Are they unstable like clang?



The link you gave is for potential bugs in the FreeBSD kernel, as the static analyse of LLVM reports them. These numbers do not indicate unstable elements in LLVM but point to places in the FreeBSD code which should be looked at.

You may try to use a newer GCC, but I reckon you would waste more time in experimenting in this as you will ever save by doing so, in case the newer GCC produces faster code.


----------



## pkubaj (Jun 16, 2013)

Nope, it IS supported. See https://wiki.freebsd.org/ExternalToolchain. Of course, you need 10-CURRENT for that.


----------



## jozze (Jun 22, 2013)

I think world builds fine. I was using lang/gcc48 a few months ago for both world and ports and I didn't find any problems with world, but some ports didn't build, so for those specific ports I had to use the default gcc-4.2 compiler.

Also, I think world builds fine with some pretty good optimizations (-O3, -ssse3, -sse4.1 and so on), though I wouldn't recommend it. If you want to try it, ask first on freebsd-hackers@freebsd.org, since I would expect more daring people, who like to walk on the edge of a knife, to hang out there.

The clang compiler works fine, actually very well! It really is lighter on resources. My system and ports are built with it whenever possible, and I didn't have any problems with it.


----------

