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