Date: Fri, 10 Jun 2022 06:34:47 +0300 From: Rozhuk Ivan <rozhuk.im@gmail.com> To: freebsd-current@freebsd.org, freebsd-hackers@freebsd.org, Rozhuk Ivan <Rozhuk.IM@gmail.com> Subject: ccache during system build Message-ID: <20220610063447.10ff8004@rimwks.local>
next in thread | raw e-mail | index | archive | help
--MP_/EaWb/ZuBLx5HcyfQ9sZFz/p Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi! Just few tips. 1. bsd.compiler.mk set COMPILERCHECK env var: ============================================================================ # Handle bootstrapped compiler changes properly by hashing their content # rather than checking mtime. For external compilers it should be safe # to use the more optimal mtime check. # XXX: CCACHE_COMPILERCHECK= string:<compiler_version, compiler_build_rev, compiler_patch_rev, compiler_default_target, compiler_default_sysroot> .if ${CC:N${CCACHE_BIN}:[1]:M/*} == "" CCACHE_COMPILERCHECK?= content .else CCACHE_COMPILERCHECK?= mtime .endif ============================================================================ this overrides ccache.conf setting and increase build time. CCACHE_COMPILERCHECK='%compiler% -dumpversion' makes first build and second system rebuild faster. 2. To allow ccache hit in case with different src and obj location a) obj must be placed inside src b) OBJTOP env var must be set to new obj location without this obj path will contain src path and not hit to ccache. c) CCACHE_BASEDIR must be set to src d) CCACHE_NOHASHDIR=yes e) CCACHE_COMPILERCHECK='%compiler% -dumpversion' f) MAKEOBJDIRPREFIX='' g) -o nocache must be used with mount_nullfs to avoid error during install: exec(btxld) failed (No such file or directory) and obj via nullfs As example, attached scripts build kernel and world using obj stored inside /tmp, after build files from temp obj moved to /usr/obj dir. Using simular technic for build FreeBSD inside other src and obj locations I got ccache hit and reduce build time. I got ccache miss only for kernel build in case different KERNCONF, because it is mapped to obj dir path. Probably overwriting OBJROOT will fix it. --MP_/EaWb/ZuBLx5HcyfQ9sZFz/p Content-Type: application/x-shellscript Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=fbsd_build_kernel.sh IyEvYmluL3NoCiMjIyBSb3podWsgSXZhbiAyMDE5LT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Wb/ZuBLx5HcyfQ9sZFz/p Content-Type: application/x-shellscript Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=fbsd_build_world.sh IyEvYmluL3NoCiMjIyBSb3podWsgSXZhbiAyMDE5LTIwMjIKIyMjIGZic2RfYnVpbGRfd29ybGQK IyMjIAoKCiMgRXhpdCBvbiBlcnJvci4Kc2V0IC1lCgoKIyBJbml0IGNvbnN0YW5zLgo6ICR7U1JD X0RJUj0vdXNyL3NyY30KQVVUT19USFJFQURTPWBnZXRjb25mIE5QUk9DRVNTT1JTX09OTE4gfCB0 ciAtY2QgJ1s6cHJpbnQ6XSdgCk1BS0VPQkpESVJfT1JJRz1gbWFrZSAtQyAke1NSQ19ESVJ9IC1W IE1BS0VPQkpESVJgCk9CSkRJUl9TUkM9IiR7U1JDX0RJUn0vb2JqX3RtcCIKT0JKRElSX1RNUD1g bWt0ZW1wIC1kIC1xIC90bXAvb2JqLlhYWFhYWFhYYAppZiBbICR7P30gLW5lIDAgXTsgdGhlbgoJ ZWNobyAiJHswfTogQ2FuJ3QgY3JlYXRlIHRlbXAgZGlyLCBleGl0aW5nLi4uIgoJZXhpdCAxCmZp CmV4cG9ydCBDQ0FDSEVfQkFTRURJUj0iJHtTUkNfRElSfSIKZXhwb3J0IENDQUNIRV9OT0hBU0hE SVI9J3llcycKZXhwb3J0IENDQUNIRV9DT01QSUxFUkNIRUNLPSclY29tcGlsZXIlIC1kdW1wdmVy c2lvbicKZXhwb3J0IE1BS0VPQkpESVJQUkVGSVg9JycKZXhwb3J0IE9CSlRPUD0iJHtPQkpESVJf U1JDfSIKaWYgWyAhIC1kICIke09CSkRJUl9TUkN9IiBdOyB0aGVuCglybSAtcmYgIiR7T0JKRElS X1NSQ30iCglta2RpciAtcCAiJHtPQkpESVJfU1JDfSIKZmkKCgojIENsZWFuIGFsbCBwcmV2IGRh dGEuCmZvciBfX01OVF9QT0lOVCBpbiBgbW91bnQgfCBncmVwICIgb24gJHtPQkpESVJfU1JDfSIg fCB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fRFNUX0RJUn0vc3lzIiBdICYmIGNvbnRp bnVlCglybSAtcmYgIiR7X19EU1RfU1VCX0RJUn0iCmRvbmUKY3AgLWFmICIke19fU1JDX0RJUn0v IiAiJHtfX0RTVF9ESVJ9IgoKCiMgQ2xlYW51cC4KdW1vdW50ICIke09CSkRJUl9TUkN9IgpybSAt cmYgIiR7T0JKRElSX1RNUH0iCnN5bmMKCgpleGl0IDAK --MP_/EaWb/ZuBLx5HcyfQ9sZFz/p--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220610063447.10ff8004>