Building clang in buildworld as part of the bootstrap process -- is it really necessary?

Warner Losh imp at bsdimp.com
Sat Sep 6 03:16:12 UTC 2014


On Sep 5, 2014, at 8:21 PM, Garrett Cooper <yaneurabeya at gmail.com> wrote:

> Hi all,
>    One of the questions that came up from a co-worker is "why do I
> need to build clang in buildworld if I already installed it from
> ports"? I could see some valid reasons for doing this (one needs a
> cross-compiler, one might need specific options that might not be set
> in the ports version), but for native builds I would tend to agree
> with this logic. With gcc it was wasteful building the compiler each
> buildworld, but with clang it seems annoying continuing on this path
> because the compile takes a long time to complete.

The clang built during buildworld is used to bootstrap. So it is required sometimes. Usually when there’s a binary compatibility issue, which is rare but does happen. It is also installed as cc.

The ports clang may or may not build the world. However, if you want to say “I know what I’m doing” you can set WITHOUT_CLANG_BOOTSTRAP and WITHOUT_GCC_BOOTSTRAP to tell the build to do no building of bootstrap tools and to use the host’s instead. This usually works, but may fail from time to time with port-built compilers.

If you don’t want buildworld to build any compiler, you can add WITHOUT_CLANG=t and WITHOUT_GCC=t. This will create the system without any compilers. You’ll need to set CC to /usr/local/bin/clang35 or whatever as well. There may be other settings you need as well.

>    Alternatively, would anyone be opposed to adding some logic to
> automatically bypass the bootstrap compiler, i.e. add some logic to
> Makefile.inc1 that would skip compiling clang/gcc if and only if the
> target triplet and version met some required values?

There’s enough violent opposition to this that it will never happen. buildworld is supposed to always be safe. Don’t mess with that. It isn’t designed to be fast. If you want fast, you can tell it to be fast with different options, but it will never be fast by default because we guessed that we think it might be safe. don’t mess with buildworld. There might be support for a go-fast catch-all flag that sets a bunch of other flags to make things go fast, but once you get down that rabbit hole you’ll find one man’s optimization is another woman’s intolerable omission.

tl;dr: NO.

Warner

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20140905/ca3a6648/attachment.sig>


More information about the freebsd-toolchain mailing list