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