# The state of alternative compilers (besides GCC 4.2) for ports



## pkubaj (Apr 13, 2012)

Well, what is it? I've tried gcc46 and clang almost a year ago, there were plenty of errors, but I've recently seen some folks using gcc46 (or even gcc47 now that it's released) as default. Clang still seems to have over 1000 errors (according to the wiki page), but I couldn't find any information about other compilers.


----------



## UNIXgod (Apr 13, 2012)

http://pcc.ludd.ltu.se/


----------



## pkubaj (Apr 13, 2012)

Yeah, I've heard about PCC. But AFAIR PCC is more about OpenBSD (they are going to switch to it), and I meant mainly Clang/LLVM and GCC > 4.2. But PCC is also welcome here, as long as you write something about how well it compiles FreeBSD Ports (I remember that it compiles very quickly but the binaries are usually slow). Giving only links to compilers' official sites doesn't answer my question.


----------



## UNIXgod (Apr 14, 2012)

pkubaj said:
			
		

> Yeah, I've heard about PCC. But AFAIR PCC is more about OpenBSD (they are going to switch to it), and I meant mainly Clang/LLVM and GCC > 4.2. But PCC is also welcome here, as long as you write something about how well it compiles FreeBSD Ports (I remember that it compiles very quickly but the binaries are usually slow). Giving only links to compilers' official sites doesn't answer my question.



Wow. What did you expect. There really wasn't a question there aside from what options do you have and I quote "but I couldn't find any information about other compilers.". Maybe if you point out the specific issue your having with the system tools or specific port I may be able to answer it. If it's something else please re-articulate your question to be specific to your issue.


----------



## pkubaj (Apr 14, 2012)

I thought I had made it clear in topic: "The state of alternative compilers (besides GCC 4.2) for ports". Anyway, I want to compile ports with compiler other than GCC 4.2. Last time I tried it, it was a no go, because of lots of errors (I used Clang, it was about July/August I guess). My question is, what's the situation now, can I use gcc46/clang as default without lots of debugging why X port SEGFAULTs, even though it compiled successfully, and why Y port doesn't compile even though I set it to compile with GCC 4.2. That's what it was like the last time. I want to know if it's still the same.


----------



## DutchDaemon (Apr 14, 2012)

I'd say no. I ran some tests with both clang and gcc46 for ports, but it became too much of a hassle to keep track of what failed to compile, or what segfaulted after a successful compile, to keep on going.


----------



## t1066 (Apr 14, 2012)

My own experience on clang is quite encouraging. World and kernel were built using clang. Of the 458 ports that I installed, just a few had to be compiled by gcc42. All programs run smoothly except for graphics/geeqie. Also remember to check PortsAndClang.


----------



## Martillo1 (Apr 23, 2012)

I do not know why, but editors/libreoffice is compiling with clang++ instead of gcc as I write. I routinely compile world and kernel...


----------



## t1066 (Apr 25, 2012)

Just an update, both graphics/dri and emulators/virtualbox-ose needed to be compile with gcc. And Virtualbox is running smoothly after update.


----------



## darwimy (Apr 25, 2012)

Just today I tested clang with one of the ports I maintain. Although it threw a lot of warnings, it compiled fine. Some of the warnings revealed the use of deprecated or otherwise not portable gcc C extensions that need to be fixed upstream. Very promising after all.


----------



## kpa (Jun 7, 2012)

I just updated my 9-STABLE system to use clang(1) as the default compiler (WITH_CLANG_IS_CC in /etc/src.conf), world and kernel are compiled with clang and I'm currently recompiling ports with clang, no real breakage so far. Very encouraging.


----------



## UNIXgod (Jun 7, 2012)

darwimy said:
			
		

> Just today I tested clang with one of the ports I maintain. Although it threw a lot of warnings, it compiled fine. Some of the warnings revealed the use of deprecated or otherwise not portable gcc C extensions that need to be fixed upstream. Very promising after all.



Yeah the warnings are actually usable in clang. It's a nice compiler.


----------



## kpa (Jun 15, 2012)

It's now possible to get rid of the base system gcc(1) if you have for example lang/gcc46 as back up for ports that break with clang(1). I wouldn't recommend that on a system that has X and a desktop enviroment installed, on a system that has no X and otherwise a minimal set of ports it works quite nicely.


----------

