# FreeBSD/CLANG ready for testing -> now imported in HEAD



## DutchDaemon (Apr 16, 2010)

CLANG is a new C compiler built to work with LLVM. Getting away from gcc on the BSD side is kind of important (including, but not only  because of GPLv3) so getting FreeBSD to compile and work with CLANG is a high profile project.

Read more ...


----------



## Oko (Apr 17, 2010)

First test. Can it compile itself?


----------



## Andrius (Apr 17, 2010)

It can, or at least it should be able to. If it doesn't, let us know.


----------



## dclau (Apr 17, 2010)

Ivan's blog unavailable right now:


> You tried to access the address http://ivoras.sharanet.org/blog/ , which is currently unavailable.


----------



## Andrius (Apr 17, 2010)

Original email

Just note that email says to do:
`$ cd clangbsd && make buildworld`
`$ echo NO_WERROR= >> /etc/make.conf`
`$ echo WERROR=    >> /etc/make.conf`

But this is wrong, you should do WERROR stuff *before* buildworld.


----------



## oliverh (Apr 17, 2010)

dclau said:
			
		

> Ivan's blog unavailable right now:




No problems: http://ivoras.sharanet.org/blog/tree/2010-04-16.freebsdclang-ready-for-testing!.html

Maybe just a small hiccup.


----------



## kpedersen (Apr 17, 2010)

I tried this a while ago and it compiled etc... perfectly, but the c++ was broken. Has any work been done on this?


----------



## OH (Apr 17, 2010)

kpedersen said:
			
		

> I tried this a while ago and it compiled etc... perfectly, but the c++ was broken. Has any work been done on this?



They have special page for it


----------



## Andrius (Apr 17, 2010)

kpedersen said:
			
		

> I tried this a while ago and it compiled etc... perfectly, but the c++ was broken. Has any work been done on this?



A lot of work has been done in improving clang's C++ support, and since "a while ago" it has most definitely gotten better. It's not perfect, but it's getting there.


----------



## troberts (Apr 18, 2010)

*Some questions*

I am using the FreeBSD boot manager to dual-boot Windows and FreeBSD. Do I need to take any special steps or does it not matter?

Since I use ccache, do I need to modify any settings in /.cshrc or /etc/make.conf?

Can I use FreeBSD/Clang to recompile ports or should I stick with using it to compile the OS and kernel?


----------



## Andrius (Apr 18, 2010)

troberts said:
			
		

> I am using the FreeBSD boot manager to dual-boot Windows and FreeBSD. Do I need to take any special steps or does it not matter?


You shouldn't need any special steps since it's still the same FreeBSD, just compiled by clang and includes clang/llvm in base system. But as the email mentions, you shouldn't install it on real hardware yet, it's not tested enough, and if you lose data, it's your own fault for trusting experimental software. I'm not saying it won't work, just make sure you have backups if you want to replace normal FreeBSD with ClangBSD.



			
				troberts said:
			
		

> Since I use ccache, do I need to modify any settings in /.cshrc or /etc/make.conf?


Sorry, can't tell anything about ccache because I never used it.



			
				troberts said:
			
		

> Can I use FreeBSD/Clang to recompile ports or should I stick with using it to compile the OS and kernel?


Using clang with ports right now would be a very bad idea. You should stick with gcc for now. There is some work done to get ports to work with clang, but it's nowhere near complete yet. I expect some/many clang fixes to go to ports tree in the next few months, but don't quote me on that.


----------



## aragon (Apr 21, 2010)

FWIW, Phoronix benchmarked LLVM/Clang recently.  Pity they didn't stack it up against GCC 4.2 though...


----------



## ckester (Apr 21, 2010)

aragon said:
			
		

> FWIW, Phoronix benchmarked LLVM/Clang recently.  Pity they didn't stack it up against GCC 4.2 though...



There's nothing preventing us from running the benchmark tests ourselves, rather than waiting for Phoronix or someone else to do it for us.  Seems like something we'd want to be doing anyway, if we're serious about moving to clang.

There are several benchmark suites in the portstree.   The apps Phoronix used to test compile times and performance are in the tree too.


----------



## atarahas (Apr 21, 2010)

I believe that switching mainline FreeBSD to Clang would be a good idea. It would make FreeBSD dependent on a completely BSD toolchain. It would be great if 9.0 or 8.x is compiled with Clang. Clang has many other benefits such as better diagnostics. I support the idea of moving FreeBSD to Clang.


----------



## DutchDaemon (Jun 5, 2010)

Import of clang/LLVM to happen on June 9th.

http://permalink.gmane.org/gmane.os.freebsd.current/125675


----------



## sossego (Jun 5, 2010)

Is it available for testing on the PowerPC platform yet?


----------



## dennylin93 (Jun 5, 2010)

[INFO]: import of clang/LLVM to happen on June 9th:


> Clang will be enabled to be built on amd64/i386/ppc by default and disabled
> everywhere else.



It might be ready for testing. The post wasn't really clear though.


----------



## Carpetsmoker (Jun 6, 2010)

My laptop overheated and shutdown while compiling llvm/clang :\


----------



## phoenix (Jun 6, 2010)

Yeah, if you go through the archives, there's a post that shows the difference in time it takes to compile clang.  Using gcc it was over 1100 (sec/min?) and building clang with clang was under 700.


----------



## namor (Jul 8, 2011)

What's the problem with GPLv3 and BSD? What's _different_ compared to GPLv2, that makes it infeasible to use GCC as a userland tool in FreeBSD?


----------



## vermaden (Jul 8, 2011)

namor said:
			
		

> What's the problem with GPLv3 and BSD? What's _different_ compared to GPLv2, that makes it infeasible to use GCC as a userland tool in FreeBSD?



http://www.mobileread.com/forums/showthread.php?t=31161
http://stackoverflow.com/questions/...ld-i-fall-into-the-same-situa/3809007#3809007
http://www.zdnet.com.au/gplv3-to-drive-users-from-linux-to-freebsd-339281694.htm
http://lists.nycbug.org/pipermail/talk/2007-September/010446.html


----------



## namor (Jul 8, 2011)

vermaden said:
			
		

> http://www.mobileread.com/forums/showthread.php?t=31161
> http://stackoverflow.com/questions/...ld-i-fall-into-the-same-situa/3809007#3809007
> http://www.zdnet.com.au/gplv3-to-drive-users-from-linux-to-freebsd-339281694.htm
> http://lists.nycbug.org/pipermail/talk/2007-September/010446.html



Ok, I read through all of the links yesterday and figured there are two major, suspected problems with GPLv3, that did not exist with GPLv2:


'Distributing' a FreeBSD (with GPLv3 Code in it, like gcc) in any way, be it a mirror or an embedded application makes YOU a distributor of GPLv3 code and by that, you basically promise to not sue anyone using that GPLv3 code with patents you hold 'against' that GPLv3 code. The big, presumed problem is, that you also promise not to sue anyone basing his or her work on that code. So if your company mirrors FreeBSD with a GPLv3 gcc, you cannot sue anyone for infringing your patents, as long as the infringement is based on the gcc
The second and less important point should be here, but while writing the first, I forgot it. I will replace this section once I remember and figure out how to edit posts. 

As for the first point, I read the FreeBSD foundation hired lawyers to look into it. Has there been a result so far?


----------



## vermaden (Jul 10, 2011)

The biggest problem of GPL3 is probably that You need bunch of lawyers to actually understand what it means.


----------



## Crivens (Jul 11, 2011)

vermaden said:
			
		

> The biggest problem of GPL3 is probably that You need bunch of lawyers to actually understand what it means.



... and the biggest problem with a bunch of lawyers is that you get more answers as said bunch contains lawyers.

IIRC Kishon (the author) refused to sign any contract with more than one page and written in such a way that he needed to read it more than once to understand it. Let that be the goal for licences and EULAs.


----------



## graudeejs (Jul 11, 2011)

Crivens said:
			
		

> IIRC Kishon (the author) refused to sign any contract with more than one page and written in such a way that he needed to read it more than once to understand it. Let that be the goal for licences and EULAs.



Well stated


----------



## rockworldmi (Sep 23, 2011)

I think pcc will be incorporated in future BSDs!


----------



## Carpetsmoker (Sep 24, 2011)

Not on FreeBSD ...

OpenBSD and NetBSD have distant future plans. With distant future I mean several years at least.


----------

