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