On 09/10/12 14:22, Daniel Eischen wrote:
On Mon, 10 Sep 2012, Brooks Davis wrote:

[Please confine your replies to toolch...@freebsd.org to keep the thread
on the most relevant list.]

For the past several years we've been working towards migrating from
GCC to Clang/LLVM as our default compiler.  We intend to ship FreeBSD
10.0 with Clang as the default compiler on i386 and amd64 platforms.  To
this end, we will make WITH_CLANG_IS_CC the default on i386 and amd64
platforms on November 4th.

What does the mean to you?

* When you build world after the default is changed /usr/bin/cc, cpp, and
  c++ will be links to clang.

* This means the initial phase of buildworld and "old style" kernel
  compilation will use clang instead of gcc.  This is known to work.

* It also means that ports will build with clang by default.  A major
  of ports work, but a significant number are broken or blocked by
  broken ports. For more information see:
    http://wiki.freebsd.org/PortsAndClang

What issues remain?

* The gcc->clang transition currently requires setting CC, CXX, and CPP
  in addition to WITH_CLANG_IS_CC.  I will post a patch to toolchain@
  to address this shortly.

I assume this will be done, tested and committed before 2012-11-04
(or whenever the switchover date is).


* Ports compiler selection infrastructure is still under development.

This should be a prerequisite before making the switch, given
that ports will be broken without a work-around for building
them with gcc.

I've been using a somewhat dirty method of doing this by checking the presence of a file in the port's main directory, e.g. if "basegcc" is present, build with that, if "clang" is present use it, otherwise default to gcc47. Obviously that configuration is system specific, but the fundamental idea is look for a file in the ports directory that dictates the compiler. Perhaps even add a make ccconfig. It works quite nicely because you can resume a portmaster spree without having to suspend and change CC manually, or build all clang ports first etc. Further csup doesn't touch files it doesn't no about, so updating the tree (without wiping it out) preserves the fact you'd prefer or need to build a given port with something else.

There are definitely some ports that have been ignoring libmap.conf, which tends to require me to build some of their dependencies with base gcc, but otherwise I've been running this system for a few months and it works quite well...portmaster can upgrade without user intervention, and it's quite easy to add cflags logic.

Granted this works for me and is probably not the ideal solution...also hacked on it to post, so probably typos :) Something like this in make.conf (with fstack-protector-all for all ports which works great)

.if !empty(.CURDIR:M/usr/ports/*)
CFLAGS+= -fstack-protector-all
.endif

.if empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc47) && !exists(basegcc) && !exists(clang)
# this was occasionally necessary
#LDFLAGS+=-lintl
# custom cflags if desired
#CFLAGS+=-custom cflags for gcc47
#custom cputype if desired
CPUTYPE=amdfam10
CC=gcc47
CPP=cpp47
CXX=g++47
.endif
.if empty(.CURDIR:M/usr/ports/*) && exists(/usr/bin/clang) && exists(clang)
.if !defined(CC) || ${CC} == "cc"
CC=clang
.endif
.if !defined(CXX) || ${CXX} == "c++"
CXX=clang++
.endif
.if !defined(CPP) || ${CPP} == "cpp"
CPP=clang-cpp
.endif
NO_WERROR=
WERROR=
.endif

Usage is as simple as "touch basegcc" in the port dir or "touch clang" etc. to select appropriate compiler

Matt
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to