From owner-freebsd-current@freebsd.org Sat May 28 00:16:23 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A97FEB4A934 for ; Sat, 28 May 2016 00:16:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 90423194E for ; Sat, 28 May 2016 00:16:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: by mailman.ysv.freebsd.org (Postfix) id 8B746B4A931; Sat, 28 May 2016 00:16:23 +0000 (UTC) Delivered-To: current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B197B4A92F for ; Sat, 28 May 2016 00:16:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 776A0194D for ; Sat, 28 May 2016 00:16:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 6BF941B9C for ; Sat, 28 May 2016 00:16:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 253371C93E for ; Sat, 28 May 2016 00:16:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id NycBRw5xFdJD for ; Sat, 28 May 2016 00:16:20 +0000 (UTC) From: Bryan Drewery DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 3C15B1C935 Subject: [CFT] WITH_META_MODE: Working incremental build To: current@FreeBSD.org Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: Date: Fri, 27 May 2016 17:16:25 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Lhkh0vHaJdFXOMEpFo3pLgebOGDGVfN3R" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 May 2016 00:16:23 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Lhkh0vHaJdFXOMEpFo3pLgebOGDGVfN3R Content-Type: multipart/mixed; boundary="BEVLhl9gCjDQDIN5xWHaUKQpdA6q28qhB" From: Bryan Drewery To: current@FreeBSD.org Message-ID: Subject: [CFT] WITH_META_MODE: Working incremental build --BEVLhl9gCjDQDIN5xWHaUKQpdA6q28qhB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Buildworld/Buildkernel now supports a working incremental build. Using -DNO_CLEAN is not needed as it is the default with it (there is no -DCLEAN for it). The normal -DNO_CLEAN feature is broken and risky since it does not track a ton of the dependencies in the build such as the compiler, other build tools, csu/crt, CFLAGS, build commands, mk files, etc. Note that originally WITH_META_MODE initiated a new build system but that was renamed to WITH_DIRDEPS_BUILD and is something different entirel= y. The way that "meta mode" works is to enable the bmake "meta mode" feature that tracks the build command for each target and uses the filemon(4) [1] module to track all files read/written/executed for building target. If any of these change (see src.conf(5) WITH_META_MODE for details) then the target will be rebuilt. This means that even changes to CFLAGS or the cross compiler will be detected and cause rebuilds. This is quite an aggressive system but it works and removes the need for cleaning any of the tree. In this mode .depend.* files (WITH_FAST_DEPEND) are not generated since they are mostly redundant with filemon(4)'s tracking. An example in how powerful this is, is that I have today been testing buildworld with the in-tree clang and also doing builds on the same objdir with CROSS_TOOLCHAIN=3Damd64-gcc. Everything using a compiler would rebuild and anything not using a compiler would not rebuild. No cleaning needed. To use this you must either add WITH_META_MODE=3Dyes to your environment or add it into /etc/src-env.conf (not /etc/src.conf or /etc/make.conf). You will also need to load the filemon(4) module with 'kldload filemon'. The build will show far less information than the normal build but will otherwise follow the same flow as buildworld. If you wish to see the full output as before you can use -DNO_SILENT or add NO_SILENT=3Dyes to your /etc/src-env.conf. If a build error occurs you can view the .meta file for the target to see what the build command was. For example if you see 'Building /usr/obj/root/git/freebsd/world32/root/git/freebsd /lib/libdwarf/dwarf_arange.So' then see the file /usr/obj/root/git/freebsd/world32/root/git/freebsd/lib/libdwarf/dwarf_ara= nge.So.meta. If you wish to see why something is being rebuilt you can pass the -dM flag to make to see meta mode debug information. TODO: - There is currently a bug with library linking that can cause the next build to consider libraries out-of-date when they are not. It causes a chain reaction of relinking but not rebuilds. - Improve WORLDTMP populating such that it is not done redundantly. - It's possible rescue/rescue has some quirks still. [1] Over the years filemon(4) was quite unstable, insecure, and slow. A lot of work has gone into it over the past 6 months in each of these areas. After r300893 it should be fine for this use. --=20 Regards, Bryan Drewery --BEVLhl9gCjDQDIN5xWHaUKQpdA6q28qhB-- --Lhkh0vHaJdFXOMEpFo3pLgebOGDGVfN3R 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 iQEcBAEBAgAGBQJXSONZAAoJEDXXcbtuRpfPThcH/iyq1nysZeOxWh1fDy57Oi8H TTX6mn1ohLiQEqviIRp3ptGJJycfsi7zNsvqsdumh7ijn7NPFkQKd7pGiaMyHca2 hdCGf+izbgg10HvYScAj6PJnq9NJfUrGi3nuesr0VXVybigln9nk8ZJLMOG2ufkP Qllx7MJHSGD9OGTJYV0sF5l9Y8RZMk5SknWGqEZKRAKa4UJbg+kQfZUZL1Oy2562 a8NWgggJZQHbLrBDfqsJdRipKTrUPRLICPAYi0pMQpbHCXkS998NMjVkzvV4Tywr mUfg2Rtok/FEVAiZl7foTRlIcSBnhKAIjFyZST8N6Tm1+UjQb+GcgX6kDwzUcVQ= =/yRE -----END PGP SIGNATURE----- --Lhkh0vHaJdFXOMEpFo3pLgebOGDGVfN3R--