UPDATING revision 1.25
1$NetBSD: UPDATING,v 1.25 2001/07/23 05:49:09 thorpej 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 1120010718: 12 13 Enabled correct .init/.fini processing in crt0. The way this 14 was done was to change a -I directive to cc(1), which means 15 make(1) will have a stale dependency (it will be checking the 16 timestamp on the wrong "dot_init.h"). 17 18 The symptom you will see is that new programs die with SIGSEGV 19 if you have a stale dependency. 20 21 Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so 22 before starting your build. 23 2420010226: 25 26 Added named user/group to system. Need to hand add this in or builds 27 will break as mtree aborts early. 28 29 To work around add by hand: 30 31 named:*:14: 32 33 to /etc/group and add: 34 35 named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin 36 37 to master.passwd (use vipw for instance if doing by hand). 38 39 Now a make build should progress. 40 4120010219: 42 get/setprogname() added. Any hostprog's that may use this will need 43 to be bootstrapped manually until the host system is current. 44 45 Known problems: sys/arch/macppc/stand/fixcoff 46 usr.sbin/config (adding -DMAKE_BOOTSTRAP to 47 CFLAGS and rebuilding should work) 48 usr.sbin/mdsetimage - Build a static copy if 49 building a snapshot before fully bootstrapped. 50 5120010204: 52 prepare the code to compile with stricter gcc flags. in 53 particular start eliminating redundant declarations. Yacc 54 needs to be installed before make build. 55 5620010114: 57 introduce .if commands(target) in make(1). You need to 58 bring everything up-to-date first, then without installing 59 anything make and install in usr.bin/make, then proceed 60 with make build. 61 6220010101: 63 bsd.subdir.mk committed 20001230 had a bug which caused 64 afterinstall targets to run too soon; update again. 65 6620001230: 67 New share/mk files needed to support .WAIT in SUBDIR variables. 68 If you get make errors, 69 (cd share/mk; make install) 70 Also, PRINTOBJDIR has changed and is now used more heavily. 71 7220001019: 73 The `ca' device driver has been replaced by `ld'; although the 74 major and minor numbers haven't changed, you should update your /dev 75 directory. 76 7720000929: 78 The following make directives are obsoleted. 79 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 80 By default, RSA is built into libcrypto. IDEA and RC5 will not be 81 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 82 additional library libcrypto_{idea,rc5}. 83 8420000623: 85 MKCRYPTO and friends added to share/mk/bsd.own.mk. 86 'cd share/mk ; make install' needed before make build. 87 88 89Hints for a more successful build: 90^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 91 Build a new kernel first: 92 This makes sure that any new system calls or features 93 expected by the new userland will be present. This 94 helps to avoid critical errors when upgrading. 95 Use object directories: 96 This helps to keep stale object 97 files from polluting the build if a Makefile "forgets" 98 about one. It also makes it easier to clean up after 99 a build. It's also necessary if you want to use the 100 same source tree for multiple machines. 101 To use object directories: 102 a) cd /usr/src ; make cleandir 103 b) Add "OBJMACHINE=yes" to /etc/mk.conf 104 c) Add "MKOBJDIRS=yes" to /etc/mk.conf 105 d) cd /usr/src ; make build 106 Note that running "make obj" in a directory will create 107 in obj.$MACHINE directory. 108 Build to a DESTDIR: 109 This helps to keep old 110 installed files (especially libraries) from interfering 111 with the new build. 112 To build to a DESTDIR, set the DESTDIR environment 113 variable before running make build. It should be set to 114 the pathname of an initially empty directory. 115 Problems: you might need to update critical utilities 116 without using DESTDIR since nothing is executed 117 from what is installed in DESTDIR. 118 (See critical utils, below) 119 Build often: 120 This keeps critical utilities current enough to not choke 121 on any other part of the source tree that depends on up to 122 date functionality. 123 124What to do if things don't work: 125^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 126When things don't work there is usually a few things that commonly 127should be done. 128 1) make includes 129 This should be done automatically by make build. 130 2) cd share/mk && make install 131 Again, automatically done by make build. 132 133Failsafe rebuild of a small part of the tree: 134^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 135To make sure you rebuild something correctly you want to do 136something like the following: 137 1) Make sure the includes and .mk files are up to date. 138 2) Make sure any program used to build the particular 139 utility is up to date. (yacc, lex, etc...) 140 3) cd ...path/to/util... 141 make cleandir 142 rm ...all obj directories... 143 make cleandir # yes, again 144 make obj 145 make depend && make 146 147Failsafe rebuild of the entire tree: 148^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 149If you really want to make sure the source tree is clean and 150ready for a build try the following. Note that sourcing /etc/mk.conf 151(a make(1) Makefile) in this manner is not right, and will not work 152for anyone who uses any make(1) features in /etc/mk.conf. 153 154---cut here--- 155#!/bin/sh 156. /etc/mk.conf 157 158if [ -z $BSDSRCDIR ] ; then 159 BSDSRCDIR=/usr/src 160fi 161if [ \! -d $BSDSRCDIR ] ; then 162 echo Unable to find sources 163 exit 1 164fi 165find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 166 167if [ -z $BSDOBJDIR ] ; then 168 BSDOBJDIR=/usr/obj 169fi 170if [ -d $BSDOBJDIR ] ; then 171 rm -rf $BSDOBJDIR 172fi 173 174cd $BSDSRCDIR && make cleandir 175 176---cut here--- 177 178Critical utilities: 179^^^^^^^^^^^^^^^^^^^ 180 gnu/usr.bin/egcs 181 usr.bin/compile_et 182 usr.bin/make 183 usr.bin/yacc 184 usr.bin/lex 185 usr.bin/xlint 186 usr.sbin/config 187 188Other problems and possibly solutions: 189^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 190Symptom:Unreasonable compiler errors. 191Fix: Rebuild gnu/usr.bin/egcs 192 193Symptom:Complaints involving a Makefile. 194Fix: Rebuild usr.bin/make: 195 cd usr.bin/make && make && make install 196 Or, a failsafe method if that doesn't work: 197 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 198 199Fix: Make sure .mk files are up to date. 200 cd share/mk && make install 201 202Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 203Fix: Rebuild usr.sbin/config 204 205Symptom: 206Fix: Rebuild usr.bin/yacc 207 208Symptom: 209Fix: Rebuild usr.bin/lex 210 211Symptom: 212Fix: rm /usr/lib/libbfd.a 213 214Symptom:Obsolete intermediate files are used during compilation 215Fix: Try the following sequence of commands in the directory in question. 216 make cleandir; rm `make print-objdir`; make cleandir; make obj 217 (If you built the tree without "make obj" in the past, obsolete files 218 may remain. The command tries to clean everything up) 219 220Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 221Fix: Rebuild and install usr.bin/menuc 222 223Symptom:mklocale not found during build in share/locale/ctype 224Fix: Build and install usr.bin/mklocale 225 226Symptom:undefined reference to `__assert13' 227Fix: Rebuild and install lib/libc 228 229Symptom:usr.sbin/config fails to build. 230Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 231 232Symptom:undefined reference to `getprogname' or `setprogname' 233Fix: Rebuild and install lib/libc 234 235Symptom:lint does not understand the '-X' option 236Fix: May need to build & install libs with NOLINT=1 before rebuilding lint 237