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