UPDATING revision 1.46
1$NetBSD: UPDATING,v 1.46 2001/11/28 18:53:34 thorpej 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^^^^^^^^^^^^^^^ 1020011128: 11 Kernel config information was changed to use defflag in 12 the various "files" files. Bug fixes to config(8) are 13 required in order for this to work properly. Make sure 14 to build and install in usr.sbin/config before attempting 15 to build a new kernel. 16 1720011030: 18 libc/locale/wcstod.c now needs new lint(1). Update lint(1) 19 before building libc. 20 2120011029: 22 The new document BUILDING.mdoc (view with nroff | more, or 23 see pre-generated .txt and .html versions) describes the build 24 procedure in great detail. BUILDING, and the USE_NEW_TOOLCHAIN 25 build process, are intended in the long run to replace this 26 manual update log. 27 28 Users building a USE_NEW_TOOLCHAIN system should read the 29 BUILDING document for caveats. Generally, BUILDING supersedes 30 UPDATING for these systems, as tool updating is taken care of 31 by the new build system. 32 3320011028: 34 src/etc/Makefile now needs install to be able to handle 35 symlinks that point to nowhere. A bug in install that 36 prevented this was corrected. 37 38 Solution: update and reinstall usr.bin/xinstall 39 Better Solution: Use the new toolchain and it will just work 40 for you. 41 4220011006: 43 /etc/mtree/NetBSD.dist has been updated to take advantage of 44 absolute path support added to mtree(8). Older mtree(8)s don't 45 understand the format. 46 47 Solution: update and reinstall usr.sbin/mtree 48 4920011004: 50 Crunchgen has been updated to work via reach-over makefiles. Updating 51 is suggested before running a snapshot build 52 5320010915: 54 The new "ubcperf" code committed by Chuck Silvers removed 55 a header file, uvm/uvm_vnode.h. There may be stale .depend 56 files that still reference this file. 57 58 Solution: "make cleandir && make dependall" in affected 59 directories. 60 6120010803: 62 grep.info is now built from grep.texi using makeinfo. Since it 63 requires makeinfo v4.0, you need to install new texinfo before 64 building gnu/usr.bin/grep. To install new texinfo, please follow 65 the instruction described in 20010726 entry. 66 6720010803: 68 (i386 only): i386 kernel now uses new instructions like 69 `fxsave' which old gas doesn't understand. To build the 70 kernel successfuly, you need to build and install new gas 71 (gnu/usr.bin/gas.new), or (temporarily) comment out 72 "options I686_CPU" from your kernel configuration until you 73 rebuilt your userland (and got a new gas). 74 7520010731: 76 Bootloader update on ELF platforms. DDB in kernels from before 77 this will be unable to read symbol tables provided by newer 78 bootloaders. 79 8020010726: 81 Texinfo was updated to 4.0. To avoid failures when trying to 82 build the included texinfo files, do: 83 84 cd src/gnu/usr.bin/texinfo 85 make MKINFO=no dependall install 86 8720010718: 88 Enabled correct .init/.fini processing in crt0. The way this 89 was done was to change a -I directive to cc(1), which means 90 make(1) will have a stale dependency (it will be checking the 91 timestamp on the wrong "dot_init.h"). 92 93 The symptom you will see is that new programs die with SIGSEGV 94 if you have a stale dependency. 95 96 Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so 97 before starting your build. 98 9920010628: 100 A construct was added to uvm_page.h that uncovered a bug 101 in lint(1). If you get a warning/error about a non-portable 102 bitfield, update your lint(1) before proceeding. 103 10420010226: 105 Added named user/group to system. Need to hand add this in or builds 106 will break as mtree aborts early. 107 108 To work around add by hand: 109 110 named:*:14: 111 112 to /etc/group and add: 113 114 named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin 115 116 to master.passwd (use vipw for instance if doing by hand). 117 118 Now a make build should progress. 119 12020010219: 121 get/setprogname() added. Any hostprog's that may use this will need 122 to be bootstrapped manually until the host system is current. 123 124 Known problems: sys/arch/macppc/stand/fixcoff 125 usr.sbin/config (adding -DMAKE_BOOTSTRAP to 126 CFLAGS and rebuilding should work) 127 usr.sbin/mdsetimage - Build a static copy if 128 building a snapshot before fully bootstrapped. 129 13020010204: 131 prepare the code to compile with stricter gcc flags. in 132 particular start eliminating redundant declarations. Yacc 133 needs to be installed before make build. 134 13520010114: 136 introduce .if commands(target) in make(1). You need to 137 bring everything up-to-date first, then without installing 138 anything make and install in usr.bin/make, then proceed 139 with make build. 140 14120010101: 142 bsd.subdir.mk committed 20001230 had a bug which caused 143 afterinstall targets to run too soon; update again. 144 14520001230: 146 New share/mk files needed to support .WAIT in SUBDIR variables. 147 If you get make errors, 148 (cd share/mk; make install) 149 Also, PRINTOBJDIR has changed and is now used more heavily. 150 15120001019: 152 The `ca' device driver has been replaced by `ld'; although the 153 major and minor numbers haven't changed, you should update your /dev 154 directory. 155 15620000929: 157 The following make directives are obsoleted. 158 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 159 By default, RSA is built into libcrypto. IDEA and RC5 will not be 160 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 161 additional library libcrypto_{idea,rc5}. 162 163 164Hints for a more successful build: 165^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 166 Build a new kernel first: 167 This makes sure that any new system calls or features 168 expected by the new userland will be present. This 169 helps to avoid critical errors when upgrading. 170 Use object directories: 171 This helps to keep stale object 172 files from polluting the build if a Makefile "forgets" 173 about one. It also makes it easier to clean up after 174 a build. It's also necessary if you want to use the 175 same source tree for multiple machines. 176 To use object directories: 177 a) cd /usr/src ; make cleandir 178 b) Add "OBJMACHINE=yes" to /etc/mk.conf 179 c) Add "MKOBJDIRS=yes" to /etc/mk.conf 180 d) cd /usr/src ; make build 181 Note that running "make obj" in a directory will create 182 in obj.$MACHINE directory. 183 Build to a DESTDIR: 184 This helps to keep old 185 installed files (especially libraries) from interfering 186 with the new build. 187 To build to a DESTDIR, set the DESTDIR environment 188 variable before running make build. It should be set to 189 the pathname of an initially empty directory. 190 Problems: you might need to update critical utilities 191 without using DESTDIR since nothing is executed 192 from what is installed in DESTDIR. 193 (See critical utils, below) 194 Build often: 195 This keeps critical utilities current enough to not choke 196 on any other part of the source tree that depends on up to 197 date functionality. 198 199What to do if things don't work: 200^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 201When things don't work there is usually a few things that commonly 202should be done. 203 1) make includes 204 This should be done automatically by make build. 205 2) cd share/mk && make install 206 Again, automatically done by make build. 207 208Failsafe rebuild of a small part of the tree: 209^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 210To make sure you rebuild something correctly you want to do 211something like the following: 212 1) Make sure the includes and .mk files are up to date. 213 2) Make sure any program used to build the particular 214 utility is up to date. (yacc, lex, etc...) 215 3) cd ...path/to/util... 216 make cleandir 217 rm ...all obj directories... 218 make cleandir # yes, again 219 make obj 220 make depend && make 221 222Failsafe rebuild of the entire tree: 223^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 224If you really want to make sure the source tree is clean and 225ready for a build try the following. Note that sourcing /etc/mk.conf 226(a make(1) Makefile) in this manner is not right, and will not work 227for anyone who uses any make(1) features in /etc/mk.conf. 228 229---cut here--- 230#!/bin/sh 231. /etc/mk.conf 232 233if [ -z $BSDSRCDIR ] ; then 234 BSDSRCDIR=/usr/src 235fi 236if [ \! -d $BSDSRCDIR ] ; then 237 echo Unable to find sources 238 exit 1 239fi 240find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 241 242if [ -z $BSDOBJDIR ] ; then 243 BSDOBJDIR=/usr/obj 244fi 245if [ -d $BSDOBJDIR ] ; then 246 rm -rf $BSDOBJDIR 247fi 248 249cd $BSDSRCDIR && make cleandir 250 251---cut here--- 252 253Critical utilities: 254^^^^^^^^^^^^^^^^^^^ 255 gnu/usr.bin/egcs 256 usr.bin/compile_et 257 usr.bin/make 258 usr.bin/yacc 259 usr.bin/lex 260 usr.bin/xlint 261 usr.sbin/config 262 263Other problems and possible solutions: 264^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 265Symptom:Unreasonable compiler errors. 266Fix: Rebuild gnu/usr.bin/egcs 267 268Symptom:Complaints involving a Makefile. 269Fix: Rebuild usr.bin/make: 270 cd usr.bin/make && make && make install 271 Or, a failsafe method if that doesn't work: 272 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 273 274Fix: Make sure .mk files are up to date. 275 cd share/mk && make install 276 277Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 278Fix: Rebuild usr.sbin/config 279 280Symptom: 281Fix: Rebuild usr.bin/yacc 282 283Symptom: 284Fix: Rebuild usr.bin/lex 285 286Symptom: 287Fix: rm /usr/lib/libbfd.a 288 289Symptom:Obsolete intermediate files are used during compilation 290Fix: Try the following sequence of commands in the directory in question. 291 make cleandir; rm `make print-objdir`; make cleandir; make obj 292 (If you built the tree without "make obj" in the past, obsolete files 293 may remain. The command tries to clean everything up) 294 295Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 296Fix: Rebuild and install usr.bin/menuc 297 298Symptom:mklocale not found during build in share/locale/ctype 299Fix: Build and install usr.bin/mklocale 300 301Symptom:undefined reference to `__assert13' 302Fix: Rebuild and install lib/libc 303 304Symptom:usr.sbin/config fails to build. 305Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 306 307Symptom:undefined reference to `getprogname' or `setprogname' 308Fix: Rebuild and install lib/libc 309 310Symptom:lint does not understand the '-X' option 311Fix: May need to build & install libs with NOLINT=1 before rebuilding lint 312