Build is polluted by host build environment.

From: Mark Murray <markm_at_FreeBSD.org>
Date: Sat, 13 Jun 2009 18:30:43 +0100
Hi folks

The "buildworld" build is polluted by the build environment.

Specifically, headers in /user/include/... are used when I believe they
should not be. This could easily break cross-builds, and may compromise
upgrades where /usr/include/... contains some damaging ancient history.

To see this in action, you need to move /usr/include out of the way
after the build-tools are built, but before the target buid starts for
real. I AM NOT WORRIED ABOUT BUILD-TOOLS OR BOOTSTRAPPING TOOLS! :-)

This patch achieves the desired result with a dirty hack. NOTE!! You
will need to move your /usr/include.NOTNOW back to /usr/include in the
likely event of a failure.

After applying this, do a "make cleandir" then "make buildworld". DON'T
use the "-j N" option to make.

------------------------------8<--------------------------------
Index: Makefile.inc1
===================================================================
--- Makefile.inc1       (revision 194122)
+++ Makefile.inc1       (working copy)
_at__at_ -498,6 +501,14 _at__at_
        cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
 .endif

+_break_base_dependancies:
+       mv /usr/include /usr/include.NOTNOW
+       # Something for libraries also?
+
+_fix_base_dependancies:
+       mv /usr/include.NOTNOW /usr/include
+       # Something for libraries also?
+
 WMAKE_TGTS=
 .if !defined(SUBDIR_OVERRIDE)
 WMAKE_TGTS+=   _worldtmp _legacy _bootstrap-tools
_at__at_ -506,9 +517,11 _at__at_
 .if !defined(SUBDIR_OVERRIDE)
 WMAKE_TGTS+=   _cross-tools
 .endif
+WMAKE_TGTS+=   _break_base_dependancies
 WMAKE_TGTS+=   _includes _libraries _depend everything
 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
 WMAKE_TGTS+=   build32
+WMAKE_TGTS+=   _fix_base_dependancies
 .endif

 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue

------------------------------8<--------------------------------
The first failure that I see is

===> gnu/usr.bin/cc/cc_tools (depend)
make: don't know how to make /usr/include/stdarg.h. Stop
*** Error code 2


There are many more if I hack my way past that one.

I believe that the "_includes _libraries _depend everything build32"
targets should all be in an effective "-nostdinc" environment once the
"real" build gets underway, with only the ${SRC}/include/... and friends
being visible to the build by explicit -I$FOO options to the build.

I haven't checked, but libraries may have a similar issue.

Comments?

M
-- 
Mark R V Murray
Cert APS(Open) Dip Phys(Open) BSc Open(Open) BSc(Hons)(Open)
Received on Sat Jun 13 2009 - 15:35:07 UTC

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