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