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