Home | History | Annotate | Line # | Download | only in src
UPDATING revision 1.32
      1 $NetBSD: UPDATING,v 1.32 2001/08/22 03:11:09 itojun Exp $
      2 
      3 This file is intended to be a brief introduction to the build
      4 process and a reference on what to do if something doesn't work.
      5 
      6 For a more detailed description see Makefile.
      7 
      8 Recent changes:
      9 ^^^^^^^^^^^^^^^
     10 
     11 20010814:
     12 	TOOLDIR must be set in /etc/mk.conf.
     13 	http://mail-index.netbsd.org/current-users/2001/08/14/0002.html
     14 
     15 20010803:
     16 	grep.info is now built from grep.texi using makeinfo.  Since it
     17 	requires makeinfo v4.0, you need to install new texinfo before
     18 	building gnu/usr.bin/grep.  To install new texinfo, please follow
     19 	the instruction described in 20010726 entry.
     20 
     21 20010803:
     22 	(i386 only): i386 kernel now uses new instructions like fxsave which
     23 	old gas doesn't understand.  To build the kernel successfuly, you
     24 	need to build and install new gas (gnu/usr.bin/gas.new).
     25 
     26 20010731:
     27 	Bootloader update on ELF platforms.  DDB in kernels from before
     28 	this will be unable to read symbol tables provided by newer
     29 	bootloaders.
     30 
     31 20010726:
     32 	Texinfo was updated to 4.0.  To avoid failures when trying to
     33 	build the included texinfo files, do:
     34 
     35 	cd src/gnu/usr.bin/texinfo
     36 	make MKINFO=no dependall install
     37 
     38 20010718:
     39 
     40 	Enabled correct .init/.fini processing in crt0.  The way this
     41 	was done was to change a -I directive to cc(1), which means
     42 	make(1) will have a stale dependency (it will be checking the
     43 	timestamp on the wrong "dot_init.h").
     44 
     45 	The symptom you will see is that new programs die with SIGSEGV
     46 	if you have a stale dependency.
     47 
     48 	Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
     49 	before starting your build.
     50 
     51 20010628:
     52 
     53 	A construct was added to uvm_page.h that uncovered a bug
     54 	in lint(1).  If you get a warning/error about a non-portable
     55 	bitfield, update your lint(1) before proceeding.
     56 
     57 20010226:
     58 
     59 	Added named user/group to system. Need to hand add this in or builds
     60 	will break as mtree aborts early.
     61 
     62 	To work around add by hand:
     63 
     64 	named:*:14:
     65 
     66 	to /etc/group and add:
     67 
     68 	named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
     69 
     70 	to master.passwd (use vipw for instance if doing by hand).
     71 
     72 	Now a make build should progress.
     73 
     74 20010219:
     75 	get/setprogname() added. Any hostprog's that may use this will need
     76         to be bootstrapped manually until the host system is current.
     77 
     78         Known problems: sys/arch/macppc/stand/fixcoff
     79 			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
     80 			  CFLAGS and rebuilding should work)
     81 			usr.sbin/mdsetimage - Build a static copy if
     82   		          building a snapshot before fully bootstrapped.
     83 
     84 20010204:
     85 	prepare the code to compile with stricter gcc flags. in
     86 	particular start eliminating redundant declarations. Yacc
     87 	needs to be installed before make build.
     88 
     89 20010114:
     90 	introduce .if commands(target) in make(1). You need to
     91 	bring everything up-to-date first, then without installing
     92 	anything make and install in usr.bin/make, then proceed
     93 	with make build.
     94 
     95 20010101:
     96 	bsd.subdir.mk committed 20001230 had a bug which caused
     97 	afterinstall targets to run too soon; update again.
     98 
     99 20001230:
    100 	New share/mk files needed to support .WAIT in SUBDIR variables.
    101 	If you get make errors, 
    102 		(cd share/mk; make install)
    103 	Also, PRINTOBJDIR has changed and is now used more heavily.
    104 
    105 20001019:
    106 	The `ca' device driver has been replaced by `ld'; although the
    107 	major and minor numbers haven't changed, you should update your /dev
    108 	directory.
    109 
    110 20000929:
    111 	The following make directives are obsoleted.
    112 	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
    113 	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
    114 	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
    115 	additional library libcrypto_{idea,rc5}.
    116 
    117 20000623:
    118 	MKCRYPTO and friends added to share/mk/bsd.own.mk.
    119 	'cd share/mk ; make install' needed before make build.
    120 
    121 
    122 Hints for a more successful build:
    123 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    124     Build a new kernel first:
    125 	This makes sure that any new system calls or features
    126 	   expected by the new userland will be present.  This
    127 	   helps to avoid critical errors when upgrading.
    128     Use object directories:
    129 	This helps to keep stale object
    130 	   files from polluting the build if a Makefile "forgets"
    131 	   about one.  It also makes it easier to clean up after
    132 	   a build.  It's also necessary if you want to use the
    133 	   same source tree for multiple machines.
    134 	   To use object directories:
    135 	    a) cd /usr/src ; make cleandir
    136 	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
    137 	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
    138 	    d) cd /usr/src ; make build
    139 	   Note that running "make obj" in a directory will create
    140 	   in obj.$MACHINE directory.
    141     Build to a DESTDIR:
    142 	This helps to keep old
    143 	   installed files (especially libraries) from interfering
    144 	   with the new build.
    145 	   To build to a DESTDIR, set the DESTDIR environment
    146 	   variable before running make build.  It should be set to
    147 	   the pathname of an initially empty directory.
    148 	   Problems: you might need to update critical utilities
    149 		without using DESTDIR since nothing is executed
    150 		from what is installed in DESTDIR.
    151 		(See critical utils, below)
    152     Build often:
    153 	This keeps critical utilities current enough to not choke
    154 	on any other part of the source tree that depends on up to
    155 	date functionality.
    156  
    157 What to do if things don't work:
    158 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    159 When things don't work there is usually a few things that commonly
    160 should be done.
    161     1)	make includes
    162 	This should be done automatically by make build.
    163     2)  cd share/mk && make install
    164 	Again, automatically done by make build.
    165 
    166 Failsafe rebuild of a small part of the tree:
    167 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    168 To make sure you rebuild something correctly you want to do
    169 something like the following:
    170     1)  Make sure the includes and .mk files are up to date.
    171     2)  Make sure any program used to build the particular
    172 	utility is up to date.  (yacc, lex, etc...)
    173     3)  cd ...path/to/util...
    174 	make cleandir
    175 	rm ...all obj directories...
    176 	make cleandir			# yes, again
    177 	make obj
    178 	make depend && make
    179 
    180 Failsafe rebuild of the entire tree:
    181 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    182 If you really want to make sure the source tree is clean and
    183 ready for a build try the following.  Note that sourcing /etc/mk.conf
    184 (a make(1) Makefile) in this manner is not right, and will not work
    185 for anyone who uses any make(1) features in /etc/mk.conf.
    186 
    187 ---cut here---
    188 #!/bin/sh
    189 . /etc/mk.conf
    190 
    191 if [ -z $BSDSRCDIR ] ; then
    192     BSDSRCDIR=/usr/src
    193 fi
    194 if [ \! -d $BSDSRCDIR ] ; then
    195     echo Unable to find sources
    196     exit 1
    197 fi
    198 find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
    199 
    200 if [ -z $BSDOBJDIR ] ; then
    201     BSDOBJDIR=/usr/obj
    202 fi
    203 if [ -d $BSDOBJDIR ] ; then
    204     rm -rf $BSDOBJDIR
    205 fi
    206 
    207 cd $BSDSRCDIR && make cleandir
    208 
    209 ---cut here---
    210 
    211 Critical utilities:
    212 ^^^^^^^^^^^^^^^^^^^
    213 	gnu/usr.bin/egcs
    214 	usr.bin/compile_et
    215 	usr.bin/make
    216 	usr.bin/yacc
    217 	usr.bin/lex
    218 	usr.bin/xlint
    219 	usr.sbin/config
    220 
    221 Other problems and possibly solutions:
    222 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    223 Symptom:Unreasonable compiler errors.
    224 Fix:	Rebuild gnu/usr.bin/egcs
    225 
    226 Symptom:Complaints involving a Makefile.
    227 Fix:	Rebuild usr.bin/make:
    228 	cd usr.bin/make && make && make install
    229         Or, a failsafe method if that doesn't work:
    230 	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
    231 
    232 Fix:	Make sure .mk files are up to date.
    233 	cd share/mk && make install
    234 
    235 Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
    236 Fix:	Rebuild usr.sbin/config
    237 
    238 Symptom:
    239 Fix:	Rebuild usr.bin/yacc
    240 
    241 Symptom:
    242 Fix:	Rebuild usr.bin/lex
    243 
    244 Symptom:
    245 Fix:	rm /usr/lib/libbfd.a
    246 
    247 Symptom:Obsolete intermediate files are used during compilation
    248 Fix:	Try the following sequence of commands in the directory in question.
    249 	make cleandir; rm `make print-objdir`; make cleandir; make obj
    250 	(If you built the tree without "make obj" in the past, obsolete files
    251 	may remain.  The command tries to clean everything up)
    252 
    253 Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
    254 Fix:	Rebuild and install usr.bin/menuc
    255 
    256 Symptom:mklocale not found during build in share/locale/ctype
    257 Fix:	Build and install usr.bin/mklocale
    258 
    259 Symptom:undefined reference to `__assert13'
    260 Fix:    Rebuild and install lib/libc
    261 
    262 Symptom:usr.sbin/config fails to build.
    263 Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
    264 
    265 Symptom:undefined reference to `getprogname' or `setprogname'
    266 Fix:    Rebuild and install lib/libc
    267 
    268 Symptom:lint does not understand the '-X' option
    269 Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
    270