Re: WITHOUT_CLANG + WITHOUT_GCC vs XCC + WITHOUT_CROSS_COMPILER

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Fri, 17 May 2013 23:35:25 +0200
On May 17, 2013, at 22:46, Lev Serebryakov <lev_at_freebsd.org> wrote:
>  I've explored new options to build world and kernel with external
> compiler. My goal is not to use "modern" compiler or "true"
> cross-compilation, but fast building of system, which (almost)
> identical to host system and doesn't need compiler (NanoBSD image for
> router).
> 
> What I found, that if WITHOUT_LCNAG and WITHOUT_GCC are both set, and
> WITHOUT_CROSS_COMPILER and XCC/XCXX/XCPP are NOT set, world and
> kernel is build with "system" compiler, but without "cross" options
> (like -isystem and --sysroot). So, it works only by accident, and not
> in way, that user (developer) could expect.

For some historic reason, the cross-tools compiler is always built with
its default "sysroot" path set to ${WORLDTMP}.  I used quotes, because
it is not only about finding headers and libraries, but also to find
other toolchain binaries (cc1, as, ld and so on) under ${WORLDTMP}.  I
suspect this was all done before gcc and the other toolchain components
grew proper sysroot support.

Indeed, it would probably be better to revert that, and compile all
stages after cross-tools with --sysroot=${WORLDTMP} (and probably
-B${WORLDTMP}/usr/bin).  It might not be trivial to get this properly
working for all edge cases, though.


>   What I expected, that in such case cross-clang will be built at
> "stage 3: cross tools" and used to build world, but no clang (And
> support libraries) or gcc will be built at "stage 4.4: building
> everything".

Currently, if you set WITHOUT_CLANG, it will not build clang, not in any
stage.  Similar for WITHOUT_GCC.


>  Do we need such mode?

Well, if you are not interested in having any compilers (or toolchain
components) in your final world, they should not be built, right?


> Is current behavior (risky on, IMHO) Ok?

No, obviously not.  If you build world with "old" system headers (for
example when building head on stable/9), there will be trouble.


> I think, ideal situation is when WITHOUT_CLANG + WITHOUT_GCC but no
> WITHOUT_CROSS_COMPILER IS supported "as expected"
> (compiler-as-cross-tool is built, but compiler-as-part-of-everything
> is not), but at least system need to abort "both compilers are
> disabled and no cross-tools set" configuration for now, am I right?

Yes, a seatbelt would probably be wise for the time being.

-Dimitry
Received on Fri May 17 2013 - 19:35:30 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:37 UTC