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