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.
 
nslay said:
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'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.
 
xibo said:
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!
 
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.
 
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 :D
 
xibo said:
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 :D

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 :)
 
Is it possible to enable clang on a port-by-port basis? Apart from manually setting the CC (etc...) on the make install line?
 
lebel said:
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
 
Back
Top