Re: why does buildkernel set COMPILER_TYPE?

From: Ian Lepore <ian_at_FreeBSD.org>
Date: Thu, 22 Aug 2013 12:27:20 -0600
On Thu, 2013-08-22 at 09:23 -0700, John-Mark Gurney wrote:
> Dimitry Andric wrote this message on Thu, Aug 22, 2013 at 08:59 +0200:
> > On Aug 22, 2013, at 06:04, John-Mark Gurney <jmg_at_funkthat.com> wrote:
> > > I've noticed that if you do a:
> > > make buildworld WITHOUT_CLANG_IS_CC=YES
> > > 
> > > and then do a:
> > > make buildkernel
> > > 
> > > (w/o the WITHOUT_CLANG_IS_CC=YES option)
> > > that it fails...  
> > 
> > Why don't you just put the WITHOUT_CLANG_IS_CC setting in /etc/src.conf,
> > where it belongs?  That would save you this trouble.
> 
> Except that I'm testing code that needs to work both with clang and
> gcc...  Putting an option like that in /etc/src.conf is bad as I'm
> likely to forget it, plus it'll effect other trees which isn't good...
> 
> > I don't think we should support building different parts of the tree
> > with incompatible settings.  E.g. compiling part of the tree using
> > WITH_FOO, and some other part using WITHOUT_FOO is *not* supposed to
> > work properly.
> 
> Do we have a file that is source in /usr/src (or where your source tree
> is located) that we can put these options in?
> 

You can put them in any file you want, and point to it with SRCCONF= on
the command line.  It doesn't make sense to define a standard location
within the source tree, because it has to be possible to build from a
read-only tree, and also that still doesn't address the problem of
"today I want to build this source with gcc, tomorrow I want to build
the same source with clang without modifying anything in the source
tree."

It might be kind of nice if by default the build system looked first
in ../etc/ rather than /etc for {make,src}.conf, then you could have an
etc directory "associated with the source" but maintain the readonly
nature of src/ itself.  Likewise look first for ../obj instead
of /usr/obj.  This is basically what I do, but it requires me to have a
wrapper script that sets up the make command line with all the right
overrides to use the build config based on where I usually keep it "in
association with the source" which for me is a directory named config/
at the same level as src/ that's being built.

-- Ian

> When we finally are able to build and install all as a normal user
> (which we are getting close now), /etc/src.conf is a really bad place
> to put these things....
> 
> > > Apparently instead of letting buildkernel figure out
> > > which compiler it will use, the src/Makefile.inc1 forces COMPILER_TYPE
> > > to be what the options specified instead of using what bsd.compiler.mk
> > > figures out...
> > 
> > This was added by brooks in r240468 (and further developed in r250659
> > where he added external compiler support), with what I assume is the
> > explanation in the commit message:
> > 
> > "To avoid negative performance impacts in the default case and correct
> > value for COMPILER_TYPE type is determined and passed in the environment
> > of submake instances while building world."
> > 
> > So I suspect this is really on purpose.  Brooks, any comments? :)
> 
> Except that KMAKEENV just blindly takes all of WMAKEENV...  I
> understand why WMAKEENV would have COMPILER_TYPE, I'm just puzzled why
> we don't let KMAKEENV figure out the correct one...
> 
Received on Thu Aug 22 2013 - 16:27:31 UTC

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