UPDATING revision 1.21
1$NetBSD: UPDATING,v 1.21 2001/03/06 19:00:59 jmc Exp $ 2 3This file is intended to be a brief introduction to the build 4process and a reference on what to do if something doesn't work. 5 6For a more detailed description see Makefile. 7 8Recent changes: 9^^^^^^^^^^^^^^^ 10 1120010226: 12 13 Added named group to /etc/group. Need to hand add this in or builds 14 will break as mtree aborts early. 15 16 To work around add by hand: 17 18 named:*:14: 19 20 to /etc/group before make build. 21 2220010219: 23 get/setprogname() added. Any hostprog's that may use this will need 24 to be bootstrapped manually until the host system is current. 25 26 Known problems: sys/arch/macppc/stand/fixcoff 27 usr.sbin/config (adding -DMAKE_BOOTSTRAP to 28 CFLAGS and rebuilding should work) 29 usr.sbin/mdsetimage - Build a static copy if 30 building a snapshot before fully bootstrapped. 31 3220010204: 33 prepare the code to compile with stricter gcc flags. in 34 particular start eliminating redundant declarations. Yacc 35 needs to be installed before make build. 36 3720010114: 38 introduce .if commands(target) in make(1). You need to 39 bring everything up-to-date first, then without installing 40 anything make and install in /usr/bin/make, then proceed 41 with make build. 42 4320010101: 44 bsd.subdir.mk committed 20001230 had a bug which caused 45 afterinstall targets to run too soon; update again. 46 4720001230: 48 New share/mk files needed to support .WAIT in SUBDIR variables. 49 If you get make errors, 50 (cd share/mk; make install) 51 Also, PRINTOBJDIR has changed and is now used more heavily. 52 5320001019: 54 The `ca' device driver has been replaced by `ld'; although the 55 major and minor numbers haven't changed, you should update your /dev 56 directory. 57 5820000929: 59 The following make directives are obsoleted. 60 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 61 By default, RSA is built into libcrypto. IDEA and RC5 will not be 62 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 63 additional library libcrypto_{idea,rc5}. 64 6520000623: 66 MKCRYPTO and friends added to share/mk/bsd.own.mk. 67 'cd share/mk ; make install' needed before make build. 68 69 70Hints for a more successful build: 71^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 72 Build a new kernel first: 73 This makes sure that any new system calls or features 74 expected by the new userland will be present. This 75 helps to avoid critical errors when upgrading. 76 Use object directories: 77 This helps to keep stale object 78 files from polluting the build if a Makefile "forgets" 79 about one. It also makes it easier to clean up after 80 a build. It's also necessary if you want to use the 81 same source tree for multiple machines. 82 To use object directories: 83 a) cd /usr/src ; make cleandir 84 b) Add "OBJMACHINE=yes" to /etc/mk.conf 85 c) Add "MKOBJDIRS=yes" to /etc/mk.conf 86 d) cd /usr/src ; make build 87 Note that running "make obj" in a directory will create 88 in obj.$MACHINE directory. 89 Build to a DESTDIR: 90 This helps to keep old 91 installed files (especially libraries) from interfering 92 with the new build. 93 To build to a DESTDIR, set the DESTDIR environment 94 variable before running make build. It should be set to 95 the pathname of an initially empty directory. 96 Problems: you might need to update critical utilities 97 without using DESTDIR since nothing is executed 98 from what is installed in DESTDIR. 99 (See critical utils, below) 100 Build often: 101 This keeps critical utilities current enough to not choke 102 on any other part of the source tree that depends on up to 103 date functionality. 104 105What to do if things don't work: 106^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 107When things don't work there is usually a few things that commonly 108should be done. 109 1) make includes 110 This should be done automatically by make build. 111 2) cd share/mk && make install 112 Again, automatically done by make build. 113 114Failsafe rebuild of a small part of the tree: 115^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 116To make sure you rebuild something correctly you want to do 117something like the following: 118 1) Make sure the includes and .mk files are up to date. 119 2) Make sure any program used to build the particular 120 utility is up to date. (yacc, lex, etc...) 121 3) cd ...path/to/util... 122 make cleandir 123 rm ...all obj directories... 124 make cleandir # yes, again 125 make obj 126 make depend && make 127 128Failsafe rebuild of the entire tree: 129^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 130If you really want to make sure the source tree is clean and 131ready for a build try the following. Note that sourcing /etc/mk.conf 132(a make(1) Makefile) in this manner is not right, and will not work 133for anyone who uses any make(1) features in /etc/mk.conf. 134 135---cut here--- 136#!/bin/sh 137. /etc/mk.conf 138 139if [ -z $BSDSRCDIR ] ; then 140 BSDSRCDIR=/usr/src 141fi 142if [ \! -d $BSDSRCDIR ] ; then 143 echo Unable to find sources 144 exit 1 145fi 146find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 147 148if [ -z $BSDOBJDIR ] ; then 149 BSDOBJDIR=/usr/obj 150fi 151if [ -d $BSDOBJDIR ] ; then 152 rm -rf $BSDOBJDIR 153fi 154 155cd $BSDSRCDIR && make cleandir 156 157---cut here--- 158 159Critical utilities: 160^^^^^^^^^^^^^^^^^^^ 161 gnu/usr.bin/egcs 162 usr.bin/compile_et 163 usr.bin/make 164 usr.bin/yacc 165 usr.bin/lex 166 usr.bin/xlint 167 usr.sbin/config 168 169Other problems and possibly solutions: 170^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 171Symptom:Unreasonable compiler errors. 172Fix: Rebuild gnu/usr.bin/egcs 173 174Symptom:Complaints involving a Makefile. 175Fix: Rebuild usr.bin/make: 176 cd usr.bin/make && make && make install 177 Or, a failsafe method if that doesn't work: 178 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 179 180Fix: Make sure .mk files are up to date. 181 cd share/mk && make install 182 183Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 184Fix: Rebuild usr.sbin/config 185 186Symptom: 187Fix: Rebuild usr.bin/yacc 188 189Symptom: 190Fix: Rebuild usr.bin/lex 191 192Symptom: 193Fix: rm /usr/lib/libbfd.a 194 195Symptom:Obsolete intermediate files are used during compilation 196Fix: Try the following sequence of commands in the directory in question. 197 make cleandir; rm `make print-objdir`; make cleandir; make obj 198 (If you built the tree without "make obj" in the past, obsolete files 199 may remain. The command tries to clean everything up) 200 201Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 202Fix: Rebuild and install usr.bin/menuc 203 204Symptom:mklocale not found during build in share/locale/ctype 205Fix: Build and install usr.bin/mklocale 206 207Symptom:undefined reference to `__assert13' 208Fix: Rebuild and install lib/libc 209 210Symptom:usr.sbin/config fails to build. 211Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 212 213Symptom:undefined reference to `getprogname' or `setprogname' 214Fix: Rebuild and install lib/libc 215