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