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