Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Apr 2013 01:06:42 +0200
From:      deeptech71 <deeptech71@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: building world and kernel without ebuilding ("bootstrap"?) clang?
Message-ID:  <51634D82.9060901@gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51634D82.9060901>