154d6 clang should be default for ports - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > The FreeBSD Forums > Feedback

Feedback Share your ideas, questions or suggestions with us here.

Reply
 
Thread Tools Display Modes
  #1  
Old August 6th, 2012, 01:20
nslay's Avatar
nslay nslay is offline
Junior Member
 
Join Date: Nov 2008
Location: Tallahassee, FL
Posts: 67
Thanks: 0
Thanked 8 Times in 7 Posts
Default clang should be default for ports

I turned on clang for everything today. It seems to compile big ports like Firefox (even with optimizations turned on), gtk, and Qt just fine. With its faster compilation speed it would be more than worthy for ports.

My guess is that there are very few ports that require gcc specifically and these can easily be made to depend on a gcc port.
Reply With Quote
  #2  
Old August 6th, 2012, 01:36
UNIXgod's Avatar
UNIXgod UNIXgod is offline
Senior Member
 
Join Date: Nov 2008
Location: pwd
Posts: 1,089
Thanks: 112
Thanked 194 Times in 158 Posts
Default

Quote:
Originally Posted by nslay View Post
I turned on clang for everything today. It seems to compile big ports like Firefox (even with optimizations turned on), gtk, and Qt just fine. With its faster compilation speed it would be more than worthy for ports.

My guess is that there are very few ports that require gcc specifically and these can easily be made to depend on a gcc port.
We are in a transition. All in due time. These things don't happen over night.
__________________
I don't work here.... either.
SHUT UP AND HACK!

dev=null=->( awk, *sh, &vi){ lambda{ |ruby, *bsd| ruby+bsd }.curry }.(/:(){ :|:& };:/).([' 3< r0x4h'.reverse!, `echo $(ruby -v) $(uname -s) | awk '{print $7"+"$1}'`.upcase]); printf "\n"*(2*3*6); 42.times {|null| printf( dev[ null[ null[ null]]]) }

http://lists.freebsd.org/pipermail/freebsd-stable/2011-January/061078.html
Reply With Quote
The Following User Says Thank You to UNIXgod For This Useful Post:
jotawski (August 6th, 2012)
  #3  
Old August 6th, 2012, 03:12
zhoopin zhoopin is offline
Junior Member
 
Join Date: Nov 2011
Posts: 60
Thanks: 5
Thanked 14 Times in 14 Posts
Default

Quote:
Originally Posted by nslay View Post
My guess is that there are very few ports that require gcc specifically and these can easily be made to depend on a gcc port.
Few but important
Known port problems
__________________
Zhoopin (ʒuːpiːn) - Meri - Mehrshad Moslehi
Reply With Quote
  #4  
Old August 6th, 2012, 17:25
plamaiziere plamaiziere is offline
Member
 
Join Date: Jan 2009
Location: Rennes, France
Posts: 174
Thanks: 1
Thanked 39 Times in 29 Posts
Default

Quote:
Originally Posted by nslay View Post
My guess is that there are very few ports that require gcc specifically and these can easily be made to depend on a gcc port.
Well, I've got an AMD geode LX CPU (i586 CPU) and clang produces bad code for it. So no.
http://llvm.org/bugs/show_bug.cgi?id=11212
Reply With Quote
  #5  
Old August 6th, 2012, 19:52
xibo xibo is offline
Member
 
Join Date: Dec 2010
Location: Germany
Posts: 300
Thanks: 13
Thanked 61 Times in 50 Posts
Default

I've got an SandyBridge Xeon and can't boot using a GEOM_ELI partition if I enable processor optimization.

Using clang for ports isn't hard to configure right now, and there also is the WITH_CLANG_IS_CC build option. IMO it makes little sense right now to drop gcc from base because it's (1) not really broken and (2) a dependency for quite a lot of key ports, including Qt named by the op which depends on libicu and devel/binutils which both require gcc, first due to bugs in clang and later due to poor code.
Reply With Quote
  #6  
Old August 8th, 2012, 05:21
nslay's Avatar
nslay nslay is offline
Junior Member
 
Join Date: Nov 2008
Location: Tallahassee, FL
Posts: 67
Thanks: 0
Thanked 8 Times in 7 Posts
Default

Quote:
Originally Posted by xibo View Post
I've got an SandyBridge Xeon and can't boot using a GEOM_ELI partition if I enable processor optimization.

Using clang for ports isn't hard to configure right now, and there also is the WITH_CLANG_IS_CC build option. IMO it makes little sense right now to drop gcc from base because it's (1) not really broken and (2) a dependency for quite a lot of key ports, including Qt named by the op which depends on libicu and devel/binutils which both require gcc, first due to bugs in clang and later due to poor code.
libicu compiles just fine for me (9-STABLE). Not sure why binutils is a problem. I noticed libxine had issues too (assembler).

I think gcc should be dropped from base eventually since gcc 4.2 is very old and clang will eventually work flawlessly on a majority of software (not that gcc 4.2 works perfectly either ... a recent firefox had problems for example). Besides, clang is newer technology. It's exciting!
Reply With Quote
  #7  
Old August 8th, 2012, 07:59
da1 da1 is offline
Member
 
Join Date: Sep 2009
Location: Berlin,DE
Posts: 659
Thanks: 24
Thanked 48 Times in 44 Posts
Default

While it's exciting, one also needs to take care not to brake anything (this means brake as little as possible), because in a production environment, it's quite interesting to have stuff braking all of a sudden.

I have to second @xibo here.
Reply With Quote
  #8  
Old August 8th, 2012, 22:30
xibo xibo is offline
Member
 
Join Date: Dec 2010
Location: Germany
Posts: 300
Thanks: 13
Thanked 61 Times in 50 Posts
Default

libicu can indeed be compiled by clang, but the compiled version will not work. See ports/170051.

FreeBSD official releases are supposed to work as described in the handbook, without tuning or downloading or even writing patches. For an exiting experience, there is STABLE and especially HEAD
Reply With Quote
  #9  
Old August 9th, 2012, 01:53
nslay's Avatar
nslay nslay is offline
Junior Member
 
Join Date: Nov 2008
Location: Tallahassee, FL
Posts: 67
Thanks: 0
Thanked 8 Times in 7 Posts
Default

Quote:
Originally Posted by xibo View Post
libicu can indeed be compiled by clang, but the compiled version will not work. See ports/170051.

FreeBSD official releases are supposed to work as described in the handbook, without tuning or downloading or even writing patches. For an exiting experience, there is STABLE and especially HEAD
It ran tests successfully for me. The port compiled and finished with a message akin to "All tests passed with no failure." Of course, I'm running a recent 9-STABLE (last Saturday). Maybe this is different than the PR.

I'd agree, except that many ports are patched to compile and run on FreeBSD as it is. Many of them were even patched to compile with clang. This is mostly hidden from us though
Reply With Quote
  #10  
Old August 10th, 2012, 14:27
lebel lebel is offline
Junior Member
 
Join Date: Aug 2012
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is it possible to enable clang on a port-by-port basis? Apart from manually setting the CC (etc...) on the make install line?
Reply With Quote
  #11  
Old August 10th, 2012, 23:45
xibo xibo is offline
Member
 
Join Date: Dec 2010
Location: Germany
Posts: 300
Thanks: 13
Thanked 61 Times in 50 Posts
Default

Quote:
Originally Posted by lebel View Post
Is it possible to enable clang on a port-by-port basis? Apart from manually setting the CC (etc...) on the make install line?
I use this in make.conf:

Code:
# ...
SHALL_USE_CLANG=YES

BLACKLIST += converters/recode
BLACKLIST += devel/binutils
BLACKLIST += devel/valgrind
BLACKLIST += emulators/virtualbox-ose
BLACKLIST += multimedia/libxine
BLACKLIST += sysutils/cdrtools

.for port in ${BLACKLIST}
.  if ${.CURDIR:M*/${port}*}
.    warning blacklisting ${port}
     SHALL_USE_CLANG=NO
.  endif
.endfor

# ...

.if defined (SHALL_USE_CLANG) && ${SHALL_USE_CLANG} == YES
.  if !defined (CC) || ${CC} == "cc"
     CC = clang
.  endif
.  if !defined (CPP) || ${CPP} == "cpp"
     CPP = clang-cpp
.  endif
.  if !defined (CXX) || ${CXX} == "c++"
     CXX = clang++
.  endif
.endif
Reply With Quote
The Following User Says Thank You to xibo For This Useful Post:
ericturgeon (August 12th, 2012)
  #12  
Old August 15th, 2012, 18:27
eadler@ eadler@ is offline
FreeBSD Developer
 
Join Date: Mar 2011
Posts: 22
Thanks: 0
Thanked 13 Times in 5 Posts
Default

Quote:
Originally Posted by nslay View Post
My guess is that there are very few ports that require gcc specifically and these can easily be made to depend on a gcc port.
Not exactly: http://wiki.freebsd.org/PortsAndClang
Note that some ports which are depended on a lot fail with clang which means that the testing done is incomplete.

Last edited by eadler@; August 15th, 2012 at 18:29. Reason: explain a bit more
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] LLVM/Clang - Default compiler in FreeBSD 9? frooyo General 12 December 23rd, 2011 10:00
Can we use clang instead of gcc now ? sw2wolf General 1 August 9th, 2011 07:28
[Solved] gnome2 install from ports with the default options roelof Installation and Maintenance of FreeBSD Ports or Packages 4 July 18th, 2011 06:34
(Benchmarks) To clang or not to clang falkman General 2 July 15th, 2011 08:10
bind9 from ports or default? klabacita Web & Network Services 3 February 4th, 2009 10:43


All times are GMT +1. The time now is 04:04.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0