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