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