UPDATING revision 1.59
1$NetBSD: UPDATING,v 1.59 2002/04/29 08:36:20 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 1120020426: 12 etc/postinstall added, which performs various checks for 13 configuration file updates and changes, and can fix most of 14 the problems identified. 15 This should make it much easier to upgrade a system's 16 configuration from earlier systems (as far back as NetBSD 1.5). 17 1820020320: 19 <bsd.lib.mk> needs a new install(1) for it's "-a cmd" support. 20 build and install at usr.bin/xinstall before the build. 21 2220020319: 23 raw IPv6 socket now makes strict checking for sa_family and sa_len 24 on send(2) operation. be sure to have sbin/rtsol and usr.sbin/rtsold 25 newer than November 2001 when you upgrade the kernel. 26 2720020311: 28 ssh configuration files were moved from /etc to /etc/ssh. Beware 29 if you restart your machine from remote. Note that sshd.conf needs 30 to be changed (due to the use of "/etc" inside). 31 3220020223: 33 Users of the VAX port will need to rebuild and install gas 34 so it deal with the now present register prefix used in all 35 the VAX assembly files. 36 3720020118: 38 39 ntpd user/group has been added. Need to hand add this in or builds 40 will break as mtree aborts early. 41 42 Add the following into /etc/group: 43 44 ntpd:*:15: 45 46 and the following to /etc/master.passwd (via vipw): 47 48 ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin 49 5020011207: 51 52 If you're attempting to build a snapshot on sparc64 and are getting 53 reloc errors from the toolchain groff binary this means your native 54 toolchain has some broken C++ bits. 55 56 To fix: 57 58 Build a new toolchain (i.e. build.sh -t) 59 Use the new toolchain to build and install natively (i.e. /usr/lib) 60 61 gnu/lib/libgcc 62 gnu/lib/libstdc++ 63 64 After this a snapshot will be able to be built. 65 6620011201: 67 In order for a sparc64 build to work you must have a working awk. If 68 you've built and installed a system with the new toolchain up to this 69 point you do not have a working awk as its ability to do floating 70 point is broken. 71 72 To build: 73 74 remake and install gnu/lib/libgcc 75 remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links 76 against the new libgcc.a) 77 7820011128: 79 Kernel config information was changed to use defflag in 80 the various "files" files. Bug fixes to config(8) are 81 required in order for this to work properly. Make sure 82 to build and install in usr.sbin/config before attempting 83 to build a new kernel. 84 8520011030: 86 libc/locale/wcstod.c now needs new lint(1). Update lint(1) 87 before building libc. 88 8920011029: 90 The new document BUILDING.mdoc (view with nroff | more, or 91 see pre-generated .txt and .html versions) describes the build 92 procedure in great detail. BUILDING, and the USE_NEW_TOOLCHAIN 93 build process, are intended in the long run to replace this 94 manual update log. 95 96 Users building a USE_NEW_TOOLCHAIN system should read the 97 BUILDING document for caveats. Generally, BUILDING supersedes 98 UPDATING for these systems, as tool updating is taken care of 99 by the new build system. 100 10120011028: 102 src/etc/Makefile now needs install to be able to handle 103 symlinks that point to nowhere. A bug in install that 104 prevented this was corrected. 105 106 Solution: update and reinstall usr.bin/xinstall 107 Better Solution: Use the new toolchain and it will just work 108 for you. 109 11020011006: 111 /etc/mtree/NetBSD.dist has been updated to take advantage of 112 absolute path support added to mtree(8). Older mtree(8)s don't 113 understand the format. 114 115 Solution: update and reinstall usr.sbin/mtree 116 11720011004: 118 Crunchgen has been updated to work via reach-over makefiles. Updating 119 is suggested before running a snapshot build 120 12120010915: 122 The new "ubcperf" code committed by Chuck Silvers removed 123 a header file, uvm/uvm_vnode.h. There may be stale .depend 124 files that still reference this file. 125 126 Solution: "make cleandir && make dependall" in affected 127 directories. 128 12920010803: 130 grep.info is now built from grep.texi using makeinfo. Since it 131 requires makeinfo v4.0, you need to install new texinfo before 132 building gnu/usr.bin/grep. To install new texinfo, please follow 133 the instruction described in 20010726 entry. 134 13520010803: 136 (i386 only): i386 kernel now uses new instructions like 137 `fxsave' which old gas doesn't understand. To build the 138 kernel successfully, you need to build and install new gas 139 (gnu/usr.bin/gas.new), or (temporarily) comment out 140 "options I686_CPU" from your kernel configuration until you 141 rebuilt your userland (and got a new gas). 142 14320010731: 144 Bootloader update on ELF platforms. DDB in kernels from before 145 this will be unable to read symbol tables provided by newer 146 bootloaders. 147 14820010726: 149 Texinfo was updated to 4.0. To avoid failures when trying to 150 build the included texinfo files, do: 151 152 cd src/gnu/usr.bin/texinfo 153 make MKINFO=no dependall install 154 15520010718: 156 Enabled correct .init/.fini processing in crt0. The way this 157 was done was to change a -I directive to cc(1), which means 158 make(1) will have a stale dependency (it will be checking the 159 timestamp on the wrong "dot_init.h"). 160 161 The symptom you will see is that new programs die with SIGSEGV 162 if you have a stale dependency. 163 164 Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so 165 before starting your build. 166 16720010628: 168 A construct was added to uvm_page.h that uncovered a bug 169 in lint(1). If you get a warning/error about a non-portable 170 bitfield, update your lint(1) before proceeding. 171 17220010226: 173 Added named user/group to system. Need to hand add this in or builds 174 will break as mtree aborts early. 175 176 To work around add by hand: 177 178 named:*:14: 179 180 to /etc/group and add: 181 182 named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin 183 184 to master.passwd (use vipw for instance if doing by hand). 185 186 Now a make build should progress. 187 18820010219: 189 get/setprogname() added. Any hostprogs that may use this will need 190 to be bootstrapped manually until the host system is current. 191 192 Known problems: sys/arch/macppc/stand/fixcoff 193 usr.sbin/config (adding -DMAKE_BOOTSTRAP to 194 CFLAGS and rebuilding should work) 195 usr.sbin/mdsetimage - Build a static copy if 196 building a snapshot before fully bootstrapped. 197 19820010204: 199 prepare the code to compile with stricter gcc flags. in 200 particular start eliminating redundant declarations. Yacc 201 needs to be installed before make build. 202 20320010114: 204 introduce .if commands(target) in make(1). You need to 205 bring everything up-to-date first, then without installing 206 anything make and install in usr.bin/make, then proceed 207 with make build. 208 20920010101: 210 bsd.subdir.mk committed 20001230 had a bug which caused 211 afterinstall targets to run too soon; update again. 212 21320001230: 214 New share/mk files needed to support .WAIT in SUBDIR variables. 215 If you get make errors, 216 (cd share/mk; make install) 217 Also, PRINTOBJDIR has changed and is now used more heavily. 218 21920001019: 220 The `ca' device driver has been replaced by `ld'; although the 221 major and minor numbers haven't changed, you should update your /dev 222 directory. 223 22420000929: 225 The following make directives are obsoleted. 226 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 227 By default, RSA is built into libcrypto. IDEA and RC5 will not be 228 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 229 additional library libcrypto_{idea,rc5}. 230 231 232Hints for a more successful build: 233^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 234 Build a new kernel first: 235 This makes sure that any new system calls or features 236 expected by the new userland will be present. This 237 helps to avoid critical errors when upgrading. 238 Use object directories: 239 This helps to keep stale object 240 files from polluting the build if a Makefile "forgets" 241 about one. It also makes it easier to clean up after 242 a build. It's also necessary if you want to use the 243 same source tree for multiple machines. 244 To use object directories: 245 a) cd /usr/src ; make cleandir 246 b) Add "OBJMACHINE=yes" to /etc/mk.conf 247 c) Add "MKOBJDIRS=yes" to /etc/mk.conf 248 d) cd /usr/src ; make build 249 Note that running "make obj" in a directory will create 250 in obj.$MACHINE directory. 251 Build to a DESTDIR: 252 This helps to keep old 253 installed files (especially libraries) from interfering 254 with the new build. 255 To build to a DESTDIR, set the DESTDIR environment 256 variable before running make build. It should be set to 257 the pathname of an initially empty directory. 258 Problems: you might need to update critical utilities 259 without using DESTDIR since nothing is executed 260 from what is installed in DESTDIR. 261 (See critical utils, below) 262 Build often: 263 This keeps critical utilities current enough to not choke 264 on any other part of the source tree that depends on up to 265 date functionality. 266 267What to do if things don't work: 268^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 269When things don't work there is usually a few things that commonly 270should be done. 271 1) make includes 272 This should be done automatically by make build. 273 2) cd share/mk && make install 274 Again, automatically done by make build. 275 276Failsafe rebuild of a small part of the tree: 277^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 278To make sure you rebuild something correctly you want to do 279something like the following: 280 1) Make sure the includes and .mk files are up to date. 281 2) Make sure any program used to build the particular 282 utility is up to date. (yacc, lex, etc...) 283 3) cd ...path/to/util... 284 make cleandir 285 rm ...all obj directories... 286 make cleandir # yes, again 287 make obj 288 make depend && make 289 290Failsafe rebuild of the entire tree: 291^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 292If you really want to make sure the source tree is clean and 293ready for a build try the following. Note that sourcing /etc/mk.conf 294(a make(1) Makefile) in this manner is not right, and will not work 295for anyone who uses any make(1) features in /etc/mk.conf. 296 297---cut here--- 298#!/bin/sh 299. /etc/mk.conf 300 301if [ -z $NETBSDSRCDIR ] ; then 302 NETBSDSRCDIR=/usr/src 303fi 304if [ \! -d $NETBSDSRCDIR ] ; then 305 echo Unable to find sources 306 exit 1 307fi 308find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 309 310if [ -z $BSDOBJDIR ] ; then 311 BSDOBJDIR=/usr/obj 312fi 313if [ -d $BSDOBJDIR ] ; then 314 rm -rf $BSDOBJDIR 315fi 316 317cd $NETBSDSRCDIR && make cleandir 318 319---cut here--- 320 321Critical utilities: 322^^^^^^^^^^^^^^^^^^^ 323 gnu/usr.bin/egcs 324 usr.bin/compile_et 325 usr.bin/make 326 usr.bin/yacc 327 usr.bin/lex 328 usr.bin/xlint 329 usr.sbin/config 330 331Other problems and possible solutions: 332^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 333Symptom:Unreasonable compiler errors. 334Fix: Rebuild gnu/usr.bin/egcs 335 336Symptom:Complaints involving a Makefile. 337Fix: Rebuild usr.bin/make: 338 cd usr.bin/make && make && make install 339 Or, a failsafe method if that doesn't work: 340 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 341 342Fix: Make sure .mk files are up to date. 343 cd share/mk && make install 344 345Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 346Fix: Rebuild usr.sbin/config 347 348Symptom: 349Fix: Rebuild usr.bin/yacc 350 351Symptom: 352Fix: Rebuild usr.bin/lex 353 354Symptom: 355Fix: rm /usr/lib/libbfd.a 356 357Symptom:Obsolete intermediate files are used during compilation 358Fix: Try the following sequence of commands in the directory in question. 359 make cleandir; rm `make print-objdir`; make cleandir; make obj 360 (If you built the tree without "make obj" in the past, obsolete files 361 may remain. The command tries to clean everything up) 362 363Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 364Fix: Rebuild and install usr.bin/menuc 365 366Symptom:mklocale not found during build in share/locale/ctype 367Fix: Build and install usr.bin/mklocale 368 369Symptom:undefined reference to `__assert13' 370Fix: Rebuild and install lib/libc 371 372Symptom:usr.sbin/config fails to build. 373Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 374 375Symptom:undefined reference to `getprogname' or `setprogname' 376Fix: Rebuild and install lib/libc 377 378Symptom:lint does not understand the '-X' option 379Fix: May need to build & install libs with NOLINT=1 before rebuilding lint 380