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