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