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