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