building world and kernel without ebuilding ("bootstrap"?) clang?

deeptech71 deeptech71 at gmail.com
Mon Apr 8 22:07:51 UTC 2013


Lev Serebryakov wrote:
> Is it possible to build NanoBSD faster? Use system compiler, and don't build bootstrap compiler at all?

There are some issues when building "updated" sources [1]. There was a thread about adding support for an "external" compiler [2], but that yielded a non-working solution [3].



1. Add the following or similar to /etc/make.conf:

CC=/full/path/to/clang
CPP=/full/path/to/clang-cpp
CXX=/full/path/to/clang++

Note: make sure clang-cpp or similar exists.

2. Add the following to /etc/src.conf:

WITHOUT_GCC=1
WITHOUT_CLANG=1

Note: ``make delete-old'' will prompt you to remove the compilers.

3. In case of an "external", modern version of Clang, remove its header files that are already present in the system at /usr/include (eg., stdio.h).

4. Selectively apply to the source tree (all are required for my purposes):

Index: usr.bin/xlint/llib/Makefile
===================================================================
--- usr.bin/xlint/llib/Makefile (revision 249254)
+++ usr.bin/xlint/llib/Makefile (working copy)
@@ -9,9 +9,9 @@
  CLEANFILES+= ${LIBS}
  
  llib-lposix.ln: llib-lposix
-       ${LINT} ${LINTFLAGS} -Cposix ${.ALLSRC}
+       CC=${CC:Q} ${LINT} ${LINTFLAGS} -Cposix ${.ALLSRC}
  
  llib-lstdc.ln: llib-lstdc
-       ${LINT} ${LINTFLAGS} -Cstdc ${.ALLSRC}
+       CC=${CC:Q} ${LINT} ${LINTFLAGS} -Cstdc ${.ALLSRC}
  
  .include <bsd.prog.mk>
Index: Makefile.inc1
===================================================================
--- Makefile.inc1       (revision 249254)
+++ Makefile.inc1       (working copy)
@@ -680,7 +680,7 @@
  ITOOLS=        [ awk cap_mkdb cat chflags chmod chown \
         date echo egrep find grep id install ${_install-info} \
         ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
-       rm sed sh sysctl test true uname wc ${_zoneinfo}
+       rm sed sh sysctl test true uname wc ${_zoneinfo} cp btxld dd ls
  
  #
  # distributeworld
Index: sys/conf/kern.mk
===================================================================
--- sys/conf/kern.mk    (revision 249254)
+++ sys/conf/kern.mk    (working copy)
@@ -5,7 +5,7 @@
  #
  CWARNFLAGS?=   -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
                 -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
-               -Wundef -Wno-pointer-sign -fformat-extensions \
+               -Wundef -Wno-pointer-sign -Wno-format \
                 -Wmissing-include-dirs -fdiagnostics-show-option \
                 ${CWARNEXTRA}
  #

5. If need be, use the following fake script as Clang (required for my purposes):

#!/bin/sh
/path/to/real/clang --sysroot=/usr/obj/tmp "$@" || /path/to/real/clang "$@"

6. If there are still build errors, yell that FreeBSD sux.



And let these seemingly-retarded instructions be a warning to all active developers. (What a nice day for a flame war!)



[1] http://lists.freebsd.org/pipermail/freebsd-current/2013-February/040160.html
[2] http://lists.freebsd.org/pipermail/freebsd-arch/2013-February/014055.html
[3] http://people.freebsd.org/~brooks/patches/xcc3.diff


More information about the freebsd-hackers mailing list