Home | History | Annotate | Line # | Download | only in src
      1 $NetBSD: UPDATING,v 1.391 2026/04/20 05:04:33 martin Exp $
      2 
      3 This file (UPDATING) is intended to be a brief reference to recent
      4 changes that might cause problems in the build process, and a guide for
      5 what to do if something doesn't work.
      6 
      7 For a more detailed description of the recommended way to build NetBSD
      8 using build.sh, see the BUILDING file.
      9 
     10 Note that much of the advice in this UPDATING file was written before
     11 build.sh existed.  Nevertheless, the advice here may be useful for
     12 working around specific problems with build.sh.
     13 
     14 Sections are marked with "^^^^^".  After the section on "Recent changes"
     15 are several sections containing more general information.
     16 
     17 See also: BUILDING, build.sh, Makefile.
     18 
     19 Recent changes:
     20 ^^^^^^^^^^^^^^^
     21 
     22 20260419:
     23 	The switch between jemalloc versions requires removal of the
     24 	object directories for libc and external/bsd/jemalloc
     25 	(and all compat variants of that).
     26 
     27 20251219:
     28 	Reorganization of libraries for PR 58648 requires a new enough
     29 	nbcrunchgen tool (this should be build automatically) and manual
     30 	removal of $DESTDIR/usr/lib/libssh* and $DESTDIR/usr/lib/*/libssh*.
     31 
     32 20251028:
     33 	libpthread had its shared library version go back (from 1.7 to
     34 	1.6). This may cause fallout during update builds, remove the
     35 	libpthread obj dir and all libpthread.so.1.7\* files in the
     36 	dest dir.
     37 	If you have build other software/packages on a -current system
     38 	from 20251026 or 20251027 you need to rebuild them after
     39 	updating your base system again.
     40 
     41 20251019:
     42 	Changes to how libcrypto got linked (libpthread not required
     43 	any more) cause failures in update builds. To fix, run
     44 	(as your build user) a "make cleandir" in the following
     45 	subdirectories:
     46 
     47 	crypto/external/apache2/openssl
     48 	crypto/external/bsd/heimdal
     49 	crypto/external/bsd/netpgp
     50 	crypto/external/bsd/openssh
     51 	external/bsd/libfido2
     52 	external/bsd/nsd
     53 	external/bsd/ntp
     54 	external/bsd/pam-u2f
     55 	external/bsd/ppp
     56 	external/bsd/tcpdump
     57 	external/bsd/wpa
     58 	games/factor
     59 	libexec/httpd
     60 	tests/crypto/libcrypto
     61 	tests/lib/libc/hash
     62 	usr.bin/dc
     63 	usr.bin/ftp
     64 	usr.bin/moduli
     65 	usr.bin/nbsvtool
     66 	usr.sbin/plainrsa-gen
     67 	usr.sbin/syslogd
     68 
     69 20250721:
     70 	GCC 12.5 was imported and there may be weird build issues.
     71 	Clean any GCC build dirs if you encounter weird things.
     72 
     73 20250720:
     74 	New openssl and old objects for tests for libcrypto may
     75 	cause spurious test failure, clean the src/tests/crypto/libcrypto
     76 	object dirs.
     77 
     78 20250528:
     79 	Changes in the tools build require removing all config.cache
     80 	files in the object tools directories.
     81 
     82 20250427:
     83 	The KERNEL_DIR option to build.sh is now functional.  Set it
     84 	with ``-V KERNEL_DIR=yes'' on your build.sh command.
     85 	With this, you can now colocate kernel and associated modules
     86 	in /netbsd/{kernel,kernel.dbg,modules} instead of having the
     87 	kernel in / but modules in /stand.
     88 
     89 	Note that you'll need new bootstrap code to use this feature.
     90 
     91 	This completes work begun many years ago by christos@ :-)
     92 
     93 20250413:
     94 	A change to bsd.lib.mk requires a clean build of all libraries.
     95 
     96 20250131:
     97 	The switch to the new jemalloc requires cleaning in libc.
     98 
     99 20241122:
    100 	Changes to various libraries' build options require cleaning
    101 	their objdirs in update builds:
    102 
    103 	cd external/bsd/file/lib && $TOOLDIR/bin/nbmake-$ARCH clean
    104 	cd external/bsd/libarchive/lib && $TOOLDIR/bin/nbmake-$ARCH clean
    105 	cd external/public-domain/xz/lib && $TOOLDIR/bin/nbmake-$ARCH clean
    106 
    107 	Also, for architectures with MKCOMPAT, it is necessary to clean
    108 	the compat objdirs too.  The easiest way is:
    109 
    110 	rm -rf OBJDIR/compat/*/*/external/bsd/file/lib
    111 	rm -rf OBJDIR/compat/*/*/external/bsd/libarchive/lib
    112 	rm -rf OBJDIR/compat/*/*/external/public-domain/xz/lib
    113 
    114 	Changes to bsd.lib.mk to improve detecting differences in
    115 	shared library symbol exports may cause some .actsym files in
    116 	the objdir to become stale in update builds.
    117 
    118 	To work around this, delete all files matching `*.actsym' in
    119 	the objdir.  For example:
    120 
    121 	find OBJDIR -name '*.actsym' -type f -print0 | xargs -0 rm
    122 
    123 20241104:
    124 	Changes around the integration of the zstd compression
    125 	library may require manual deletion of some object directories
    126 	if you update from a build from a few days ago:
    127 	rm -rf DESTDIR/usr/lib/*/libarchive*
    128 	rm -rf DESTDIR/usr/lib/*/libmagic*
    129 	rm -rf DESTDIR/usr/lib/*/libzstd*
    130 	rm -rf DESTDIR/usr/lib/libarchive*
    131 	rm -rf DESTDIR/usr/lib/libmagic*
    132 	rm -rf DESTDIR/usr/lib/libzstd*
    133 	rm -rf OBJDIR/compat/*/*/external/bsd/file/
    134 	rm -rf OBJDIR/compat/*/*/external/bsd/libarchive/
    135 	rm -rf OBJDIR/compat/*/*/external/bsd/zstd/
    136 	rm -rf OBJDIR/external/bsd/file/
    137 	rm -rf OBJDIR/external/bsd/libarchive/
    138 	rm -rf OBJDIR/external/bsd/zstd/
    139 	rm -rf OBJDIR/external/gpl3/gcc/
    140 	rm -rf OBJDIR/tools/gcc/
    141 
    142 20240926:
    143 	Building -current when running on amd64 from about 20240924
    144 	to about 20240926 will not work due to a "malloc_np.h"
    145 	error. Please downgrade to a version from 20240924 or older,
    146 	or upgrade to a newer version e.g. using a binary release from
    147 	the NetBSD build servers.
    148 
    149 20240923:
    150 	Update builds will require cleaning the object directories for
    151 	jemalloc (like: "rm -rf $OBJ/external/bsd/jemalloc*") and the
    152 	libc dependency files (like: "rm $OBJ/lib/libc/jemalloc.*").
    153 	On architectures with COMPAT libs, those also have to be cleaned,
    154 	e.g. on sparc64: "rm -rf $OBJ/compat/sparc64/sparc/external/bsd/jemalloc*"
    155 	and "rm $OBJ/compat/sparc64/sparc/lib/libc/jemalloc.*".
    156 
    157 20240920:
    158 	Update builds will require cleaning in src/external/historical/nawk/bin
    159 	in order to remove the awk subdirectory since there is now a binary
    160 	called awk.
    161 
    162 20240817:
    163 	Update builds will require cleaning in src/external/historical/nawk/bin
    164 	in order to remove the awk binary since now there is a subdirectory
    165 	called awk.
    166 
    167 20240812:
    168 	Update builds will require removing the tools objdir for gdb
    169 	if building with MKCROSSGDB=yes. All architectures use gdb.old
    170 	now.
    171 
    172 20240630:
    173 	Update builds will require removing the tools objdir for binutils
    174 	(as most architectures should use binutils.old now).
    175 
    176 20240610:
    177 	Update builds are likely to require removing the objdir for
    178 	distrib/<arch>/cdroms - or at least references to libarchive
    179 	from within there after the recent libarchive update.
    180 
    181 20240504:
    182 	Update builds on x86 require making the `cleandir' target in
    183 	lib/libm, or deleting the objdir for lib/libm.
    184 
    185 20240423:
    186 	Update builds with x11 may fail after switching to Mesa 21.
    187 
    188 20240410:
    189 	Update builds may require manually deleting
    190 	$DESTDIR/var/run/named (and, potentially,
    191 	$DESTDIR/var/run/lwresd) in order to avoid checkflist failure.
    192 
    193 20240409:
    194 	32-bit compatibility libraries were moved into the base32
    195 	and debug32 sets.  HTML man pages were moved into the manhtml set.
    196 
    197 20230828:
    198 	If:
    199         - you updated to current and ran postinstall between 20230826
    200 	  and 20230828 inclusive, and
    201         - you are not using anything outside the base system to
    202 	  populate /etc/openssl/certs (e.g., manually adding
    203 	  certificates or using ca-certificates or mozilla-rootcerts or
    204 	  mozilla-rootcerts-openssl from pkgsrc),
    205 	delete /etc/openssl/certs and rerun postinstall or just
    206 	`certctl rehash'.
    207 
    208 	Otherwise, certctl(8) will think someone else has left
    209 	/etc/openssl/certs in the way and will avoid clobbering it on
    210 	upgrade from older NetBSD.
    211 
    212 20230718:
    213 	build.sh will use mk.conf in the same directory as build.sh instead
    214 	of /etc/mk.conf, unless MAKECONF is already defined in the environment.
    215 
    216 20230714:
    217 	Import of gcc 10.5 requires a clean build of at least tools/gcc
    218 	and external/gpl3/gcc* object directories. An update build
    219 	without cleaning will result in obscure failures in rare corner
    220 	cases.
    221 
    222 20230604:
    223 	Building native kernels with the installed make(1) instead of
    224 	the $TOOLDIR/bin/nbmake-${arch} wrapper will fail if userland
    225 	has not been updated. Note that this is an unsupported build
    226 	configuration (but usually works if userland is -current enough).
    227 
    228 20230523:
    229 	ctfmerge was fixed as macOS host tool. This may require a clean tools
    230 	rebuild to detect the update to tools/compat/configure.
    231 
    232 20230515:
    233 	New openssl build requires removal of the crypto/external/bsd/openssl
    234 	and tests/crypto/libcrypto subdirectories in the ${OBJDIR} hierarchy.
    235 	Otherwise test results may be wrong due to wrong "golden" output
    236 	files being installed.
    237 
    238 20230322:
    239 	Fixes for moved /lib/libisns* mean that builds will complain about
    240 	./usr/lib/libisns* being missing until src/lib/libisns is forced
    241 	to (re)install the files, including the symlinks.  The simplest
    242 	way is to clean this subdir before building.
    243 
    244 20230112:
    245 	New binutils require an updated ld.elf_so. If you are doing
    246 	(unsupported) in-place self builds (with the -E flag to build.sh),
    247 	make sure to have installed latest ld.elf_so before you rebuild
    248 	userland.
    249 
    250 20221116:
    251 	The addition to NetBSD's version of UFS2 of support for extended
    252 	attributes broke backward compatibility with previous releases
    253 	of NetBSD, so UFS2 has been restored to being compatible with
    254 	previous NetBSD releases by disabling extended attributes.
    255 	(Note that ACLs are implemented as extended attributes, so
    256 	this changes disables ACLs as well.)
    257 
    258 	Support for UFS2 with extended attributes is now available in a new
    259 	UFS variant called UFS2ea.  If you have created extended attributes
    260 	in an original UFS2 file system then "fsck -p" will now fail due to
    261 	the unexpected presence of extended attributes and "fsck -y" will
    262 	remove all extended attributes.  If you wish to preserve extended
    263 	attributes rather than delete them, there is a utility to convert
    264 	a UFS2 file system to UFS2ea and leave extended attributes in place,
    265 	but this should be used with caution since it will preserve any
    266 	extended attributes that have been corrupted by the backward
    267 	incompatibility too.
    268 
    269 	If you wish to use a UFS2ea file system as your root file system,
    270 	then you will need to update your boot loader to a version that
    271 	supports UFS2ea.
    272 
    273 	For more information, see:
    274 	https://wiki.netbsd.org/features/UFS2ea
    275 
    276 20221111:
    277 	The new libdrm import worsened the conflict issues for the
    278 	kdump/ktruss ioctl, and i915 now conflicts with base, and has
    279 	been turned off.  This will cause update build issues like:
    280 
    281 		kdump-ioctl.c:12175:143: error: 'DRM_IOCTL_I915_DESTROY_HEAP'
    282 		   undeclared here (not in a function);
    283 		   did you mean 'DRM_IOCTL_MODE_DESTROY_DUMB'?
    284 
    285 	You'll need to clean usr.bin/ktruss, usr.bin/kdump, and rescue.
    286 
    287 20220921:
    288 	Since the kernel version was bumped to 9.99.100, the bootloader
    289 	must be updated on x86 or EFI boot platforms in order to load
    290 	modules from boot.cfg(5) or interactively at the bootloader
    291 	prompt.
    292 
    293 	The kernel can still load modules at runtime, with modload(8)
    294 	or modules.conf(5), with no bootloader update.  This will not
    295 	affect release branches because it only applies to patch
    296 	numbers >=100.
    297 
    298 	On x86 (i386 or amd64) with BIOS boot, this requires copying a
    299 	new /usr/mdec/boot to /boot.  You can build this in the destdir
    300 	by running `$TOOLDIR/bin/nbmake-$ARCH dependall install' in
    301 	sys/arch/i386/stand.
    302 
    303 	On platforms with EFI boot (including x86 with EFI boot), this
    304 	requires copying a new /usr/mdec/boot*.efi to the EFI/BOOT/
    305 	directory on the EFI system partition.  The boot*.efi file is:
    306 
    307 	aarch64	bootaa64.efi
    308 	amd64	bootx64.efi
    309 	arm	bootarm.efi	(32-bit arm)
    310 	i386	bootx32.efi
    311 
    312 	You can build this in the destdir by running
    313 	`$TOOLDIR/bin/nbmake-$ARCH dependall install' in
    314 	sys/stand/efiboot/boot*.
    315 
    316 20220821:
    317 	Support for building extsrc/ has been deprecated.
    318 	EXTSRCSRCDIR and MKEXTSRC have been deprecated.
    319 
    320 20220714:
    321 	Updates to xorg-server and associated drivers may cause builds to
    322 	fail.  Cleaning both DESTDIR and the xorg build tree may be needed.
    323 
    324 20220628:
    325 	Changes in the build of src/games/robots require a clean build
    326 	of that program.
    327 
    328 20211116:
    329 	Changes in the xorg build require clean obj dirs for external/mit/xorg
    330 	(or a full clean/non-update build).
    331 
    332 20211112:
    333 	Device tree sources were updated for evbarm.  Some device nodes
    334 	(in particular, ld(4) devices on the ROCKPro64) will be renumbered.
    335 
    336 20211014:
    337 	MKPIE default for aarch64 has changed, a clean build is required.
    338 
    339 20210917:
    340 	Changed MNT_ACLS to default to POSIX1e ACLs instead of NFSv4
    341 	ACLs, to be compatible with FreeBSD. If you are using NFSv4 ACLs
    342 	and have "acls" in /etc/fstab you'll need to change it to "nfs4acls".
    343 
    344 20210711:
    345 	Updated GMP sources may require cleaning in tools/gmp and/or in
    346 	external/lgpl3/gmp/lib, particularly if GCC itself does not build.
    347 
    348 20210417:
    349 	GCC 10 was enabled for several platforms.  If builds fail in either
    350 	tools/gcc or external/gpl3/gcc, first try cleaning those objects and
    351 	removing the $DESTDIR/usr/include/g++ subdirectory.
    352 
    353 20201016:
    354 	MIPS kernel modules have been disabled until they work.  This will
    355 	turn up in extra files in the DESTDIR, which should be cleaned.
    356 
    357 20200925:
    358 	GNU MPC and MPFR have been updated.  At least MPFR needs cleaning
    359 	in both the tools and external dirs.
    360 
    361 20200912:
    362 	GCC 9 has arrived for Arm and x86 platforms, and will be coming
    363 	for several more, as will binutils 2.34.  Clean as required.
    364 
    365 20200907:
    366 	GCC 9 is coming, and binutils has been updated for MIPS.  This
    367 	probably requires cleaning the tools/binutils.
    368 
    369 20200811:
    370 	GCC updates may require cleaning the objdir.  This may occur
    371 	due to GCC 7.5 update, GCC 8.4 move to gcc.old, or the upcoming
    372 	GCC 9 upgrade.
    373 
    374 20200614:
    375 	blacklist* has been renamed to blocklist*. postinstall(8)
    376 	should handle the migration.
    377 
    378 20200601:
    379 	Due to a mistake in LIBISPRIVATE handling, .so libraries were
    380 	created in the build directories and need cleaning.
    381 
    382 20200311:
    383 	GCC 8 ports will need cleaning in src/tools/gcc and
    384 	src/external/gpl3/gcc due to GCC 8.4 update.
    385 
    386 20191118:
    387 	More architectures were switched to gcc8:
    388 	    i386, ia64 powerpc64, sparc, sparc64, arm
    389 	The same comments as in 20191022 apply.
    390 
    391 20191112:
    392 	The LLVM update requires a clean rebuild for all architectures using
    393 	LLVM during the tools build phase (i386, amd64, aarch64).
    394 
    395 20191022:
    396 	Ports amd64 and aarch64 switched to GCC 8.3 by default.
    397 	In-place ("expert mode", build.sh -E) builds are not supported
    398 	when going from a GCC 7 userland to GCC 8. Do a regular
    399 	build to a different DESTDIR (or preferably: build.sh -U) at least
    400 	once and install sets, or download comp.{tar.xz,tgz} from the
    401 	daily builds and install that before doing the next in-place build.
    402 
    403 20191001:
    404 	GCC 8.3 was imported.  Builds of src/tools/gcc may fail if
    405 	old builds with GCC 7 output now uses GCC 8.  Clean this
    406 	directory, and also clean src/external/gpl3/gcc.
    407 
    408 20190903:
    409 	Files with names that coincide with existing files' names on
    410 	case-insensitive file systems were inadvertently committed, for
    411 	radeon GPU firmware.  We cannot mark these as obsolete for
    412 	postinstall to fix, so if you updated src since 2019-08-26, and
    413 	ran build.sh distribution or ran build.sh release, you must
    414 	manually delete the following files in your DESTDIR (which is
    415 	usually $OBJDIR/destir.$ARCH), or from / if you have installed
    416 	them:
    417 
    418 		/libdata/firmware/radeon/bonaire_ce.bin
    419 		/libdata/firmware/radeon/bonaire_mc.bin
    420 		/libdata/firmware/radeon/bonaire_me.bin
    421 		/libdata/firmware/radeon/bonaire_mec.bin
    422 		/libdata/firmware/radeon/bonaire_pfp.bin
    423 		/libdata/firmware/radeon/bonaire_rlc.bin
    424 		/libdata/firmware/radeon/bonaire_sdma.bin
    425 		/libdata/firmware/radeon/bonaire_smc.bin
    426 		/libdata/firmware/radeon/bonaire_uvd.bin
    427 		/libdata/firmware/radeon/hainan_ce.bin
    428 		/libdata/firmware/radeon/hainan_mc.bin
    429 		/libdata/firmware/radeon/hainan_me.bin
    430 		/libdata/firmware/radeon/hainan_pfp.bin
    431 		/libdata/firmware/radeon/hainan_rlc.bin
    432 		/libdata/firmware/radeon/hainan_smc.bin
    433 		/libdata/firmware/radeon/hawaii_ce.bin
    434 		/libdata/firmware/radeon/hawaii_mc.bin
    435 		/libdata/firmware/radeon/hawaii_me.bin
    436 		/libdata/firmware/radeon/hawaii_mec.bin
    437 		/libdata/firmware/radeon/hawaii_pfp.bin
    438 		/libdata/firmware/radeon/hawaii_rlc.bin
    439 		/libdata/firmware/radeon/hawaii_sdma.bin
    440 		/libdata/firmware/radeon/hawaii_smc.bin
    441 		/libdata/firmware/radeon/kabini_ce.bin
    442 		/libdata/firmware/radeon/kabini_me.bin
    443 		/libdata/firmware/radeon/kabini_mec.bin
    444 		/libdata/firmware/radeon/kabini_pfp.bin
    445 		/libdata/firmware/radeon/kabini_rlc.bin
    446 		/libdata/firmware/radeon/kabini_sdma.bin
    447 		/libdata/firmware/radeon/kaveri_ce.bin
    448 		/libdata/firmware/radeon/kaveri_me.bin
    449 		/libdata/firmware/radeon/kaveri_mec.bin
    450 		/libdata/firmware/radeon/kaveri_mec2.bin
    451 		/libdata/firmware/radeon/kaveri_pfp.bin
    452 		/libdata/firmware/radeon/kaveri_rlc.bin
    453 		/libdata/firmware/radeon/kaveri_sdma.bin
    454 		/libdata/firmware/radeon/mullins_ce.bin
    455 		/libdata/firmware/radeon/mullins_me.bin
    456 		/libdata/firmware/radeon/mullins_mec.bin
    457 		/libdata/firmware/radeon/mullins_pfp.bin
    458 		/libdata/firmware/radeon/mullins_rlc.bin
    459 		/libdata/firmware/radeon/mullins_sdma.bin
    460 		/libdata/firmware/radeon/oland_ce.bin
    461 		/libdata/firmware/radeon/oland_mc.bin
    462 		/libdata/firmware/radeon/oland_me.bin
    463 		/libdata/firmware/radeon/oland_pfp.bin
    464 		/libdata/firmware/radeon/oland_rlc.bin
    465 		/libdata/firmware/radeon/oland_smc.bin
    466 		/libdata/firmware/radeon/pitcairn_ce.bin
    467 		/libdata/firmware/radeon/pitcairn_mc.bin
    468 		/libdata/firmware/radeon/pitcairn_me.bin
    469 		/libdata/firmware/radeon/pitcairn_pfp.bin
    470 		/libdata/firmware/radeon/pitcairn_rlc.bin
    471 		/libdata/firmware/radeon/pitcairn_smc.bin
    472 		/libdata/firmware/radeon/tahiti_ce.bin
    473 		/libdata/firmware/radeon/tahiti_mc.bin
    474 		/libdata/firmware/radeon/tahiti_me.bin
    475 		/libdata/firmware/radeon/tahiti_pfp.bin
    476 		/libdata/firmware/radeon/tahiti_rlc.bin
    477 		/libdata/firmware/radeon/tahiti_smc.bin
    478 		/libdata/firmware/radeon/verde_ce.bin
    479 		/libdata/firmware/radeon/verde_mc.bin
    480 		/libdata/firmware/radeon/verde_me.bin
    481 		/libdata/firmware/radeon/verde_pfp.bin
    482 		/libdata/firmware/radeon/verde_rlc.bin
    483 		/libdata/firmware/radeon/verde_smc.bin
    484 
    485 	We will re-import these radeon firmware images another way
    486 	later.
    487 
    488 20190727:
    489 	The uefi bootloader has gained tftp support and needs a clean
    490 	build. If you do update builds, manually clean its object
    491 	directory by something like:
    492 	cd sys/arch/i386/stand/efiboot && make clean
    493 
    494 20190723:
    495 	The jemalloc allocator in libc is now built without extended
    496 	debugging (for performance reasons). In update builds make sure
    497 	to rebuild it completely, by removing all affected object files,
    498 	including compat builds, something like:
    499 	cd /usr/obj && find . -type d -name jemalloc|xargs rm -rf
    500 
    501 20190207:
    502 	GCC 7 switched for many ports.  Update builds are likely to fail.
    503 
    504 Hints for a more successful build:
    505 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    506     Use build.sh, but do not use its "expert mode":
    507 	This will automatically build the tools in the
    508 	   correct order, and it will keep the tools and the
    509 	   new build products from interfering with the running
    510 	   system.  This will allow you to ignore most of the
    511 	   other advice in this file.
    512     Build a new kernel first:
    513 	This makes sure that any new system calls or features
    514 	   expected by the new userland will be present.  This
    515 	   helps to avoid critical errors when upgrading.
    516     Use object directories:
    517 	This helps to keep stale object
    518 	   files from polluting the build if a Makefile "forgets"
    519 	   about one.  It also makes it easier to clean up after
    520 	   a build.  It's also necessary if you want to use the
    521 	   same source tree for multiple machines.
    522 	   To use object directories with build.sh:
    523 	    a) invoke build.sh with the "-M" or "-O" options.
    524 	   To use object directories without using build.sh:
    525 	    a) cd /usr/src ; make cleandir
    526 	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
    527 	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
    528 	    d) cd /usr/src ; make build
    529 	   Note that running "make obj" in a directory will create
    530 	   in obj.$MACHINE directory.
    531     Build to a DESTDIR:
    532 	This helps to keep old installed files (especially libraries)
    533 	   from interfering with the new build.
    534 	   To build to a DESTDIR with build.sh, use the "-D" option.
    535 	   To build to a DESTDIR without using build.sh, set the DESTDIR
    536 	   environment variable before running make build.  It should be
    537 	   set to the pathname of an initially empty directory.
    538 	   Problems: if you do not use build.sh, you might need to
    539 		update critical utilities without using DESTDIR since
    540 		nothing is executed from what is installed in DESTDIR.
    541 		(See critical utils, below.)
    542     Build often:
    543 	This keeps critical utilities current enough to not choke
    544 	on any other part of the source tree that depends on up to
    545 	date functionality.  If you use build.sh, you should not have
    546 	this problem.
    547 
    548 What to do if things don't work:
    549 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    550 When things don't work there are usually a few things that commonly
    551 should be done.
    552     1)	make includes
    553 	This should be done automatically by make build.
    554     2)  cd share/mk && make install
    555 	Again, automatically done by make build.
    556 
    557 Failsafe rebuild of a small part of the tree:
    558 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    559 To make sure you rebuild something correctly you want to do
    560 something like the following:
    561     1)  Make sure the includes and .mk files are up to date.
    562     2)  Make sure any program used to build the particular
    563 	utility is up to date.  (yacc, lex, etc...)
    564     3)  cd ...path/to/util...
    565 	make cleandir
    566 	rm ...all obj directories...
    567 	make cleandir			# yes, again
    568 	make obj
    569 	make depend && make
    570 
    571 Failsafe rebuild of the entire tree:
    572 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    573 If you really want to make sure the source tree is clean and
    574 ready for a build try the following.  Note that sourcing /etc/mk.conf
    575 (a make(1) Makefile) in this manner is not right, and will not work
    576 for anyone who uses any make(1) features in /etc/mk.conf.
    577 
    578 ---cut here---
    579 #!/bin/sh
    580 . /etc/mk.conf
    581 
    582 if [ -z $NETBSDSRCDIR ] ; then
    583     NETBSDSRCDIR=/usr/src
    584 fi
    585 if [ \! -d $NETBSDSRCDIR ] ; then
    586     echo Unable to find sources
    587     exit 1
    588 fi
    589 find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
    590 
    591 if [ -z $BSDOBJDIR ] ; then
    592     BSDOBJDIR=/usr/obj
    593 fi
    594 if [ -d $BSDOBJDIR ] ; then
    595     rm -rf $BSDOBJDIR
    596 fi
    597 
    598 cd $NETBSDSRCDIR && make cleandir
    599 
    600 ---cut here---
    601 
    602 Critical utilities:
    603 ^^^^^^^^^^^^^^^^^^^
    604 	usr.bin/make
    605 	usr.bin/yacc
    606 	usr.bin/lex
    607 	usr.bin/xlint
    608 	usr.bin/config
    609 
    610 Other problems and possible solutions:
    611 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    612 Symptom:Complaints involving a Makefile.
    613 Fix:	Rebuild usr.bin/make:
    614 	cd usr.bin/make && make && make install
    615 	Or, a failsafe method if that doesn't work:
    616 	cd usr.bin/make && cc -DMAKE_NATIVE *.c -I. -o make \
    617 	&& install make /usr/bin
    618 
    619 Fix:	Make sure .mk files are up to date.
    620 	cd share/mk && make install
    621 
    622 Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
    623 Fix:	Rebuild usr.bin/config
    624 
    625 Symptom:Obsolete intermediate files are used during compilation
    626 Fix:	Try the following sequence of commands in the directory in question.
    627 	make cleandir; rm `make print-objdir`; make cleandir; make obj
    628 	(If you built the tree without "make obj" in the past, obsolete files
    629 	may remain.  The command tries to clean everything up)
    630 
    631 Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible
    632 	pointer type
    633 Fix:	Rebuild and install usr.bin/menuc
    634 
    635 Symptom:mklocale not found during build in share/locale/ctype
    636 Fix:	Build and install usr.bin/mklocale
    637 
    638 Symptom:undefined reference to `__assert13' or `__unsetenv13'
    639 Fix:    Rebuild and install lib/libc
    640 
    641 Symptom:usr.bin/config fails to build.
    642 Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
    643 
    644 Symptom:undefined reference to `getprogname' or `setprogname'
    645 Fix:    Rebuild and install lib/libc
    646 
    647 Symptom:Update build fails in src/tools/gcc complaining that a variable
    648 	(e.g. CPPFLAGS) has changed since the previous run.
    649 Fix:    Run "nbmake-${ARCH} clean" in src/tools/gcc or do a clean build.
    650 
    651 Symptom:cvs [update aborted]: cannot open directory /cvsroot/src/...:
    652 	No such file or directory.
    653 Cause:	If a directory is created by mistake, then it is sometimes
    654 	deleted from the CVS repository using administrative commands
    655 	that bypass the normal cvs access controls.  If your cvs working tree
    656 	contains references to a directory that has been deleted on the
    657 	server in this way, then "cvs update" reports this error.
    658 Fix:	Recursively delete the affected directory from your working tree
    659 	and try the update again.
    660