Home | History | Annotate | Line # | Download | only in src
UPDATING revision 1.39
      1 $NetBSD: UPDATING,v 1.39 2001/10/04 04:27:48 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 20011004:
     12 
     13 	Crunchgen has been updated to work via reach-over makefiles. Updating
     14 	is suggested before running a snapshot build
     15 
     16 20010922:
     17 	The new toolchain is enabled on i386.  This new build method
     18 	is intended to make all the upgrade issues elsewhere in UPDATING
     19 	obsolete (stay tuned...).
     20 
     21 	i386 platform builds must now set TOOLDIR in mk.conf or the
     22 	environment in order to build the system.  This is a pathname
     23 	where host build tools will be installed, and must NOT be
     24 	the same as src/tools.
     25 
     26 	(Optionally, USETOOLS=no can be set in the environment if you
     27 	wish to avoid using the separate host toolchain for building a
     28 	subtree.  Otherwise, this will default to "yes" automatically.)
     29 
     30 20010915:
     31 	The new "ubcperf" code committed by Chuck Silvers removed
     32 	a header file, uvm/uvm_vnode.h.  There may be stale .depend
     33 	files that still reference this file.
     34 
     35 	Solution: "make cleandir && make dependall" in affected
     36 	directories.
     37 
     38 20010803:
     39 	grep.info is now built from grep.texi using makeinfo.  Since it
     40 	requires makeinfo v4.0, you need to install new texinfo before
     41 	building gnu/usr.bin/grep.  To install new texinfo, please follow
     42 	the instruction described in 20010726 entry.
     43 
     44 20010803:
     45 	(i386 only): i386 kernel now uses new instructions like fxsave which
     46 	old gas doesn't understand.  To build the kernel successfuly, you
     47 	need to build and install new gas (gnu/usr.bin/gas.new).
     48 
     49 20010731:
     50 	Bootloader update on ELF platforms.  DDB in kernels from before
     51 	this will be unable to read symbol tables provided by newer
     52 	bootloaders.
     53 
     54 20010726:
     55 	Texinfo was updated to 4.0.  To avoid failures when trying to
     56 	build the included texinfo files, do:
     57 
     58 	cd src/gnu/usr.bin/texinfo
     59 	make MKINFO=no dependall install
     60 
     61 20010718:
     62 
     63 	Enabled correct .init/.fini processing in crt0.  The way this
     64 	was done was to change a -I directive to cc(1), which means
     65 	make(1) will have a stale dependency (it will be checking the
     66 	timestamp on the wrong "dot_init.h").
     67 
     68 	The symptom you will see is that new programs die with SIGSEGV
     69 	if you have a stale dependency.
     70 
     71 	Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
     72 	before starting your build.
     73 
     74 20010628:
     75 
     76 	A construct was added to uvm_page.h that uncovered a bug
     77 	in lint(1).  If you get a warning/error about a non-portable
     78 	bitfield, update your lint(1) before proceeding.
     79 
     80 20010226:
     81 
     82 	Added named user/group to system. Need to hand add this in or builds
     83 	will break as mtree aborts early.
     84 
     85 	To work around add by hand:
     86 
     87 	named:*:14:
     88 
     89 	to /etc/group and add:
     90 
     91 	named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
     92 
     93 	to master.passwd (use vipw for instance if doing by hand).
     94 
     95 	Now a make build should progress.
     96 
     97 20010219:
     98 	get/setprogname() added. Any hostprog's that may use this will need
     99         to be bootstrapped manually until the host system is current.
    100 
    101         Known problems: sys/arch/macppc/stand/fixcoff
    102 			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
    103 			  CFLAGS and rebuilding should work)
    104 			usr.sbin/mdsetimage - Build a static copy if
    105   		          building a snapshot before fully bootstrapped.
    106 
    107 20010204:
    108 	prepare the code to compile with stricter gcc flags. in
    109 	particular start eliminating redundant declarations. Yacc
    110 	needs to be installed before make build.
    111 
    112 20010114:
    113 	introduce .if commands(target) in make(1). You need to
    114 	bring everything up-to-date first, then without installing
    115 	anything make and install in usr.bin/make, then proceed
    116 	with make build.
    117 
    118 20010101:
    119 	bsd.subdir.mk committed 20001230 had a bug which caused
    120 	afterinstall targets to run too soon; update again.
    121 
    122 20001230:
    123 	New share/mk files needed to support .WAIT in SUBDIR variables.
    124 	If you get make errors, 
    125 		(cd share/mk; make install)
    126 	Also, PRINTOBJDIR has changed and is now used more heavily.
    127 
    128 20001019:
    129 	The `ca' device driver has been replaced by `ld'; although the
    130 	major and minor numbers haven't changed, you should update your /dev
    131 	directory.
    132 
    133 20000929:
    134 	The following make directives are obsoleted.
    135 	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
    136 	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
    137 	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
    138 	additional library libcrypto_{idea,rc5}.
    139 
    140 20000623:
    141 	MKCRYPTO and friends added to share/mk/bsd.own.mk.
    142 	'cd share/mk ; make install' needed before make build.
    143 
    144 
    145 Hints for a more successful build:
    146 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    147     Build a new kernel first:
    148 	This makes sure that any new system calls or features
    149 	   expected by the new userland will be present.  This
    150 	   helps to avoid critical errors when upgrading.
    151     Use object directories:
    152 	This helps to keep stale object
    153 	   files from polluting the build if a Makefile "forgets"
    154 	   about one.  It also makes it easier to clean up after
    155 	   a build.  It's also necessary if you want to use the
    156 	   same source tree for multiple machines.
    157 	   To use object directories:
    158 	    a) cd /usr/src ; make cleandir
    159 	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
    160 	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
    161 	    d) cd /usr/src ; make build
    162 	   Note that running "make obj" in a directory will create
    163 	   in obj.$MACHINE directory.
    164     Build to a DESTDIR:
    165 	This helps to keep old
    166 	   installed files (especially libraries) from interfering
    167 	   with the new build.
    168 	   To build to a DESTDIR, set the DESTDIR environment
    169 	   variable before running make build.  It should be set to
    170 	   the pathname of an initially empty directory.
    171 	   Problems: you might need to update critical utilities
    172 		without using DESTDIR since nothing is executed
    173 		from what is installed in DESTDIR.
    174 		(See critical utils, below)
    175     Build often:
    176 	This keeps critical utilities current enough to not choke
    177 	on any other part of the source tree that depends on up to
    178 	date functionality.
    179  
    180 What to do if things don't work:
    181 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    182 When things don't work there is usually a few things that commonly
    183 should be done.
    184     1)	make includes
    185 	This should be done automatically by make build.
    186     2)  cd share/mk && make install
    187 	Again, automatically done by make build.
    188 
    189 Failsafe rebuild of a small part of the tree:
    190 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    191 To make sure you rebuild something correctly you want to do
    192 something like the following:
    193     1)  Make sure the includes and .mk files are up to date.
    194     2)  Make sure any program used to build the particular
    195 	utility is up to date.  (yacc, lex, etc...)
    196     3)  cd ...path/to/util...
    197 	make cleandir
    198 	rm ...all obj directories...
    199 	make cleandir			# yes, again
    200 	make obj
    201 	make depend && make
    202 
    203 Failsafe rebuild of the entire tree:
    204 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    205 If you really want to make sure the source tree is clean and
    206 ready for a build try the following.  Note that sourcing /etc/mk.conf
    207 (a make(1) Makefile) in this manner is not right, and will not work
    208 for anyone who uses any make(1) features in /etc/mk.conf.
    209 
    210 ---cut here---
    211 #!/bin/sh
    212 . /etc/mk.conf
    213 
    214 if [ -z $BSDSRCDIR ] ; then
    215     BSDSRCDIR=/usr/src
    216 fi
    217 if [ \! -d $BSDSRCDIR ] ; then
    218     echo Unable to find sources
    219     exit 1
    220 fi
    221 find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
    222 
    223 if [ -z $BSDOBJDIR ] ; then
    224     BSDOBJDIR=/usr/obj
    225 fi
    226 if [ -d $BSDOBJDIR ] ; then
    227     rm -rf $BSDOBJDIR
    228 fi
    229 
    230 cd $BSDSRCDIR && make cleandir
    231 
    232 ---cut here---
    233 
    234 Critical utilities:
    235 ^^^^^^^^^^^^^^^^^^^
    236 	gnu/usr.bin/egcs
    237 	usr.bin/compile_et
    238 	usr.bin/make
    239 	usr.bin/yacc
    240 	usr.bin/lex
    241 	usr.bin/xlint
    242 	usr.sbin/config
    243 
    244 Other problems and possible solutions:
    245 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    246 Symptom:Unreasonable compiler errors.
    247 Fix:	Rebuild gnu/usr.bin/egcs
    248 
    249 Symptom:Complaints involving a Makefile.
    250 Fix:	Rebuild usr.bin/make:
    251 	cd usr.bin/make && make && make install
    252         Or, a failsafe method if that doesn't work:
    253 	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
    254 
    255 Fix:	Make sure .mk files are up to date.
    256 	cd share/mk && make install
    257 
    258 Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
    259 Fix:	Rebuild usr.sbin/config
    260 
    261 Symptom:
    262 Fix:	Rebuild usr.bin/yacc
    263 
    264 Symptom:
    265 Fix:	Rebuild usr.bin/lex
    266 
    267 Symptom:
    268 Fix:	rm /usr/lib/libbfd.a
    269 
    270 Symptom:Obsolete intermediate files are used during compilation
    271 Fix:	Try the following sequence of commands in the directory in question.
    272 	make cleandir; rm `make print-objdir`; make cleandir; make obj
    273 	(If you built the tree without "make obj" in the past, obsolete files
    274 	may remain.  The command tries to clean everything up)
    275 
    276 Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
    277 Fix:	Rebuild and install usr.bin/menuc
    278 
    279 Symptom:mklocale not found during build in share/locale/ctype
    280 Fix:	Build and install usr.bin/mklocale
    281 
    282 Symptom:undefined reference to `__assert13'
    283 Fix:    Rebuild and install lib/libc
    284 
    285 Symptom:usr.sbin/config fails to build.
    286 Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
    287 
    288 Symptom:undefined reference to `getprogname' or `setprogname'
    289 Fix:    Rebuild and install lib/libc
    290 
    291 Symptom:lint does not understand the '-X' option
    292 Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
    293