Bug 203107

Summary: devel/ccache: installworld fails with ccache, mk/bsd.compiler.mk unable to determine compiler
Product: Ports & Packages Reporter: Tony Narlock <tony>
Component: Individual Port(s)Assignee: Bryan Drewery <bdrewery>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (bdrewery)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=173914

Description Tony Narlock 2015-09-14 19:56:24 UTC
Related: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=173914

I was able to do `make buildworld` successfully. However, I had to `installworld` like this:

sudo make installworld COMPILER_TYPE=clang

Other relation: https://svnweb.freebsd.org/ports?view=revision&revision=316346

Maybe COMPILER_TYPE should have a helper for `installworld` too?

$ freebsd-version -ku; uname -apKU
FreeBSD z600 11.0-CURRENT FreeBSD 11.0-CURRENT #6: Sun Sep 13 22:16:54 CDT 2015     root@z600:/usr/obj/usr/src/sys/MYKERNEL  amd64 amd64 1100079 1100079

$ pkg info ccache
Name           : ccache
Version        : 3.2.3
Installed on   : Wed Sep  9 18:10:31 CDT 2015
Origin         : devel/ccache
Architecture   : freebsd:11:x86:64

$ cat /etc/make.conf

.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*))
.if !defined(NOCCACHE) && exists(/usr/local/libexec/ccache/world/cc)

$ cat /etc/profile 

LANG=en_US.UTF-8;   export LANG
GDM_LANG=en_US.UTF-8;   export GDM_LANG

export CCACHE_DIR=/usr/.ccache
export PATH=/usr/local/libexec/ccache:$PATH
export CCACHE_PATH=/usr/bin:/usr/local/bin
Comment 1 Bryan Drewery freebsd_committer 2015-09-14 20:47:52 UTC
Strange, I have not run into this and use ccache in installworld frequently.
Comment 2 Bryan Drewery freebsd_committer 2015-09-16 17:12:28 UTC
Actually I just noticed I have 'COMPILER_TYPE=clang' in my make.conf for CCACHE. I should update the example configuration.

As a side note, the current support is not very good and needs to be rethought to avoid
issues like this and the XCC one.
Comment 3 Bryan Drewery freebsd_committer 2015-10-06 22:05:04 UTC
I'm working on a more official support for ccache in buildworld. The WIP is at https://reviews.freebsd.org/D3736
Comment 4 Bryan Drewery freebsd_committer 2015-11-06 20:49:43 UTC
This should be fixed by the following, without needing to set COMPILER_TYPE:

r290417 | imp | 2015-11-05 13:48:12 -0800 (Thu, 05 Nov 2015) | 10 lines

Fix CC being wrong during install* targets.

Move CROSS_TOOLS stuff to top of file (before bsd.compiler.mk) so that
decisions made by bsd.compiler.mk can properly affect the defaults in
src.opts.mk. Move that to after bsd.compiler.mk. Add a comment about
why we include bsd.compiler.mk here despite the fact that src.opts.mk
currently does too. Also remove bsd.arch.inc.mk that's been OBE.

Differential Revision: https://reviews.freebsd.org/D4087