UPDATING revision 1.42
1$NetBSD: UPDATING,v 1.42 2001/10/29 01:46:25 perry 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 8Note that users of the new toolchain in many instances will not 9experience the problems listed below because their host tools are 10automatically generated for them. 11 12Recent changes: 13^^^^^^^^^^^^^^^ 14 1520011028: 16 src/etc/Makefile now needs install to be able to handle 17 symlinks that point to nowhere. A bug in install that 18 prevented this was corrected. 19 20 Solution: update and reinstall usr.bin/xinstall 21 Better Solution: Use the new toolchain and it will just work 22 for you. 23 2420011006: 25 /etc/mtree/NetBSD.dist has been updated to take advantage of 26 absolute path support added to mtree(8). Older mtree(8)s don't 27 understand the format. 28 29 Solution: update and reinstall usr.sbin/mtree 30 3120011004: 32 33 Crunchgen has been updated to work via reach-over makefiles. Updating 34 is suggested before running a snapshot build 35 3620010922: 37 The new toolchain is enabled on i386. This new build method 38 is intended to make all the upgrade issues elsewhere in UPDATING 39 obsolete (stay tuned...). 40 41 i386 platform builds must now set TOOLDIR in mk.conf or the 42 environment in order to build the system. This is a pathname 43 where host build tools will be installed, and must NOT be 44 the same as src/tools. 45 46 (Optionally, USETOOLS=no can be set in the environment if you 47 wish to avoid using the separate host toolchain for building a 48 subtree. Otherwise, this will default to "yes" automatically.) 49 5020010915: 51 The new "ubcperf" code committed by Chuck Silvers removed 52 a header file, uvm/uvm_vnode.h. There may be stale .depend 53 files that still reference this file. 54 55 Solution: "make cleandir && make dependall" in affected 56 directories. 57 5820010803: 59 grep.info is now built from grep.texi using makeinfo. Since it 60 requires makeinfo v4.0, you need to install new texinfo before 61 building gnu/usr.bin/grep. To install new texinfo, please follow 62 the instruction described in 20010726 entry. 63 6420010803: 65 (i386 only): i386 kernel now uses new instructions like 66 `fxsave' which old gas doesn't understand. To build the 67 kernel successfuly, you need to build and install new gas 68 (gnu/usr.bin/gas.new), or (temporarily) comment out 69 "options I686_CPU" from your kernel configuration until you 70 rebuilt your userland (and got a new gas). 71 7220010731: 73 Bootloader update on ELF platforms. DDB in kernels from before 74 this will be unable to read symbol tables provided by newer 75 bootloaders. 76 7720010726: 78 Texinfo was updated to 4.0. To avoid failures when trying to 79 build the included texinfo files, do: 80 81 cd src/gnu/usr.bin/texinfo 82 make MKINFO=no dependall install 83 8420010718: 85 86 Enabled correct .init/.fini processing in crt0. The way this 87 was done was to change a -I directive to cc(1), which means 88 make(1) will have a stale dependency (it will be checking the 89 timestamp on the wrong "dot_init.h"). 90 91 The symptom you will see is that new programs die with SIGSEGV 92 if you have a stale dependency. 93 94 Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so 95 before starting your build. 96 9720010628: 98 99 A construct was added to uvm_page.h that uncovered a bug 100 in lint(1). If you get a warning/error about a non-portable 101 bitfield, update your lint(1) before proceeding. 102 10320010226: 104 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 16320000623: 164 MKCRYPTO and friends added to share/mk/bsd.own.mk. 165 'cd share/mk ; make install' needed before make build. 166 167 168Hints for a more successful build: 169^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 170 Build a new kernel first: 171 This makes sure that any new system calls or features 172 expected by the new userland will be present. This 173 helps to avoid critical errors when upgrading. 174 Use object directories: 175 This helps to keep stale object 176 files from polluting the build if a Makefile "forgets" 177 about one. It also makes it easier to clean up after 178 a build. It's also necessary if you want to use the 179 same source tree for multiple machines. 180 To use object directories: 181 a) cd /usr/src ; make cleandir 182 b) Add "OBJMACHINE=yes" to /etc/mk.conf 183 c) Add "MKOBJDIRS=yes" to /etc/mk.conf 184 d) cd /usr/src ; make build 185 Note that running "make obj" in a directory will create 186 in obj.$MACHINE directory. 187 Build to a DESTDIR: 188 This helps to keep old 189 installed files (especially libraries) from interfering 190 with the new build. 191 To build to a DESTDIR, set the DESTDIR environment 192 variable before running make build. It should be set to 193 the pathname of an initially empty directory. 194 Problems: you might need to update critical utilities 195 without using DESTDIR since nothing is executed 196 from what is installed in DESTDIR. 197 (See critical utils, below) 198 Build often: 199 This keeps critical utilities current enough to not choke 200 on any other part of the source tree that depends on up to 201 date functionality. 202 203What to do if things don't work: 204^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 205When things don't work there is usually a few things that commonly 206should be done. 207 1) make includes 208 This should be done automatically by make build. 209 2) cd share/mk && make install 210 Again, automatically done by make build. 211 212Failsafe rebuild of a small part of the tree: 213^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 214To make sure you rebuild something correctly you want to do 215something like the following: 216 1) Make sure the includes and .mk files are up to date. 217 2) Make sure any program used to build the particular 218 utility is up to date. (yacc, lex, etc...) 219 3) cd ...path/to/util... 220 make cleandir 221 rm ...all obj directories... 222 make cleandir # yes, again 223 make obj 224 make depend && make 225 226Failsafe rebuild of the entire tree: 227^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 228If you really want to make sure the source tree is clean and 229ready for a build try the following. Note that sourcing /etc/mk.conf 230(a make(1) Makefile) in this manner is not right, and will not work 231for anyone who uses any make(1) features in /etc/mk.conf. 232 233---cut here--- 234#!/bin/sh 235. /etc/mk.conf 236 237if [ -z $BSDSRCDIR ] ; then 238 BSDSRCDIR=/usr/src 239fi 240if [ \! -d $BSDSRCDIR ] ; then 241 echo Unable to find sources 242 exit 1 243fi 244find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 245 246if [ -z $BSDOBJDIR ] ; then 247 BSDOBJDIR=/usr/obj 248fi 249if [ -d $BSDOBJDIR ] ; then 250 rm -rf $BSDOBJDIR 251fi 252 253cd $BSDSRCDIR && make cleandir 254 255---cut here--- 256 257Critical utilities: 258^^^^^^^^^^^^^^^^^^^ 259 gnu/usr.bin/egcs 260 usr.bin/compile_et 261 usr.bin/make 262 usr.bin/yacc 263 usr.bin/lex 264 usr.bin/xlint 265 usr.sbin/config 266 267Other problems and possible solutions: 268^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 269Symptom:Unreasonable compiler errors. 270Fix: Rebuild gnu/usr.bin/egcs 271 272Symptom:Complaints involving a Makefile. 273Fix: Rebuild usr.bin/make: 274 cd usr.bin/make && make && make install 275 Or, a failsafe method if that doesn't work: 276 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 277 278Fix: Make sure .mk files are up to date. 279 cd share/mk && make install 280 281Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 282Fix: Rebuild usr.sbin/config 283 284Symptom: 285Fix: Rebuild usr.bin/yacc 286 287Symptom: 288Fix: Rebuild usr.bin/lex 289 290Symptom: 291Fix: rm /usr/lib/libbfd.a 292 293Symptom:Obsolete intermediate files are used during compilation 294Fix: Try the following sequence of commands in the directory in question. 295 make cleandir; rm `make print-objdir`; make cleandir; make obj 296 (If you built the tree without "make obj" in the past, obsolete files 297 may remain. The command tries to clean everything up) 298 299Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 300Fix: Rebuild and install usr.bin/menuc 301 302Symptom:mklocale not found during build in share/locale/ctype 303Fix: Build and install usr.bin/mklocale 304 305Symptom:undefined reference to `__assert13' 306Fix: Rebuild and install lib/libc 307 308Symptom:usr.sbin/config fails to build. 309Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 310 311Symptom:undefined reference to `getprogname' or `setprogname' 312Fix: Rebuild and install lib/libc 313 314Symptom:lint does not understand the '-X' option 315Fix: May need to build & install libs with NOLINT=1 before rebuilding lint 316