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