Home | History | Annotate | Line # | Download | only in src
UPDATING revision 1.74
      1 $NetBSD: UPDATING,v 1.74 2002/11/20 04:36:43 jschauma 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 20021011:
     12 	Systrace has been improved to support privilege elevation.
     13 	Updating the kernel requires the userland part of systrace
     14 	to be rebuild.
     15 
     16 20021010:
     17 	The config(8) grammar was changed to allow options to register
     18 	dependencies on attributes, as well as other options.  Users
     19 	must update and reinstall usr.sbin/config before building a new
     20 	kernel.
     21 
     22 20021009:
     23 	A new attribute dependency syntax was introduced to config(8),
     24 	which is now used by the SCSI configuration description.  Users
     25 	must update and reinstall usr.sbin/config before building a new
     26 	kernel.
     27 
     28 20021003:
     29 	Several changes have been made to the autoconfiguration
     30 	framework.  Users must update and reinstall usr.sbin/config
     31 	before building a new kernel.
     32 
     33 20021001:
     34 	The i386mp branch has been merged.  To compile a kernel, users
     35 	will need to add the option 'cpu* at mainbus?' to their configuration
     36 	file.  Multiprocessor kernels will need
     37 	ioapic*		at mainbus? apid ?
     38 	options		MULTIPROCESSOR
     39 	options		COM_MPLOCK
     40 
     41 20020922:
     42 	MKDYNAMICROOT=yes enabled by default, which means that
     43 	certain shared libraries are installed into /lib, the shared
     44 	linker is installed into /libexec, and all programs in /bin
     45 	and /sbin are dynamically linked.
     46 	If you do not use "make build", you should ensure that
     47 	you have the libraries and shared linker in the new locations,
     48 	with:
     49 		make do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.elf_so
     50 
     51 20020917:
     52 	USE_NEW_TOOLCHAIN has been replaced with:
     53 	    -	TOOLCHAIN_MISSING -- set to "yes" on platforms for which
     54 		there is no working in-tree toolchain (hppa, ns32k, sh5,
     55 		x86_64).
     56 	    -	EXTERNAL_TOOLCHAIN -- if defined by the user, points to the
     57 		root ofan external toolchain (e.g. /usr/local/gnu).  This
     58 		enables the cross-build framework even for TOOLCHAIN_MISSING
     59 		platforms.
     60 
     61 20020906:
     62 	gehenna-devsw has been merged into the trunk. Need to update and
     63 	reinstall usr.sbin/config before build the kernel.
     64 
     65 20020822:
     66 	Crunched rescue tools (contents of /bin and /sbin, plus others)
     67 	are now provided in /rescue.
     68 
     69 	To ensure that these are built statically linked (no matter
     70 	what the setting of LDSTATIC is), use a crunchgen(1) built
     71 	from sources newer than 20020820 (see the next entry).
     72 
     73 20020820:
     74 	crunchgen(1) changed to ensure that the generated program
     75 	is statically linked.
     76 
     77 	Solution: update and reinstall usr.bin/crunch
     78 
     79 20020515:
     80 	sshd user/group has been added.  Need to hand add this in, or sshd
     81 	will not let you log in (with default, or UsePrivlegeSeparation=yes)
     82 
     83 	Add the following into /etc/group:
     84 
     85 	sshd:*:16:
     86 
     87 	and the following to /etc/master.passwd (via vipw):
     88 
     89 	sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin
     90 	
     91 	also /var/chroot/sshd directory needs to be present (digged as a part of
     92 	build process).
     93 
     94 20020426:
     95 	NBUILDJOBS obsoleted in favor of just using -j.
     96 
     97 20020426:
     98 	etc/postinstall added, which performs various checks for 
     99 	configuration file updates and changes, and can fix most of
    100 	the problems identified.
    101 	This should make it much easier to upgrade a system's
    102 	configuration from earlier systems (as far back as NetBSD 1.5).
    103 
    104 20020320:
    105 	<bsd.lib.mk> needs a new install(1) for it's "-a cmd" support.
    106 	build and install at usr.bin/xinstall before the build.
    107 
    108 20020319:
    109 	raw IPv6 socket now makes strict checking for sa_family and sa_len
    110 	on send(2) operation.  be sure to have sbin/rtsol and usr.sbin/rtsold
    111 	newer than November 2001 when you upgrade the kernel.
    112 
    113 20020311:
    114 	ssh configuration files were moved from /etc to /etc/ssh.  Beware
    115 	if you restart your machine from remote.  Note that sshd.conf needs
    116 	to be changed (due to the use of "/etc" inside).
    117 
    118 20020223:
    119 	Users of the VAX port will need to rebuild and install gas
    120 	so it deal with the now present register prefix used in all
    121 	the VAX assembly files.
    122 
    123 20020118:
    124 
    125 	ntpd user/group has been added.  Need to hand add this in or builds
    126 	will break as mtree aborts early.
    127 
    128 	Add the following into /etc/group:
    129 
    130 	ntpd:*:15:
    131 
    132 	and the following to /etc/master.passwd (via vipw):
    133 
    134 	ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin
    135 
    136 20011207:
    137 
    138 	If you're attempting to build a snapshot on sparc64 and are getting
    139 	reloc errors from the toolchain groff binary this means your native
    140 	toolchain has some broken C++ bits.
    141 
    142 	To fix:
    143 
    144 	Build a new toolchain (i.e. build.sh -t)
    145 	Use the new toolchain to build and install natively (i.e. /usr/lib)
    146 
    147 	gnu/lib/libgcc
    148 	gnu/lib/libstdc++
    149 
    150 	After this a snapshot will be able to be built.
    151 
    152 20011201:
    153 	In order for a sparc64 build to work you must have a working awk. If
    154 	you've built and installed a system with the new toolchain up to this
    155 	point you do not have a working awk as its ability to do floating
    156 	point is broken. 
    157 
    158 	To build:
    159 
    160 	remake and install gnu/lib/libgcc
    161 	remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links
    162 	against the new libgcc.a)
    163 
    164 20011128:
    165 	Kernel config information was changed to use defflag in
    166 	the various "files" files.  Bug fixes to config(8) are
    167 	required in order for this to work properly.  Make sure
    168 	to build and install in usr.sbin/config before attempting
    169 	to build a new kernel.
    170 
    171 20011030:
    172 	libc/locale/wcstod.c now needs new lint(1). Update lint(1)
    173 	before building libc.
    174 
    175 20011029:
    176 	The new document BUILDING.mdoc (view with nroff | more, or
    177 	see pre-generated .txt and .html versions) describes the build
    178 	procedure in great detail.  BUILDING, and the USE_NEW_TOOLCHAIN
    179 	build process, are intended in the long run to replace this
    180 	manual update log.
    181 
    182 	Users building a USE_NEW_TOOLCHAIN system should read the
    183 	BUILDING document for caveats.  Generally, BUILDING supersedes
    184 	UPDATING for these systems, as tool updating is taken care of
    185 	by the new build system.
    186 
    187 20011028:
    188 	src/etc/Makefile now needs install to be able to handle
    189 	symlinks that point to nowhere. A bug in install that
    190 	prevented this was corrected.
    191 
    192 	Solution: update and reinstall usr.bin/xinstall
    193 	Better Solution: Use the new toolchain and it will just work
    194 	for you.
    195 
    196 20011006:
    197 	/etc/mtree/NetBSD.dist has been updated to take advantage of
    198 	absolute path support added to mtree(8). Older mtree(8)s don't
    199 	understand the format.
    200 
    201 	Solution: update and reinstall usr.sbin/mtree
    202 
    203 20011004:
    204 	Crunchgen has been updated to work via reach-over makefiles. Updating
    205 	is suggested before running a snapshot build
    206 
    207 20010915:
    208 	The new "ubcperf" code committed by Chuck Silvers removed
    209 	a header file, uvm/uvm_vnode.h.  There may be stale .depend
    210 	files that still reference this file.
    211 
    212 	Solution: "make cleandir && make dependall" in affected
    213 	directories.
    214 
    215 20010803:
    216 	grep.info is now built from grep.texi using makeinfo.  Since it
    217 	requires makeinfo v4.0, you need to install new texinfo before
    218 	building gnu/usr.bin/grep.  To install new texinfo, please follow
    219 	the instruction described in 20010726 entry.
    220 
    221 20010803: 
    222 	(i386 only): i386 kernel now uses new instructions like
    223         `fxsave' which old gas doesn't understand.  To build the
    224 	kernel successfully, you need to build and install a new toolchain, 
    225 	(i.e., build.sh -t) or 	(temporarily) comment out "options I686_CPU" 
    226 	from your kernel configuration until you rebuild your userland.
    227 	See 20011029 above and BUILDING file in this directory for more information.
    228 	[updated 20020630 since i386 gas moved when USE_NEW_TOOLCHAIN enabled]
    229 
    230 20010731:
    231 	Bootloader update on ELF platforms.  DDB in kernels from before
    232 	this will be unable to read symbol tables provided by newer
    233 	bootloaders.
    234 
    235 20010726:
    236 	Texinfo was updated to 4.0.  To avoid failures when trying to
    237 	build the included texinfo files, do:
    238 
    239 	cd src/gnu/usr.bin/texinfo
    240 	make MKINFO=no dependall install
    241 
    242 20010718:
    243 	Enabled correct .init/.fini processing in crt0.  The way this
    244 	was done was to change a -I directive to cc(1), which means
    245 	make(1) will have a stale dependency (it will be checking the
    246 	timestamp on the wrong "dot_init.h").
    247 
    248 	The symptom you will see is that new programs die with SIGSEGV
    249 	if you have a stale dependency.
    250 
    251 	Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
    252 	before starting your build.
    253 
    254 20010628:
    255 	A construct was added to uvm_page.h that uncovered a bug
    256 	in lint(1).  If you get a warning/error about a non-portable
    257 	bitfield, update your lint(1) before proceeding.
    258 
    259 20010226:
    260 	Added named user/group to system. Need to hand add this in or builds
    261 	will break as mtree aborts early.
    262 
    263 	To work around add by hand:
    264 
    265 	named:*:14:
    266 
    267 	to /etc/group and add:
    268 
    269 	named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
    270 
    271 	to master.passwd (use vipw for instance if doing by hand).
    272 
    273 	Now a make build should progress.
    274 
    275 20010219:
    276 	get/setprogname() added. Any hostprogs that may use this will need
    277         to be bootstrapped manually until the host system is current.
    278 
    279         Known problems: sys/arch/macppc/stand/fixcoff
    280 			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
    281 			  CFLAGS and rebuilding should work)
    282 			usr.sbin/mdsetimage - Build a static copy if
    283   		          building a snapshot before fully bootstrapped.
    284 
    285 20010204:
    286 	prepare the code to compile with stricter gcc flags. in
    287 	particular start eliminating redundant declarations. Yacc
    288 	needs to be installed before make build.
    289 
    290 20010114:
    291 	introduce .if commands(target) in make(1). You need to
    292 	bring everything up-to-date first, then without installing
    293 	anything make and install in usr.bin/make, then proceed
    294 	with make build.
    295 
    296 20010101:
    297 	bsd.subdir.mk committed 20001230 had a bug which caused
    298 	afterinstall targets to run too soon; update again.
    299 
    300 20001230:
    301 	New share/mk files needed to support .WAIT in SUBDIR variables.
    302 	If you get make errors, 
    303 		(cd share/mk; make install)
    304 	Also, PRINTOBJDIR has changed and is now used more heavily.
    305 
    306 20001019:
    307 	The `ca' device driver has been replaced by `ld'; although the
    308 	major and minor numbers haven't changed, you should update your /dev
    309 	directory.
    310 
    311 20000929:
    312 	The following make directives are obsoleted.
    313 	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
    314 	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
    315 	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
    316 	additional library libcrypto_{idea,rc5}.
    317 
    318 
    319 Hints for a more successful build:
    320 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    321     Build a new kernel first:
    322 	This makes sure that any new system calls or features
    323 	   expected by the new userland will be present.  This
    324 	   helps to avoid critical errors when upgrading.
    325     Use object directories:
    326 	This helps to keep stale object
    327 	   files from polluting the build if a Makefile "forgets"
    328 	   about one.  It also makes it easier to clean up after
    329 	   a build.  It's also necessary if you want to use the
    330 	   same source tree for multiple machines.
    331 	   To use object directories:
    332 	    a) cd /usr/src ; make cleandir
    333 	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
    334 	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
    335 	    d) cd /usr/src ; make build
    336 	   Note that running "make obj" in a directory will create
    337 	   in obj.$MACHINE directory.
    338     Build to a DESTDIR:
    339 	This helps to keep old
    340 	   installed files (especially libraries) from interfering
    341 	   with the new build.
    342 	   To build to a DESTDIR, set the DESTDIR environment
    343 	   variable before running make build.  It should be set to
    344 	   the pathname of an initially empty directory.
    345 	   Problems: you might need to update critical utilities
    346 		without using DESTDIR since nothing is executed
    347 		from what is installed in DESTDIR.
    348 		(See critical utils, below)
    349     Build often:
    350 	This keeps critical utilities current enough to not choke
    351 	on any other part of the source tree that depends on up to
    352 	date functionality.
    353  
    354 What to do if things don't work:
    355 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    356 When things don't work there is usually a few things that commonly
    357 should be done.
    358     1)	make includes
    359 	This should be done automatically by make build.
    360     2)  cd share/mk && make install
    361 	Again, automatically done by make build.
    362 
    363 Failsafe rebuild of a small part of the tree:
    364 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    365 To make sure you rebuild something correctly you want to do
    366 something like the following:
    367     1)  Make sure the includes and .mk files are up to date.
    368     2)  Make sure any program used to build the particular
    369 	utility is up to date.  (yacc, lex, etc...)
    370     3)  cd ...path/to/util...
    371 	make cleandir
    372 	rm ...all obj directories...
    373 	make cleandir			# yes, again
    374 	make obj
    375 	make depend && make
    376 
    377 Failsafe rebuild of the entire tree:
    378 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    379 If you really want to make sure the source tree is clean and
    380 ready for a build try the following.  Note that sourcing /etc/mk.conf
    381 (a make(1) Makefile) in this manner is not right, and will not work
    382 for anyone who uses any make(1) features in /etc/mk.conf.
    383 
    384 ---cut here---
    385 #!/bin/sh
    386 . /etc/mk.conf
    387 
    388 if [ -z $NETBSDSRCDIR ] ; then
    389     NETBSDSRCDIR=/usr/src
    390 fi
    391 if [ \! -d $NETBSDSRCDIR ] ; then
    392     echo Unable to find sources
    393     exit 1
    394 fi
    395 find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
    396 
    397 if [ -z $BSDOBJDIR ] ; then
    398     BSDOBJDIR=/usr/obj
    399 fi
    400 if [ -d $BSDOBJDIR ] ; then
    401     rm -rf $BSDOBJDIR
    402 fi
    403 
    404 cd $NETBSDSRCDIR && make cleandir
    405 
    406 ---cut here---
    407 
    408 Critical utilities:
    409 ^^^^^^^^^^^^^^^^^^^
    410 	gnu/usr.bin/egcs
    411 	usr.bin/compile_et
    412 	usr.bin/make
    413 	usr.bin/yacc
    414 	usr.bin/lex
    415 	usr.bin/xlint
    416 	usr.sbin/config
    417 
    418 Other problems and possible solutions:
    419 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    420 Symptom:Unreasonable compiler errors.
    421 Fix:	Rebuild gnu/usr.bin/egcs
    422 
    423 Symptom:Complaints involving a Makefile.
    424 Fix:	Rebuild usr.bin/make:
    425 	cd usr.bin/make && make && make install
    426         Or, a failsafe method if that doesn't work:
    427 	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
    428 
    429 Fix:	Make sure .mk files are up to date.
    430 	cd share/mk && make install
    431 
    432 Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
    433 Fix:	Rebuild usr.sbin/config
    434 
    435 Symptom:
    436 Fix:	Rebuild usr.bin/yacc
    437 
    438 Symptom:
    439 Fix:	Rebuild usr.bin/lex
    440 
    441 Symptom:
    442 Fix:	rm /usr/lib/libbfd.a
    443 
    444 Symptom:Obsolete intermediate files are used during compilation
    445 Fix:	Try the following sequence of commands in the directory in question.
    446 	make cleandir; rm `make print-objdir`; make cleandir; make obj
    447 	(If you built the tree without "make obj" in the past, obsolete files
    448 	may remain.  The command tries to clean everything up)
    449 
    450 Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
    451 Fix:	Rebuild and install usr.bin/menuc
    452 
    453 Symptom:mklocale not found during build in share/locale/ctype
    454 Fix:	Build and install usr.bin/mklocale
    455 
    456 Symptom:undefined reference to `__assert13'
    457 Fix:    Rebuild and install lib/libc
    458 
    459 Symptom:usr.sbin/config fails to build.
    460 Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
    461 
    462 Symptom:undefined reference to `getprogname' or `setprogname'
    463 Fix:    Rebuild and install lib/libc
    464 
    465 Symptom:lint does not understand the '-X' option
    466 Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
    467