UPDATING revision 1.5
1$NetBSD: UPDATING,v 1.5 2000/10/14 01:06:55 wiz 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 1120000929: 12 The following make directives are obsoleted. 13 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 14 By default, RSA is built into libcrypto. IDEA and RC5 will not be 15 bulit into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 16 additional library libcrypto_{idea,rc5}. 17 1820000623: 19 MKCRYPTO and friends added to share/mk/bsd.own.mk. 20 'cd share/mk ; make install' needed before make build. 21 22 23Hints for a more successful build: 24^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 Build a new kernel first: 26 This makes sure that any new system calls or features 27 expected by the new userland will be present. This 28 helps to avoid critical errors when upgrading. 29 Use object directories: 30 This helps to keep stale object 31 files from polluting the build if a Makefile "forgets" 32 about one. It also makes it easier to clean up after 33 a build. It's also necessary if you want to use the 34 same source tree for multiple machines. 35 To use object directories: 36 a) cd /usr/src ; make cleandir 37 b) Add "OBJMACHINE=yes" to /etc/mk.conf 38 c) Add "MKOBJDIRS=yes" to /etc/mk.conf 39 d) cd /usr/src ; make build 40 Note that running "make obj" in a directory will create 41 in obj.$MACHINE directory. 42 Build to a DESTDIR: 43 This helps to keep old 44 installed files (especially libraries) from interfering 45 with the new build. 46 To build to a DESTDIR, set the DESTDIR environment 47 variable before running make build. It should be set to 48 the pathname of an initially empty directory. 49 Problems: you might need to update critical utilities 50 without using DESTDIR since nothing is executed 51 from what is installed in DESTDIR. 52 (See critical utils, below) 53 Build often: 54 This keeps critical utilities current enough to not choke 55 on any other part of the source tree that depends on up to 56 date functionality. 57 58What to do if things don't work: 59^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 60When things don't work there is usually a few things that commonly 61should be done. 62 1) make includes 63 This should be done automatically by make build. 64 2) cd share/mk && make install 65 Again, automatically done by make build. 66 67Failsafe rebuild of a small part of the tree: 68^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 69To make sure you rebuild something correctly you want to do 70something like the following: 71 1) Make sure the includes and .mk files are up to date. 72 2) Make sure any program used to build the particular 73 utility is up to date. (yacc, lex, etc...) 74 3) cd ...path/to/util... 75 make cleandir 76 rm ...all obj directories... 77 make cleandir # yes, again 78 make obj 79 make depend && make 80 81Failsafe rebuild of the entire tree: 82^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 83If you really want to make sure the source tree is clean and 84ready for a build try the following. Note that sourcing /etc/mk.conf 85(a make(1) Makefile) in this manner is not right, and will not work 86for anyone who uses any make(1) features in /etc/mk.conf. 87 88---cut here--- 89#!/bin/sh 90. /etc/mk.conf 91 92if [ -z $BSDSRCDIR ] ; then 93 BSDSRCDIR=/usr/src 94fi 95if [ \! -d $BSDSRCDIR ] ; then 96 echo Unable to find sources 97 exit 1 98fi 99find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 100 101if [ -z $BSDOBJDIR ] ; then 102 BSDOBJDIR=/usr/obj 103fi 104if [ -d $BSDOBJDIR ] ; then 105 rm -rf $BSDOBJDIR 106fi 107 108cd $BSDSRCDIR && make cleandir 109 110---cut here--- 111 112Critical utilities: 113^^^^^^^^^^^^^^^^^^^ 114 gnu/usr.bin/egcs 115 usr.bin/compile_et 116 usr.bin/make 117 usr.bin/yacc 118 usr.bin/lex 119 usr.sbin/config 120 121Other problems and possibly solutions: 122^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 123Symptom:Unreasonable compiler errors. 124Fix: Rebuild gnu/usr.bin/egcs 125 126Symptom:Complaints involving a Makefile. 127Fix: Make sure .mk files are up to date. 128 cd share/mk && make install 129Fix: Rebuild usr.bin/make 130 131Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 132Fix: Rebuild usr.sbin/config 133 134Symptom: 135Fix: Rebuild usr.bin/yacc 136 137Symptom: 138Fix: Rebuild usr.bin/lex 139 140Symptom: 141Fix: rm /usr/lib/libbfd.a 142 143Symptom:Obsolete intermediate files are used during compilation 144Fix: Try the following sequence of commands in the directory in question. 145 make cleandir; rm `make print-objdir`; make cleandir; make obj 146 (If you built the tree without "make obj" in the past, obsolete files 147 may remain. The command tries to clean everything up) 148 149Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 150Fix: Rebuild and install usr.bin/menuc 151