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