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