UPDATING revision 1.19
1$NetBSD: UPDATING,v 1.19 2001/02/24 01:05:04 cgd 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 1120010219: 12 get/setprogname() added. Any hostprog's that may use this will need 13 to be bootstraped manually until the host system is current. 14 15 Known problems: sys/arch/macppc/stand/fixcoff 16 usr.sbin/config (adding -DMAKE_BOOTSTRAP to 17 CFLAGS and rebuilding should work) 18 1920010204: 20 prepare the code to compile with stricter gcc flags. in 21 particular start eliminating redundant declarations. Yacc 22 needs to be installed before make build. 23 2420010114: 25 introduce .if commands(target) in make(1). You need to 26 bring everything up-to-date first, then without installing 27 anything make and install in /usr/bin/make, then proceed 28 with make build. 29 3020010101: 31 bsd.subdir.mk committed 20001230 had a bug which caused 32 afterinstall targets to run too soon; update again. 33 3420001230: 35 New share/mk files needed to support .WAIT in SUBDIR variables. 36 If you get make errors, 37 (cd share/mk; make install) 38 Also, PRINTOBJDIR has changed and is now used more heavily. 39 4020001019: 41 The `ca' device driver has been replaced by `ld'; although the 42 major and minor numbers haven't changed, you should update your /dev 43 directory. 44 4520000929: 46 The following make directives are obsoleted. 47 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 48 By default, RSA is built into libcrypto. IDEA and RC5 will not be 49 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 50 additional library libcrypto_{idea,rc5}. 51 5220000623: 53 MKCRYPTO and friends added to share/mk/bsd.own.mk. 54 'cd share/mk ; make install' needed before make build. 55 56 57Hints for a more successful build: 58^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 59 Build a new kernel first: 60 This makes sure that any new system calls or features 61 expected by the new userland will be present. This 62 helps to avoid critical errors when upgrading. 63 Use object directories: 64 This helps to keep stale object 65 files from polluting the build if a Makefile "forgets" 66 about one. It also makes it easier to clean up after 67 a build. It's also necessary if you want to use the 68 same source tree for multiple machines. 69 To use object directories: 70 a) cd /usr/src ; make cleandir 71 b) Add "OBJMACHINE=yes" to /etc/mk.conf 72 c) Add "MKOBJDIRS=yes" to /etc/mk.conf 73 d) cd /usr/src ; make build 74 Note that running "make obj" in a directory will create 75 in obj.$MACHINE directory. 76 Build to a DESTDIR: 77 This helps to keep old 78 installed files (especially libraries) from interfering 79 with the new build. 80 To build to a DESTDIR, set the DESTDIR environment 81 variable before running make build. It should be set to 82 the pathname of an initially empty directory. 83 Problems: you might need to update critical utilities 84 without using DESTDIR since nothing is executed 85 from what is installed in DESTDIR. 86 (See critical utils, below) 87 Build often: 88 This keeps critical utilities current enough to not choke 89 on any other part of the source tree that depends on up to 90 date functionality. 91 92What to do if things don't work: 93^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 94When things don't work there is usually a few things that commonly 95should be done. 96 1) make includes 97 This should be done automatically by make build. 98 2) cd share/mk && make install 99 Again, automatically done by make build. 100 101Failsafe rebuild of a small part of the tree: 102^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 103To make sure you rebuild something correctly you want to do 104something like the following: 105 1) Make sure the includes and .mk files are up to date. 106 2) Make sure any program used to build the particular 107 utility is up to date. (yacc, lex, etc...) 108 3) cd ...path/to/util... 109 make cleandir 110 rm ...all obj directories... 111 make cleandir # yes, again 112 make obj 113 make depend && make 114 115Failsafe rebuild of the entire tree: 116^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 117If you really want to make sure the source tree is clean and 118ready for a build try the following. Note that sourcing /etc/mk.conf 119(a make(1) Makefile) in this manner is not right, and will not work 120for anyone who uses any make(1) features in /etc/mk.conf. 121 122---cut here--- 123#!/bin/sh 124. /etc/mk.conf 125 126if [ -z $BSDSRCDIR ] ; then 127 BSDSRCDIR=/usr/src 128fi 129if [ \! -d $BSDSRCDIR ] ; then 130 echo Unable to find sources 131 exit 1 132fi 133find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 134 135if [ -z $BSDOBJDIR ] ; then 136 BSDOBJDIR=/usr/obj 137fi 138if [ -d $BSDOBJDIR ] ; then 139 rm -rf $BSDOBJDIR 140fi 141 142cd $BSDSRCDIR && make cleandir 143 144---cut here--- 145 146Critical utilities: 147^^^^^^^^^^^^^^^^^^^ 148 gnu/usr.bin/egcs 149 usr.bin/compile_et 150 usr.bin/make 151 usr.bin/yacc 152 usr.bin/lex 153 usr.bin/xlint 154 usr.sbin/config 155 156Other problems and possibly solutions: 157^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 158Symptom:Unreasonable compiler errors. 159Fix: Rebuild gnu/usr.bin/egcs 160 161Symptom:Complaints involving a Makefile. 162Fix: Rebuild usr.bin/make: 163 cd usr.bin/make && make && make install 164 Or, a failsafe method if that doesn't work: 165 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 166 167Fix: Make sure .mk files are up to date. 168 cd share/mk && make install 169 170Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 171Fix: Rebuild usr.sbin/config 172 173Symptom: 174Fix: Rebuild usr.bin/yacc 175 176Symptom: 177Fix: Rebuild usr.bin/lex 178 179Symptom: 180Fix: rm /usr/lib/libbfd.a 181 182Symptom:Obsolete intermediate files are used during compilation 183Fix: Try the following sequence of commands in the directory in question. 184 make cleandir; rm `make print-objdir`; make cleandir; make obj 185 (If you built the tree without "make obj" in the past, obsolete files 186 may remain. The command tries to clean everything up) 187 188Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 189Fix: Rebuild and install usr.bin/menuc 190 191Symptom:mklocale not found during build in share/locale/ctype 192Fix: Build and install usr.bin/mklocale 193 194Symptom:undefined reference to `__assert13' 195Fix: Rebuild and install lib/libc 196 197Symptom:usr.sbin/config fails to build. 198Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 199 200Symptom:undefined reference to `getprogname' or `setprogname' 201Fix: Rebuild and install lib/libc 202