clang is now the default compiler for FreeBSD (instead of gcc-42), and things supposedly run quicker under clang. You can do the buildworld with clang, but including ccache in the process needs some small adjustments:
1. Edit your /etc/src.conf as below. clang is enabled by default anyway, but you may want to add extras to it. Originally this post advised WITHOUT_GCC for a quicker build, but this is ill-advised as explained below.
2. In your /usr/local/etc/buildflags.conf set:
You are now set to buildworld with clang + ccache. CCACHE_CPP2 must be enabled because clang dislikes ccache trying extra flags.
If you do not use sysutils/bsdadminscripts, and therefore do not have buildflags.conf, you can set those parameters from command line :
[CMD="/usr/src> #"]make -DUSE_CCACHE -DUSE_CCACHE_CPP2 buildworld[/CMD]
In this situation you of course need these in your /etc/make.conf.
Thanks to Volodymyr Kostyrko for helping me solve this.
EDIT: Apparently as of the date of this post, setting WITHOUT_GCC= yes does not work yet and breaks buildworld. It must be left in /etc/src.conf for now.
1. Edit your /etc/src.conf as below. clang is enabled by default anyway, but you may want to add extras to it. Originally this post advised WITHOUT_GCC for a quicker build, but this is ill-advised as explained below.
Code:
WITH_CLANG= yes
WITH_CLANG_EXTRAS= yes # Build additional clang and llvm tools, such as bugpoint.
WITH_CLANG_IS_CC= yes # Useful for some buildworld errors
# WITHOUT_GCC= yes
2. In your /usr/local/etc/buildflags.conf set:
Code:
/usr/src | /usr/src/*{
CC= clang
CPP= clang-cpp
CXX= clang++
USE_CCACHE
USE_CCACHE_CPP2
}
You are now set to buildworld with clang + ccache. CCACHE_CPP2 must be enabled because clang dislikes ccache trying extra flags.
If you do not use sysutils/bsdadminscripts, and therefore do not have buildflags.conf, you can set those parameters from command line :
[CMD="/usr/src> #"]make -DUSE_CCACHE -DUSE_CCACHE_CPP2 buildworld[/CMD]
In this situation you of course need these in your /etc/make.conf.
Code:
CC= clang
CPP= clang-cpp
CXX= clang++
Thanks to Volodymyr Kostyrko for helping me solve this.
EDIT: Apparently as of the date of this post, setting WITHOUT_GCC= yes does not work yet and breaks buildworld. It must be left in /etc/src.conf for now.