Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Oct 2015 07:01:54 -0700
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        =?UTF-8?Q?Juan_Ram=c3=b3n_Molina_Menor?= <listjm@club.fr>, freebsd-current@freebsd.org
Subject:   Re: [CFT] Buildworld ccache support
Message-ID:  <56279AD2.6080009@FreeBSD.org>
In-Reply-To: <56264279.7020504@club.fr>
References:  <56264279.7020504@club.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--Nd1ML6p0AWDGQFp3WB0xnQOHg90TdIGJ5
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Why not cc me or even send this re: to the original thread?


On 10/20/2015 6:32 AM, Juan Ram=F3n Molina Menor wrote:
> Hi!
>=20
> I=92m certainly doing it wrong, because CCACHE does not kick in after
> applying the patch and modifying make.conf. CCACHE stats ('ccache -z'
> followed by 'ccache -s') remain at zero during buildworld while they
> used to reflect the cache miss/hits before.
>=20
> # cat /etc/make.conf
> WITH_CCACHE_BUILD=3D
>=20
>  # svn diff /usr/src/share/mk/local.init.mk
> Index: /usr/src/share/mk/local.init.mk
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- /usr/src/share/mk/local.init.mk     (revision 289627)
> +++ /usr/src/share/mk/local.init.mk     (working copy)
> @@ -38,3 +38,37 @@
>  HOST_CFLAGS+=3D -DHOSTPROG
>  CFLAGS+=3D ${HOST_CFLAGS}
>  .endif
> +
> +# Handle ccache after CC is determined.  If CC is at some specific pat=
h
> then
> +# we must prepend the ccache wrapper.  Otherwise we can just prepend
> PATH with
> +# the wrapper location, which is a more safe solution since it avoids
> spaces
> +# and compiler type guessing based on filename.
> +LOCALBASE?=3D            /usr/local
> +CCACHE_WRAPPER_PATH?=3D  ${LOCALBASE}/libexec/ccache
> +CCACHE_PATH?=3D          ${LOCALBASE}/bin/ccache
> +.if defined(WITH_CCACHE_BUILD) && !defined(NOCCACHE) && \
> +    ${CC:M*ccache*} =3D=3D "" && exists(${CCACHE_PATH})
> +# Handle compiler changes properly.  This avoids needing to use the
> 'world'
> +# wrappers.
> +CCACHE_COMPILERCHECK?=3D content
> +.export CCACHE_COMPILERCHECK
> +.if ${CC:M/*} =3D=3D ""
> +# Can use PATH.
> +PATH:=3D ${CCACHE_WRAPPER_PATH}:${PATH}
> +.export PATH
> +.else
> +# Must prepend CC.
> +CC:=3D           ${CCACHE_PATH} ${CC}
> +CXX:=3D          ${CCACHE_PATH} ${CXX}
> +CPP:=3D          ${CCACHE_PATH} ${CPP}
> +.if defined(HOST_CC)
> +HOST_CC:=3D      ${CCACHE_PATH} ${HOST_CC}
> +.endif
> +.if defined(HOST_CXX)
> +HOST_CXX:=3D     ${CCACHE_PATH} ${HOST_CXX}
> +.endif
> +.if defined(HOST_CPP)
> +HOST_CPP:=3D     ${CCACHE_PATH} ${HOST_CPP}
> +.endif
> +.endif
> +.endif # WITH_CCACHE_BUILD
>=20
> If I recover the old make.conf, CCACHE works again for a buildworld.
>=20
> # cat /etc/make.conf.old
> .if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*))
> .if !defined(NOCCACHE) && exists(/usr/local/libexec/ccache/world/cc)
> CC:=3D${CC:C,^cc,/usr/local/libexec/ccache/world/cc,1}
> CXX:=3D${CXX:C,^c\+\+,/usr/local/libexec/ccache/world/c++,1}
> .endif
> .endif
>=20
> Maybe I misconfigured CCACHE when I first installed it?
>=20

This doesn't check for a value of WITH_CCACHE_BUILD, just being defined
is enough.

I've been fixing some subtle bugs such as in the lib32 build, but
overall I've had ccache -s growing while using the patch.  If you
already have ccache in CC it won't apply it.

Are you building head from head or some other configuration?


--=20
Regards,
Bryan Drewery


--Nd1ML6p0AWDGQFp3WB0xnQOHg90TdIGJ5
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJWJ5rSAAoJEDXXcbtuRpfP/1kIAJMVtebikygyElNvRVHOqi8N
4BdeY+YETQge73igASj9DgLvD3Wliw8vqXV4wtrbfEZOInoFR8s7IKiZsMBnAQks
xk7ac0VdeGLkJQ7Y60w8SF6UB3G2EHQT6ffJLC/o1K9SrA9rOCFsg6qITct2JsSE
47cwJVk5DCByK+DATLfY5+Sc+ad2hJUBftmQSrJDR0jliCR0bMTVsUcsyjVT5d/o
nemNCNEk2XTwb1sNmel8RCgR5SG3osrSzvgUK1vMknrFTLlMsAt6W5AeYDcrU1Kj
XMCH+oE8uFThtdGHrWhnYI/QER+w6D5qsr7LG1Tp7PyyKWAvIiqNNDYFpMc+zoY=
=5Ee8
-----END PGP SIGNATURE-----

--Nd1ML6p0AWDGQFp3WB0xnQOHg90TdIGJ5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56279AD2.6080009>