UPDATING revision 1.360
11.360Swiz$NetBSD: UPDATING,v 1.360 2024/09/26 20:08:44 wiz Exp $
21.1Sabs
31.123SjmcThis file (UPDATING) is intended to be a brief reference to recent
41.123Sjmcchanges that might cause problems in the build process, and a guide for
51.123Sjmcwhat to do if something doesn't work.
61.1Sabs
71.123SjmcFor a more detailed description of the recommended way to build NetBSD
81.123Sjmcusing build.sh, see the BUILDING file.
91.123Sjmc
101.123SjmcNote that much of the advice in this UPDATING file was written before
111.123Sjmcbuild.sh existed.  Nevertheless, the advice here may be useful for
121.123Sjmcworking around specific problems with build.sh.
131.123Sjmc
141.257SapbSections are marked with "^^^^^".  After the section on "Recent changes"
151.257Sapbare several sections containing more general information.
161.257Sapb
171.123SjmcSee also: BUILDING, build.sh, Makefile.
181.1Sabs
191.1SabsRecent changes:
201.1Sabs^^^^^^^^^^^^^^^
211.230Stls
221.360Swiz20240926:
231.360Swiz	Building -current when running on amd64 from about 20240924
241.360Swiz	to about 20240926 will not work due to a "malloc_np.h"
251.360Swiz	error. Please downgrade to a version from 20240924 or older,
261.360Swiz	or upgrade to a newer version e.g. using a binary release from
271.360Swiz	the NetBSD build servers.
281.360Swiz
291.358Smartin20240923:
301.358Smartin	Update builds will require cleaning the object directories for
311.359Smartin	jemalloc (like: "rm -rf $OBJ/external/bsd/jemalloc*") and the
321.359Smartin	libc dependency files (like: "rm $OBJ/lib/libc/jemalloc.*").
331.359Smartin	On architectures with COMPAT libs, those also have to be cleaned,
341.359Smartin	e.g. on sparc64: "rm -rf $OBJ/compat/sparc64/sparc/external/bsd/jemalloc*"
351.359Smartin	and "rm $OBJ/compat/sparc64/sparc/lib/libc/jemalloc.*".
361.358Smartin
371.357Schristos20240817:
381.357Schristos	Update builds will require cleaning in src/external/historical/nawk/bin
391.357Schristos	in order to remove the awk binary since now there is a subdirectory
401.357Schristos	called awk.
411.358Smartin
421.355Smartin20240812:
431.355Smartin	Update builds will require removing the tools objdir for gdb
441.355Smartin	if building with MKCROSSGDB=yes. All architectures use gdb.old
451.355Smartin	now.
461.356Sriastrad
471.354Smartin20240630:
481.353Smartin	Update builds will require removing the tools objdir for binutils
491.353Smartin	(as most architectures should use binutils.old now).
501.353Smartin
511.352Skre20240610:
521.352Skre	Update builds are likely to require removing the objdir for
531.352Skre	distrib/<arch>/cdroms - or at least references to libarchive
541.352Skre	from within there after the recent libarchive update.
551.352Skre
561.350Sriastrad20240504:
571.350Sriastrad	Update builds on x86 require making the `cleandir' target in
581.350Sriastrad	lib/libm, or deleting the objdir for lib/libm.
591.350Sriastrad
601.349Smaya20240423:
611.349Smaya	Update builds with x11 may fail after switching to Mesa 21.
621.349Smaya
631.346Sriastrad20240410:
641.346Sriastrad	Update builds may require manually deleting
651.346Sriastrad	$DESTDIR/var/run/named (and, potentially,
661.346Sriastrad	$DESTDIR/var/run/lwresd) in order to avoid checkflist failure.
671.346Sriastrad
681.347Snia20240409:
691.347Snia	32-bit compatibility libraries were moved into the base32
701.347Snia	and debug32 sets.  HTML man pages were moved into the manhtml set.
711.347Snia
721.343Sriastrad20230828:
731.343Sriastrad	If:
741.343Sriastrad        - you updated to current and ran postinstall between 20230826
751.343Sriastrad	  and 20230828 inclusive, and
761.343Sriastrad        - you are not using anything outside the base system to
771.343Sriastrad	  populate /etc/openssl/certs (e.g., manually adding
781.343Sriastrad	  certificates or using ca-certificates or mozilla-rootcerts or
791.343Sriastrad	  mozilla-rootcerts-openssl from pkgsrc),
801.343Sriastrad	delete /etc/openssl/certs and rerun postinstall or just
811.343Sriastrad	`certctl rehash'.
821.343Sriastrad
831.343Sriastrad	Otherwise, certctl(8) will think someone else has left
841.343Sriastrad	/etc/openssl/certs in the way and will avoid clobbering it on
851.343Sriastrad	upgrade from older NetBSD.
861.343Sriastrad
871.341Slukem20230718:
881.341Slukem	build.sh will use mk.conf in the same directory as build.sh instead
891.341Slukem	of /etc/mk.conf, unless MAKECONF is already defined in the environment.
901.341Slukem
911.342Smartin20230714:
921.342Smartin	Import of gcc 10.5 requires a clean build of at least tools/gcc
931.342Smartin	and external/gpl3/gcc* object directories. An update build
941.342Smartin	without cleaning will result in obscure failures in rare corner
951.342Smartin	cases.
961.342Smartin
971.339Smartin20230604:
981.339Smartin	Building native kernels with the installed make(1) instead of
991.339Smartin	the $TOOLDIR/bin/nbmake-${arch} wrapper will fail if userland
1001.339Smartin	has not been updated. Note that this is an unsupported build
1011.339Smartin	configuration (but usually works if userland is -current enough).
1021.338Slukem
1031.338Slukem20230523:
1041.338Slukem	ctfmerge was fixed as macOS host tool. This may require a clean tools
1051.338Slukem	rebuild to detect the update to tools/compat/configure.
1061.338Slukem
1071.340Smartin20230515:
1081.340Smartin	New openssl build requires removal of the crypto/external/bsd/openssl
1091.345Sandvar	and tests/crypto/libcrypto subdirectories in the ${OBJDIR} hierarchy.
1101.340Smartin	Otherwise test results may be wrong due to wrong "golden" output
1111.340Smartin	files being installed.
1121.340Smartin
1131.337Smrg20230322:
1141.337Smrg	Fixes for moved /lib/libisns* mean that builds will complain about
1151.337Smrg	./usr/lib/libisns* being missing until src/lib/libisns is forced
1161.337Smrg	to (re)install the files, including the symlinks.  The simplest
1171.337Smrg	way is to clean this subdir before building.
1181.337Smrg
1191.336Smartin20230112:
1201.336Smartin	New binutils require an updated ld.elf_so. If you are doing
1211.336Smartin	(unsupported) in-place self builds (with the -E flag to build.sh),
1221.336Smartin	make sure to have installed latest ld.elf_so before you rebuild
1231.336Smartin	userland.
1241.336Smartin
1251.335Schs20221116:
1261.335Schs	The addition to NetBSD's version of UFS2 of support for extended
1271.335Schs	attributes broke backward compatibility with previous releases
1281.335Schs	of NetBSD, so UFS2 has been restored to being compatible with
1291.335Schs	previous NetBSD releases by disabling extended attributes.
1301.335Schs	(Note that ACLs are implemented as extended attributes, so
1311.335Schs	this changes disables ACLs as well.)
1321.335Schs
1331.335Schs	Support for UFS2 with extended attributes is now available in a new
1341.335Schs	UFS variant called UFS2ea.  If you have created extended attributes
1351.335Schs	in an original UFS2 file system then "fsck -p" will now fail due to
1361.335Schs	the unexpected presence of extended attributes and "fsck -y" will
1371.335Schs	remove all extended attributes.  If you wish to preserve extended
1381.335Schs	attributes rather than delete them, there is a utility to convert
1391.335Schs	a UFS2 file system to UFS2ea and leave extended attributes in place,
1401.335Schs	but this should be used with caution since it will preserve any
1411.335Schs	extended attributes that have been corrupted by the backward
1421.335Schs	incompatibility too.
1431.335Schs
1441.335Schs	If you wish to use a UFS2ea file system as your root file system,
1451.335Schs	then you will need to update your boot loader to a version that
1461.335Schs	supports UFS2ea.
1471.335Schs
1481.335Schs	For more information, see:
1491.335Schs	https://wiki.netbsd.org/features/UFS2ea
1501.335Schs
1511.334Smrg20221111:
1521.334Smrg	The new libdrm import worsened the conflict issues for the
1531.334Smrg	kdump/ktruss ioctl, and i915 now conflicts with base, and has
1541.334Smrg	been turned off.  This will cause update build issues like:
1551.334Smrg
1561.334Smrg		kdump-ioctl.c:12175:143: error: 'DRM_IOCTL_I915_DESTROY_HEAP'
1571.334Smrg		   undeclared here (not in a function);
1581.334Smrg		   did you mean 'DRM_IOCTL_MODE_DESTROY_DUMB'?
1591.334Smrg
1601.334Smrg	You'll need to clean usr.bin/ktruss, usr.bin/kdump, and rescue.
1611.334Smrg
1621.331Sriastrad20220921:
1631.331Sriastrad	Since the kernel version was bumped to 9.99.100, the bootloader
1641.333Sriastrad	must be updated on x86 or EFI boot platforms in order to load
1651.333Sriastrad	modules from boot.cfg(5) or interactively at the bootloader
1661.333Sriastrad	prompt.
1671.333Sriastrad
1681.333Sriastrad	The kernel can still load modules at runtime, with modload(8)
1691.333Sriastrad	or modules.conf(5), with no bootloader update.  This will not
1701.333Sriastrad	affect release branches because it only applies to patch
1711.333Sriastrad	numbers >=100.
1721.333Sriastrad
1731.333Sriastrad	On x86 (i386 or amd64) with BIOS boot, this requires copying a
1741.333Sriastrad	new /usr/mdec/boot to /boot.  You can build this in the destdir
1751.333Sriastrad	by running `$TOOLDIR/bin/nbmake-$ARCH dependall install' in
1761.333Sriastrad	sys/arch/i386/stand.
1771.333Sriastrad
1781.333Sriastrad	On platforms with EFI boot (including x86 with EFI boot), this
1791.333Sriastrad	requires copying a new /usr/mdec/boot*.efi to the EFI/BOOT/
1801.333Sriastrad	directory on the EFI system partition.  The boot*.efi file is:
1811.333Sriastrad
1821.333Sriastrad	aarch64	bootaa64.efi
1831.333Sriastrad	amd64	bootx64.efi
1841.333Sriastrad	arm	bootarm.efi	(32-bit arm)
1851.333Sriastrad	i386	bootx32.efi
1861.333Sriastrad
1871.333Sriastrad	You can build this in the destdir by running
1881.333Sriastrad	`$TOOLDIR/bin/nbmake-$ARCH dependall install' in
1891.333Sriastrad	sys/stand/efiboot/boot*.
1901.331Sriastrad
1911.330Slukem20220821:
1921.330Slukem	Support for building extsrc/ has been deprecated.
1931.330Slukem	EXTSRCSRCDIR and MKEXTSRC have been deprecated.
1941.330Slukem
1951.329Smrg20220714:
1961.329Smrg	Updates to xorg-server and associated drivers may cause builds to
1971.329Smrg	fail.  Cleaning both DESTDIR and the xorg build tree may be needed.
1981.329Smrg
1991.328Smartin20220628:
2001.328Smartin	Changes in the build of src/games/robots require a clean build
2011.328Smartin	of that program.
2021.328Smartin
2031.324Smartin20211116:
2041.324Smartin	Changes in the xorg build require clean obj dirs for external/mit/xorg
2051.325Smartin	(or a full clean/non-update build).
2061.324Smartin
2071.323Snia20211112:
2081.323Snia	Device tree sources were updated for evbarm.  Some device nodes
2091.323Snia	(in particular, ld(4) devices on the ROCKPro64) will be renumbered.
2101.323Snia
2111.322Smartin20211014:
2121.323Snia	MKPIE default for aarch64 has changed, a clean build is required.
2131.322Smartin
2141.321Schristos20210917:
2151.321Schristos	Changed MNT_ACLS to default to POSIX1e ACLs instead of NFSv4
2161.321Schristos	ACLs, to be compatible with FreeBSD. If you are using NFSv4 ACLs
2171.321Schristos	and have "acls" in /etc/fstab you'll need to change it to "nfs4acls".
2181.321Schristos
2191.319Smrg20210711:
2201.319Smrg	Updated GMP sources may require cleaning in tools/gmp and/or in
2211.319Smrg	external/lgpl3/gmp/lib, particularly if GCC itself does not build.
2221.319Smrg
2231.318Smrg20210417:
2241.318Smrg	GCC 10 was enabled for several platforms.  If builds fail in either
2251.351Sgutterid	tools/gcc or external/gpl3/gcc, first try cleaning those objects and
2261.318Smrg	removing the $DESTDIR/usr/include/g++ subdirectory.
2271.318Smrg
2281.316Smrg20201016:
2291.316Smrg	MIPS kernel modules have been disabled until they work.  This will
2301.316Smrg	turn up in extra files in the DESTDIR, which should be cleaned.
2311.316Smrg
2321.315Smrg20200925:
2331.315Smrg	GNU MPC and MPFR have been updated.  At least MPFR needs cleaning
2341.315Smrg	in both the tools and external dirs.
2351.315Smrg
2361.314Smrg20200912:
2371.314Smrg	GCC 9 has arrived for Arm and x86 platforms, and will be coming
2381.314Smrg	for several more, as will binutils 2.34.  Clean as required.
2391.314Smrg
2401.313Smrg20200907:
2411.313Smrg	GCC 9 is coming, and binutils has been updated for MIPS.  This
2421.313Smrg	probably requires cleaning the tools/binutils.
2431.313Smrg
2441.311Smrg20200811:
2451.312Smrg	GCC updates may require cleaning the objdir.  This may occur
2461.312Smrg	due to GCC 7.5 update, GCC 8.4 move to gcc.old, or the upcoming
2471.312Smrg	GCC 9 upgrade.
2481.311Smrg
2491.309Schristos20200614:
2501.310Schristos	blacklist* has been renamed to blocklist*. postinstall(8)
2511.332Sgutterid	should handle the migration.
2521.309Schristos
2531.308Schristos20200601:
2541.308Schristos	Due to a mistake in LIBISPRIVATE handling, .so libraries were
2551.308Schristos	created in the build directories and need cleaning.
2561.308Schristos
2571.307Smrg20200311:
2581.307Smrg	GCC 8 ports will need cleaning in src/tools/gcc and
2591.307Smrg	src/external/gpl3/gcc due to GCC 8.4 update.
2601.307Smrg
2611.306Schristos20191118:
2621.306Schristos	More architectures were switched to gcc8:
2631.306Schristos	    i386, ia64 powerpc64, sparc, sparc64, arm
2641.306Schristos	The same comments as in 20191022 apply.
2651.306Schristos
2661.305Smartin20191112:
2671.305Smartin	The LLVM update requires a clean rebuild for all architectures using
2681.305Smartin	LLVM during the tools build phase (i386, amd64, aarch64).
2691.305Smartin
2701.304Smartin20191022:
2711.304Smartin	Ports amd64 and aarch64 switched to GCC 8.3 by default.
2721.304Smartin	In-place ("expert mode", build.sh -E) builds are not supported
2731.304Smartin	when going from a GCC 7 userland to GCC 8. Do a regular
2741.304Smartin	build to a different DESTDIR (or preferably: build.sh -U) at least
2751.306Schristos	once and install sets, or download comp.{tar.xz,tgz} from the
2761.304Smartin	daily builds and install that before doing the next in-place build.
2771.304Smartin
2781.303Smrg20191001:
2791.303Smrg	GCC 8.3 was imported.  Builds of src/tools/gcc may fail if
2801.303Smrg	old builds with GCC 7 output now uses GCC 8.  Clean this
2811.303Smrg	directory, and also clean src/external/gpl3/gcc.
2821.303Smrg
2831.302Sriastrad20190903:
2841.306Schristos	Files with names that coincide with existing files' names on
2851.302Sriastrad	case-insensitive file systems were inadvertently committed, for
2861.302Sriastrad	radeon GPU firmware.  We cannot mark these as obsolete for
2871.302Sriastrad	postinstall to fix, so if you updated src since 2019-08-26, and
2881.302Sriastrad	ran build.sh distribution or ran build.sh release, you must
2891.302Sriastrad	manually delete the following files in your DESTDIR (which is
2901.302Sriastrad	usually $OBJDIR/destir.$ARCH), or from / if you have installed
2911.302Sriastrad	them:
2921.302Sriastrad
2931.302Sriastrad		/libdata/firmware/radeon/bonaire_ce.bin
2941.302Sriastrad		/libdata/firmware/radeon/bonaire_mc.bin
2951.302Sriastrad		/libdata/firmware/radeon/bonaire_me.bin
2961.302Sriastrad		/libdata/firmware/radeon/bonaire_mec.bin
2971.302Sriastrad		/libdata/firmware/radeon/bonaire_pfp.bin
2981.302Sriastrad		/libdata/firmware/radeon/bonaire_rlc.bin
2991.302Sriastrad		/libdata/firmware/radeon/bonaire_sdma.bin
3001.302Sriastrad		/libdata/firmware/radeon/bonaire_smc.bin
3011.302Sriastrad		/libdata/firmware/radeon/bonaire_uvd.bin
3021.302Sriastrad		/libdata/firmware/radeon/hainan_ce.bin
3031.302Sriastrad		/libdata/firmware/radeon/hainan_mc.bin
3041.302Sriastrad		/libdata/firmware/radeon/hainan_me.bin
3051.302Sriastrad		/libdata/firmware/radeon/hainan_pfp.bin
3061.302Sriastrad		/libdata/firmware/radeon/hainan_rlc.bin
3071.302Sriastrad		/libdata/firmware/radeon/hainan_smc.bin
3081.302Sriastrad		/libdata/firmware/radeon/hawaii_ce.bin
3091.302Sriastrad		/libdata/firmware/radeon/hawaii_mc.bin
3101.302Sriastrad		/libdata/firmware/radeon/hawaii_me.bin
3111.302Sriastrad		/libdata/firmware/radeon/hawaii_mec.bin
3121.302Sriastrad		/libdata/firmware/radeon/hawaii_pfp.bin
3131.302Sriastrad		/libdata/firmware/radeon/hawaii_rlc.bin
3141.302Sriastrad		/libdata/firmware/radeon/hawaii_sdma.bin
3151.302Sriastrad		/libdata/firmware/radeon/hawaii_smc.bin
3161.302Sriastrad		/libdata/firmware/radeon/kabini_ce.bin
3171.302Sriastrad		/libdata/firmware/radeon/kabini_me.bin
3181.302Sriastrad		/libdata/firmware/radeon/kabini_mec.bin
3191.302Sriastrad		/libdata/firmware/radeon/kabini_pfp.bin
3201.302Sriastrad		/libdata/firmware/radeon/kabini_rlc.bin
3211.302Sriastrad		/libdata/firmware/radeon/kabini_sdma.bin
3221.302Sriastrad		/libdata/firmware/radeon/kaveri_ce.bin
3231.302Sriastrad		/libdata/firmware/radeon/kaveri_me.bin
3241.302Sriastrad		/libdata/firmware/radeon/kaveri_mec.bin
3251.302Sriastrad		/libdata/firmware/radeon/kaveri_mec2.bin
3261.302Sriastrad		/libdata/firmware/radeon/kaveri_pfp.bin
3271.302Sriastrad		/libdata/firmware/radeon/kaveri_rlc.bin
3281.302Sriastrad		/libdata/firmware/radeon/kaveri_sdma.bin
3291.302Sriastrad		/libdata/firmware/radeon/mullins_ce.bin
3301.302Sriastrad		/libdata/firmware/radeon/mullins_me.bin
3311.302Sriastrad		/libdata/firmware/radeon/mullins_mec.bin
3321.302Sriastrad		/libdata/firmware/radeon/mullins_pfp.bin
3331.302Sriastrad		/libdata/firmware/radeon/mullins_rlc.bin
3341.302Sriastrad		/libdata/firmware/radeon/mullins_sdma.bin
3351.302Sriastrad		/libdata/firmware/radeon/oland_ce.bin
3361.302Sriastrad		/libdata/firmware/radeon/oland_mc.bin
3371.302Sriastrad		/libdata/firmware/radeon/oland_me.bin
3381.302Sriastrad		/libdata/firmware/radeon/oland_pfp.bin
3391.302Sriastrad		/libdata/firmware/radeon/oland_rlc.bin
3401.302Sriastrad		/libdata/firmware/radeon/oland_smc.bin
3411.302Sriastrad		/libdata/firmware/radeon/pitcairn_ce.bin
3421.302Sriastrad		/libdata/firmware/radeon/pitcairn_mc.bin
3431.302Sriastrad		/libdata/firmware/radeon/pitcairn_me.bin
3441.302Sriastrad		/libdata/firmware/radeon/pitcairn_pfp.bin
3451.302Sriastrad		/libdata/firmware/radeon/pitcairn_rlc.bin
3461.302Sriastrad		/libdata/firmware/radeon/pitcairn_smc.bin
3471.302Sriastrad		/libdata/firmware/radeon/tahiti_ce.bin
3481.302Sriastrad		/libdata/firmware/radeon/tahiti_mc.bin
3491.302Sriastrad		/libdata/firmware/radeon/tahiti_me.bin
3501.302Sriastrad		/libdata/firmware/radeon/tahiti_pfp.bin
3511.302Sriastrad		/libdata/firmware/radeon/tahiti_rlc.bin
3521.302Sriastrad		/libdata/firmware/radeon/tahiti_smc.bin
3531.302Sriastrad		/libdata/firmware/radeon/verde_ce.bin
3541.302Sriastrad		/libdata/firmware/radeon/verde_mc.bin
3551.302Sriastrad		/libdata/firmware/radeon/verde_me.bin
3561.302Sriastrad		/libdata/firmware/radeon/verde_pfp.bin
3571.302Sriastrad		/libdata/firmware/radeon/verde_rlc.bin
3581.302Sriastrad		/libdata/firmware/radeon/verde_smc.bin
3591.302Sriastrad
3601.302Sriastrad	We will re-import these radeon firmware images another way
3611.302Sriastrad	later.
3621.302Sriastrad
3631.301Smartin20190727:
3641.301Smartin	The uefi bootloader has gained tftp support and needs a clean
3651.301Smartin	build. If you do update builds, manually clean its object
3661.301Smartin	directory by something like:
3671.301Smartin	cd sys/arch/i386/stand/efiboot && make clean
3681.301Smartin
3691.300Smartin20190723:
3701.344Sgutterid	The jemalloc allocator in libc is now built without extended
3711.300Smartin	debugging (for performance reasons). In update builds make sure
3721.326Sandvar	to rebuild it completely, by removing all affected object files,
3731.300Smartin	including compat builds, something like:
3741.300Smartin	cd /usr/obj && find . -type d -name jemalloc|xargs rm -rf
3751.300Smartin
3761.299Smrg20190207:
3771.299Smrg	GCC 7 switched for many ports.  Update builds are likely to fail.
3781.299Smrg
3791.1SabsHints for a more successful build:
3801.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3811.123Sjmc    Use build.sh, but do not use its "expert mode":
3821.132Sjmmv	This will automatically build the tools in the
3831.123Sjmc	   correct order, and it will keep the tools and the
3841.123Sjmc	   new build products from interfering with the running
3851.123Sjmc	   system.  This will allow you to ignore most of the
3861.123Sjmc	   other advice in this file.
3871.2Smrg    Build a new kernel first:
3881.2Smrg	This makes sure that any new system calls or features
3891.2Smrg	   expected by the new userland will be present.  This
3901.2Smrg	   helps to avoid critical errors when upgrading.
3911.1Sabs    Use object directories:
3921.1Sabs	This helps to keep stale object
3931.1Sabs	   files from polluting the build if a Makefile "forgets"
3941.1Sabs	   about one.  It also makes it easier to clean up after
3951.1Sabs	   a build.  It's also necessary if you want to use the
3961.1Sabs	   same source tree for multiple machines.
3971.123Sjmc	   To use object directories with build.sh:
3981.123Sjmc	    a) invoke build.sh with the "-M" or "-O" options.
3991.123Sjmc	   To use object directories without using build.sh:
4001.1Sabs	    a) cd /usr/src ; make cleandir
4011.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
4021.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
4031.1Sabs	    d) cd /usr/src ; make build
4041.2Smrg	   Note that running "make obj" in a directory will create
4051.2Smrg	   in obj.$MACHINE directory.
4061.1Sabs    Build to a DESTDIR:
4071.123Sjmc	This helps to keep old installed files (especially libraries)
4081.123Sjmc	   from interfering with the new build.
4091.123Sjmc	   To build to a DESTDIR with build.sh, use the "-D" option.
4101.123Sjmc	   To build to a DESTDIR without using build.sh, set the DESTDIR
4111.123Sjmc	   environment variable before running make build.  It should be
4121.123Sjmc	   set to the pathname of an initially empty directory.
4131.123Sjmc	   Problems: if you do not use build.sh, you might need to
4141.123Sjmc		update critical utilities without using DESTDIR since
4151.123Sjmc		nothing is executed from what is installed in DESTDIR.
4161.123Sjmc		(See critical utils, below.)
4171.1Sabs    Build often:
4181.1Sabs	This keeps critical utilities current enough to not choke
4191.1Sabs	on any other part of the source tree that depends on up to
4201.123Sjmc	date functionality.  If you use build.sh, you should not have
4211.123Sjmc	this problem.
4221.241Swiz
4231.1SabsWhat to do if things don't work:
4241.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4251.230StlsWhen things don't work there are usually a few things that commonly
4261.1Sabsshould be done.
4271.1Sabs    1)	make includes
4281.1Sabs	This should be done automatically by make build.
4291.1Sabs    2)  cd share/mk && make install
4301.1Sabs	Again, automatically done by make build.
4311.1Sabs
4321.1SabsFailsafe rebuild of a small part of the tree:
4331.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4341.1SabsTo make sure you rebuild something correctly you want to do
4351.1Sabssomething like the following:
4361.1Sabs    1)  Make sure the includes and .mk files are up to date.
4371.1Sabs    2)  Make sure any program used to build the particular
4381.1Sabs	utility is up to date.  (yacc, lex, etc...)
4391.1Sabs    3)  cd ...path/to/util...
4401.1Sabs	make cleandir
4411.1Sabs	rm ...all obj directories...
4421.1Sabs	make cleandir			# yes, again
4431.1Sabs	make obj
4441.1Sabs	make depend && make
4451.1Sabs
4461.1SabsFailsafe rebuild of the entire tree:
4471.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4481.1SabsIf you really want to make sure the source tree is clean and
4491.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
4501.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
4511.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
4521.1Sabs
4531.1Sabs---cut here---
4541.1Sabs#!/bin/sh
4551.1Sabs. /etc/mk.conf
4561.1Sabs
4571.58Slukemif [ -z $NETBSDSRCDIR ] ; then
4581.58Slukem    NETBSDSRCDIR=/usr/src
4591.1Sabsfi
4601.58Slukemif [ \! -d $NETBSDSRCDIR ] ; then
4611.1Sabs    echo Unable to find sources
4621.1Sabs    exit 1
4631.1Sabsfi
4641.58Slukemfind $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
4651.1Sabs
4661.1Sabsif [ -z $BSDOBJDIR ] ; then
4671.1Sabs    BSDOBJDIR=/usr/obj
4681.1Sabsfi
4691.1Sabsif [ -d $BSDOBJDIR ] ; then
4701.1Sabs    rm -rf $BSDOBJDIR
4711.1Sabsfi
4721.1Sabs
4731.58Slukemcd $NETBSDSRCDIR && make cleandir
4741.1Sabs
4751.1Sabs---cut here---
4761.1Sabs
4771.1SabsCritical utilities:
4781.1Sabs^^^^^^^^^^^^^^^^^^^
4791.1Sabs	usr.bin/make
4801.1Sabs	usr.bin/yacc
4811.1Sabs	usr.bin/lex
4821.11Slukem	usr.bin/xlint
4831.142Sdrochner	usr.bin/config
4841.1Sabs
4851.34SsimonbOther problems and possible solutions:
4861.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4871.1SabsSymptom:Complaints involving a Makefile.
4881.17SerhFix:	Rebuild usr.bin/make:
4891.17Serh	cd usr.bin/make && make && make install
4901.111Ssimonb	Or, a failsafe method if that doesn't work:
4911.348Srillig	cd usr.bin/make && cc -DMAKE_NATIVE *.c -I. -o make \
4921.348Srillig	&& install make /usr/bin
4931.17Serh
4941.1SabsFix:	Make sure .mk files are up to date.
4951.1Sabs	cd share/mk && make install
4961.2Smrg
4971.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
4981.142SdrochnerFix:	Rebuild usr.bin/config
4991.1Sabs
5001.4SitojunSymptom:Obsolete intermediate files are used during compilation
5011.4SitojunFix:	Try the following sequence of commands in the directory in question.
5021.4Sitojun	make cleandir; rm `make print-objdir`; make cleandir; make obj
5031.4Sitojun	(If you built the tree without "make obj" in the past, obsolete files
5041.4Sitojun	may remain.  The command tries to clean everything up)
5051.5Swiz
5061.207SmbalmerSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible
5071.207Smbalmer	pointer type
5081.5SwizFix:	Rebuild and install usr.bin/menuc
5091.12Sitojun
5101.12SitojunSymptom:mklocale not found during build in share/locale/ctype
5111.12SitojunFix:	Build and install usr.bin/mklocale
5121.13Sdogcow
5131.86SkleinkSymptom:undefined reference to `__assert13' or `__unsetenv13'
5141.13SdogcowFix:    Rebuild and install lib/libc
5151.13Sdogcow
5161.142SdrochnerSymptom:usr.bin/config fails to build.
5171.19ScgdFix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
5181.13Sdogcow
5191.19ScgdSymptom:undefined reference to `getprogname' or `setprogname'
5201.19ScgdFix:    Rebuild and install lib/libc
5211.24Sabs
5221.223SjoergSymptom:Update build fails in src/tools/gcc complaining that a variable
5231.223Sjoerg	(e.g. CPPFLAGS) has changed since the previous run.
5241.223SjoergFix:    Run "nbmake-${ARCH} clean" in src/tools/gcc or do a clean build.
5251.257Sapb
5261.257SapbSymptom:cvs [update aborted]: cannot open directory /cvsroot/src/...:
5271.257Sapb	No such file or directory.
5281.257SapbCause:	If a directory is created by mistake, then it is sometimes
5291.257Sapb	deleted from the CVS repository using administrative commands
5301.257Sapb	that bypass the normal cvs access controls.  If your cvs working tree
5311.257Sapb	contains references to a directory that has been deleted on the
5321.257Sapb	server in this way, then "cvs update" reports this error.
5331.257SapbFix:	Recursively delete the affected directory from your working tree
5341.257Sapb	and try the update again.
535