UPDATING revision 1.367
11.367Sriastrad$NetBSD: UPDATING,v 1.367 2024/11/22 14:30:28 riastradh 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.367Sriastrad20241122:
231.367Sriastrad	Changes to bsd.lib.mk to improve detecting differences in
241.367Sriastrad	shared library symbol exports may cause some .actsym files in
251.367Sriastrad	the objdir to become stale in update builds.
261.367Sriastrad
271.367Sriastrad	To work around this, delete all files matching `*.actsym' in
281.367Sriastrad	the objdir.  For example:
291.367Sriastrad
301.367Sriastrad	find OBJDIR -name '*.actsym' -type f -print0 | xargs -0 rm
311.367Sriastrad
321.363Smartin20241104:
331.363Smartin	Changes around the integration of the zstd compression
341.363Smartin	library may require manual deletion of some object directories
351.366Sriastrad	if you update from a build from a few days ago:
361.366Sriastrad	rm -rf DESTDIR/usr/lib/*/libarchive*
371.366Sriastrad	rm -rf DESTDIR/usr/lib/*/libmagic*
381.366Sriastrad	rm -rf DESTDIR/usr/lib/*/libzstd*
391.366Sriastrad	rm -rf DESTDIR/usr/lib/libarchive*
401.366Sriastrad	rm -rf DESTDIR/usr/lib/libmagic*
411.366Sriastrad	rm -rf DESTDIR/usr/lib/libzstd*
421.366Sriastrad	rm -rf OBJDIR/compat/*/*/external/bsd/file/
431.366Sriastrad	rm -rf OBJDIR/compat/*/*/external/bsd/libarchive/
441.366Sriastrad	rm -rf OBJDIR/compat/*/*/external/bsd/zstd/
451.366Sriastrad	rm -rf OBJDIR/external/bsd/file/
461.366Sriastrad	rm -rf OBJDIR/external/bsd/libarchive/
471.366Sriastrad	rm -rf OBJDIR/external/bsd/zstd/
481.366Sriastrad	rm -rf OBJDIR/external/gpl3/gcc/
491.366Sriastrad	rm -rf OBJDIR/tools/gcc/
501.363Smartin
511.360Swiz20240926:
521.360Swiz	Building -current when running on amd64 from about 20240924
531.360Swiz	to about 20240926 will not work due to a "malloc_np.h"
541.360Swiz	error. Please downgrade to a version from 20240924 or older,
551.360Swiz	or upgrade to a newer version e.g. using a binary release from
561.360Swiz	the NetBSD build servers.
571.360Swiz
581.358Smartin20240923:
591.358Smartin	Update builds will require cleaning the object directories for
601.359Smartin	jemalloc (like: "rm -rf $OBJ/external/bsd/jemalloc*") and the
611.359Smartin	libc dependency files (like: "rm $OBJ/lib/libc/jemalloc.*").
621.359Smartin	On architectures with COMPAT libs, those also have to be cleaned,
631.359Smartin	e.g. on sparc64: "rm -rf $OBJ/compat/sparc64/sparc/external/bsd/jemalloc*"
641.359Smartin	and "rm $OBJ/compat/sparc64/sparc/lib/libc/jemalloc.*".
651.358Smartin
661.357Schristos20240817:
671.357Schristos	Update builds will require cleaning in src/external/historical/nawk/bin
681.357Schristos	in order to remove the awk binary since now there is a subdirectory
691.357Schristos	called awk.
701.358Smartin
711.355Smartin20240812:
721.355Smartin	Update builds will require removing the tools objdir for gdb
731.355Smartin	if building with MKCROSSGDB=yes. All architectures use gdb.old
741.355Smartin	now.
751.356Sriastrad
761.354Smartin20240630:
771.353Smartin	Update builds will require removing the tools objdir for binutils
781.353Smartin	(as most architectures should use binutils.old now).
791.353Smartin
801.352Skre20240610:
811.352Skre	Update builds are likely to require removing the objdir for
821.352Skre	distrib/<arch>/cdroms - or at least references to libarchive
831.352Skre	from within there after the recent libarchive update.
841.352Skre
851.350Sriastrad20240504:
861.350Sriastrad	Update builds on x86 require making the `cleandir' target in
871.350Sriastrad	lib/libm, or deleting the objdir for lib/libm.
881.350Sriastrad
891.349Smaya20240423:
901.349Smaya	Update builds with x11 may fail after switching to Mesa 21.
911.349Smaya
921.346Sriastrad20240410:
931.346Sriastrad	Update builds may require manually deleting
941.346Sriastrad	$DESTDIR/var/run/named (and, potentially,
951.346Sriastrad	$DESTDIR/var/run/lwresd) in order to avoid checkflist failure.
961.346Sriastrad
971.347Snia20240409:
981.347Snia	32-bit compatibility libraries were moved into the base32
991.347Snia	and debug32 sets.  HTML man pages were moved into the manhtml set.
1001.347Snia
1011.343Sriastrad20230828:
1021.343Sriastrad	If:
1031.343Sriastrad        - you updated to current and ran postinstall between 20230826
1041.343Sriastrad	  and 20230828 inclusive, and
1051.343Sriastrad        - you are not using anything outside the base system to
1061.343Sriastrad	  populate /etc/openssl/certs (e.g., manually adding
1071.343Sriastrad	  certificates or using ca-certificates or mozilla-rootcerts or
1081.343Sriastrad	  mozilla-rootcerts-openssl from pkgsrc),
1091.343Sriastrad	delete /etc/openssl/certs and rerun postinstall or just
1101.343Sriastrad	`certctl rehash'.
1111.343Sriastrad
1121.343Sriastrad	Otherwise, certctl(8) will think someone else has left
1131.343Sriastrad	/etc/openssl/certs in the way and will avoid clobbering it on
1141.343Sriastrad	upgrade from older NetBSD.
1151.343Sriastrad
1161.341Slukem20230718:
1171.341Slukem	build.sh will use mk.conf in the same directory as build.sh instead
1181.341Slukem	of /etc/mk.conf, unless MAKECONF is already defined in the environment.
1191.341Slukem
1201.342Smartin20230714:
1211.342Smartin	Import of gcc 10.5 requires a clean build of at least tools/gcc
1221.342Smartin	and external/gpl3/gcc* object directories. An update build
1231.342Smartin	without cleaning will result in obscure failures in rare corner
1241.342Smartin	cases.
1251.342Smartin
1261.339Smartin20230604:
1271.339Smartin	Building native kernels with the installed make(1) instead of
1281.339Smartin	the $TOOLDIR/bin/nbmake-${arch} wrapper will fail if userland
1291.339Smartin	has not been updated. Note that this is an unsupported build
1301.339Smartin	configuration (but usually works if userland is -current enough).
1311.338Slukem
1321.338Slukem20230523:
1331.338Slukem	ctfmerge was fixed as macOS host tool. This may require a clean tools
1341.338Slukem	rebuild to detect the update to tools/compat/configure.
1351.338Slukem
1361.340Smartin20230515:
1371.340Smartin	New openssl build requires removal of the crypto/external/bsd/openssl
1381.345Sandvar	and tests/crypto/libcrypto subdirectories in the ${OBJDIR} hierarchy.
1391.340Smartin	Otherwise test results may be wrong due to wrong "golden" output
1401.340Smartin	files being installed.
1411.340Smartin
1421.337Smrg20230322:
1431.337Smrg	Fixes for moved /lib/libisns* mean that builds will complain about
1441.337Smrg	./usr/lib/libisns* being missing until src/lib/libisns is forced
1451.337Smrg	to (re)install the files, including the symlinks.  The simplest
1461.337Smrg	way is to clean this subdir before building.
1471.337Smrg
1481.336Smartin20230112:
1491.336Smartin	New binutils require an updated ld.elf_so. If you are doing
1501.336Smartin	(unsupported) in-place self builds (with the -E flag to build.sh),
1511.336Smartin	make sure to have installed latest ld.elf_so before you rebuild
1521.336Smartin	userland.
1531.336Smartin
1541.335Schs20221116:
1551.335Schs	The addition to NetBSD's version of UFS2 of support for extended
1561.335Schs	attributes broke backward compatibility with previous releases
1571.335Schs	of NetBSD, so UFS2 has been restored to being compatible with
1581.335Schs	previous NetBSD releases by disabling extended attributes.
1591.335Schs	(Note that ACLs are implemented as extended attributes, so
1601.335Schs	this changes disables ACLs as well.)
1611.335Schs
1621.335Schs	Support for UFS2 with extended attributes is now available in a new
1631.335Schs	UFS variant called UFS2ea.  If you have created extended attributes
1641.335Schs	in an original UFS2 file system then "fsck -p" will now fail due to
1651.335Schs	the unexpected presence of extended attributes and "fsck -y" will
1661.335Schs	remove all extended attributes.  If you wish to preserve extended
1671.335Schs	attributes rather than delete them, there is a utility to convert
1681.335Schs	a UFS2 file system to UFS2ea and leave extended attributes in place,
1691.335Schs	but this should be used with caution since it will preserve any
1701.335Schs	extended attributes that have been corrupted by the backward
1711.335Schs	incompatibility too.
1721.335Schs
1731.335Schs	If you wish to use a UFS2ea file system as your root file system,
1741.335Schs	then you will need to update your boot loader to a version that
1751.335Schs	supports UFS2ea.
1761.335Schs
1771.335Schs	For more information, see:
1781.335Schs	https://wiki.netbsd.org/features/UFS2ea
1791.335Schs
1801.334Smrg20221111:
1811.334Smrg	The new libdrm import worsened the conflict issues for the
1821.334Smrg	kdump/ktruss ioctl, and i915 now conflicts with base, and has
1831.334Smrg	been turned off.  This will cause update build issues like:
1841.334Smrg
1851.334Smrg		kdump-ioctl.c:12175:143: error: 'DRM_IOCTL_I915_DESTROY_HEAP'
1861.334Smrg		   undeclared here (not in a function);
1871.334Smrg		   did you mean 'DRM_IOCTL_MODE_DESTROY_DUMB'?
1881.334Smrg
1891.334Smrg	You'll need to clean usr.bin/ktruss, usr.bin/kdump, and rescue.
1901.334Smrg
1911.331Sriastrad20220921:
1921.331Sriastrad	Since the kernel version was bumped to 9.99.100, the bootloader
1931.333Sriastrad	must be updated on x86 or EFI boot platforms in order to load
1941.333Sriastrad	modules from boot.cfg(5) or interactively at the bootloader
1951.333Sriastrad	prompt.
1961.333Sriastrad
1971.333Sriastrad	The kernel can still load modules at runtime, with modload(8)
1981.333Sriastrad	or modules.conf(5), with no bootloader update.  This will not
1991.333Sriastrad	affect release branches because it only applies to patch
2001.333Sriastrad	numbers >=100.
2011.333Sriastrad
2021.333Sriastrad	On x86 (i386 or amd64) with BIOS boot, this requires copying a
2031.333Sriastrad	new /usr/mdec/boot to /boot.  You can build this in the destdir
2041.333Sriastrad	by running `$TOOLDIR/bin/nbmake-$ARCH dependall install' in
2051.333Sriastrad	sys/arch/i386/stand.
2061.333Sriastrad
2071.333Sriastrad	On platforms with EFI boot (including x86 with EFI boot), this
2081.333Sriastrad	requires copying a new /usr/mdec/boot*.efi to the EFI/BOOT/
2091.333Sriastrad	directory on the EFI system partition.  The boot*.efi file is:
2101.333Sriastrad
2111.333Sriastrad	aarch64	bootaa64.efi
2121.333Sriastrad	amd64	bootx64.efi
2131.333Sriastrad	arm	bootarm.efi	(32-bit arm)
2141.333Sriastrad	i386	bootx32.efi
2151.333Sriastrad
2161.333Sriastrad	You can build this in the destdir by running
2171.333Sriastrad	`$TOOLDIR/bin/nbmake-$ARCH dependall install' in
2181.333Sriastrad	sys/stand/efiboot/boot*.
2191.331Sriastrad
2201.330Slukem20220821:
2211.330Slukem	Support for building extsrc/ has been deprecated.
2221.330Slukem	EXTSRCSRCDIR and MKEXTSRC have been deprecated.
2231.330Slukem
2241.329Smrg20220714:
2251.329Smrg	Updates to xorg-server and associated drivers may cause builds to
2261.329Smrg	fail.  Cleaning both DESTDIR and the xorg build tree may be needed.
2271.329Smrg
2281.328Smartin20220628:
2291.328Smartin	Changes in the build of src/games/robots require a clean build
2301.328Smartin	of that program.
2311.328Smartin
2321.324Smartin20211116:
2331.324Smartin	Changes in the xorg build require clean obj dirs for external/mit/xorg
2341.325Smartin	(or a full clean/non-update build).
2351.324Smartin
2361.323Snia20211112:
2371.323Snia	Device tree sources were updated for evbarm.  Some device nodes
2381.323Snia	(in particular, ld(4) devices on the ROCKPro64) will be renumbered.
2391.323Snia
2401.322Smartin20211014:
2411.323Snia	MKPIE default for aarch64 has changed, a clean build is required.
2421.322Smartin
2431.321Schristos20210917:
2441.321Schristos	Changed MNT_ACLS to default to POSIX1e ACLs instead of NFSv4
2451.321Schristos	ACLs, to be compatible with FreeBSD. If you are using NFSv4 ACLs
2461.321Schristos	and have "acls" in /etc/fstab you'll need to change it to "nfs4acls".
2471.321Schristos
2481.319Smrg20210711:
2491.319Smrg	Updated GMP sources may require cleaning in tools/gmp and/or in
2501.319Smrg	external/lgpl3/gmp/lib, particularly if GCC itself does not build.
2511.319Smrg
2521.318Smrg20210417:
2531.318Smrg	GCC 10 was enabled for several platforms.  If builds fail in either
2541.351Sgutterid	tools/gcc or external/gpl3/gcc, first try cleaning those objects and
2551.318Smrg	removing the $DESTDIR/usr/include/g++ subdirectory.
2561.318Smrg
2571.316Smrg20201016:
2581.316Smrg	MIPS kernel modules have been disabled until they work.  This will
2591.316Smrg	turn up in extra files in the DESTDIR, which should be cleaned.
2601.316Smrg
2611.315Smrg20200925:
2621.315Smrg	GNU MPC and MPFR have been updated.  At least MPFR needs cleaning
2631.315Smrg	in both the tools and external dirs.
2641.315Smrg
2651.314Smrg20200912:
2661.314Smrg	GCC 9 has arrived for Arm and x86 platforms, and will be coming
2671.314Smrg	for several more, as will binutils 2.34.  Clean as required.
2681.314Smrg
2691.313Smrg20200907:
2701.313Smrg	GCC 9 is coming, and binutils has been updated for MIPS.  This
2711.313Smrg	probably requires cleaning the tools/binutils.
2721.313Smrg
2731.311Smrg20200811:
2741.312Smrg	GCC updates may require cleaning the objdir.  This may occur
2751.312Smrg	due to GCC 7.5 update, GCC 8.4 move to gcc.old, or the upcoming
2761.312Smrg	GCC 9 upgrade.
2771.311Smrg
2781.309Schristos20200614:
2791.310Schristos	blacklist* has been renamed to blocklist*. postinstall(8)
2801.332Sgutterid	should handle the migration.
2811.309Schristos
2821.308Schristos20200601:
2831.308Schristos	Due to a mistake in LIBISPRIVATE handling, .so libraries were
2841.308Schristos	created in the build directories and need cleaning.
2851.308Schristos
2861.307Smrg20200311:
2871.307Smrg	GCC 8 ports will need cleaning in src/tools/gcc and
2881.307Smrg	src/external/gpl3/gcc due to GCC 8.4 update.
2891.307Smrg
2901.306Schristos20191118:
2911.306Schristos	More architectures were switched to gcc8:
2921.306Schristos	    i386, ia64 powerpc64, sparc, sparc64, arm
2931.306Schristos	The same comments as in 20191022 apply.
2941.306Schristos
2951.305Smartin20191112:
2961.305Smartin	The LLVM update requires a clean rebuild for all architectures using
2971.305Smartin	LLVM during the tools build phase (i386, amd64, aarch64).
2981.305Smartin
2991.304Smartin20191022:
3001.304Smartin	Ports amd64 and aarch64 switched to GCC 8.3 by default.
3011.304Smartin	In-place ("expert mode", build.sh -E) builds are not supported
3021.304Smartin	when going from a GCC 7 userland to GCC 8. Do a regular
3031.304Smartin	build to a different DESTDIR (or preferably: build.sh -U) at least
3041.306Schristos	once and install sets, or download comp.{tar.xz,tgz} from the
3051.304Smartin	daily builds and install that before doing the next in-place build.
3061.304Smartin
3071.303Smrg20191001:
3081.303Smrg	GCC 8.3 was imported.  Builds of src/tools/gcc may fail if
3091.303Smrg	old builds with GCC 7 output now uses GCC 8.  Clean this
3101.303Smrg	directory, and also clean src/external/gpl3/gcc.
3111.303Smrg
3121.302Sriastrad20190903:
3131.306Schristos	Files with names that coincide with existing files' names on
3141.302Sriastrad	case-insensitive file systems were inadvertently committed, for
3151.302Sriastrad	radeon GPU firmware.  We cannot mark these as obsolete for
3161.302Sriastrad	postinstall to fix, so if you updated src since 2019-08-26, and
3171.302Sriastrad	ran build.sh distribution or ran build.sh release, you must
3181.302Sriastrad	manually delete the following files in your DESTDIR (which is
3191.302Sriastrad	usually $OBJDIR/destir.$ARCH), or from / if you have installed
3201.302Sriastrad	them:
3211.302Sriastrad
3221.302Sriastrad		/libdata/firmware/radeon/bonaire_ce.bin
3231.302Sriastrad		/libdata/firmware/radeon/bonaire_mc.bin
3241.302Sriastrad		/libdata/firmware/radeon/bonaire_me.bin
3251.302Sriastrad		/libdata/firmware/radeon/bonaire_mec.bin
3261.302Sriastrad		/libdata/firmware/radeon/bonaire_pfp.bin
3271.302Sriastrad		/libdata/firmware/radeon/bonaire_rlc.bin
3281.302Sriastrad		/libdata/firmware/radeon/bonaire_sdma.bin
3291.302Sriastrad		/libdata/firmware/radeon/bonaire_smc.bin
3301.302Sriastrad		/libdata/firmware/radeon/bonaire_uvd.bin
3311.302Sriastrad		/libdata/firmware/radeon/hainan_ce.bin
3321.302Sriastrad		/libdata/firmware/radeon/hainan_mc.bin
3331.302Sriastrad		/libdata/firmware/radeon/hainan_me.bin
3341.302Sriastrad		/libdata/firmware/radeon/hainan_pfp.bin
3351.302Sriastrad		/libdata/firmware/radeon/hainan_rlc.bin
3361.302Sriastrad		/libdata/firmware/radeon/hainan_smc.bin
3371.302Sriastrad		/libdata/firmware/radeon/hawaii_ce.bin
3381.302Sriastrad		/libdata/firmware/radeon/hawaii_mc.bin
3391.302Sriastrad		/libdata/firmware/radeon/hawaii_me.bin
3401.302Sriastrad		/libdata/firmware/radeon/hawaii_mec.bin
3411.302Sriastrad		/libdata/firmware/radeon/hawaii_pfp.bin
3421.302Sriastrad		/libdata/firmware/radeon/hawaii_rlc.bin
3431.302Sriastrad		/libdata/firmware/radeon/hawaii_sdma.bin
3441.302Sriastrad		/libdata/firmware/radeon/hawaii_smc.bin
3451.302Sriastrad		/libdata/firmware/radeon/kabini_ce.bin
3461.302Sriastrad		/libdata/firmware/radeon/kabini_me.bin
3471.302Sriastrad		/libdata/firmware/radeon/kabini_mec.bin
3481.302Sriastrad		/libdata/firmware/radeon/kabini_pfp.bin
3491.302Sriastrad		/libdata/firmware/radeon/kabini_rlc.bin
3501.302Sriastrad		/libdata/firmware/radeon/kabini_sdma.bin
3511.302Sriastrad		/libdata/firmware/radeon/kaveri_ce.bin
3521.302Sriastrad		/libdata/firmware/radeon/kaveri_me.bin
3531.302Sriastrad		/libdata/firmware/radeon/kaveri_mec.bin
3541.302Sriastrad		/libdata/firmware/radeon/kaveri_mec2.bin
3551.302Sriastrad		/libdata/firmware/radeon/kaveri_pfp.bin
3561.302Sriastrad		/libdata/firmware/radeon/kaveri_rlc.bin
3571.302Sriastrad		/libdata/firmware/radeon/kaveri_sdma.bin
3581.302Sriastrad		/libdata/firmware/radeon/mullins_ce.bin
3591.302Sriastrad		/libdata/firmware/radeon/mullins_me.bin
3601.302Sriastrad		/libdata/firmware/radeon/mullins_mec.bin
3611.302Sriastrad		/libdata/firmware/radeon/mullins_pfp.bin
3621.302Sriastrad		/libdata/firmware/radeon/mullins_rlc.bin
3631.302Sriastrad		/libdata/firmware/radeon/mullins_sdma.bin
3641.302Sriastrad		/libdata/firmware/radeon/oland_ce.bin
3651.302Sriastrad		/libdata/firmware/radeon/oland_mc.bin
3661.302Sriastrad		/libdata/firmware/radeon/oland_me.bin
3671.302Sriastrad		/libdata/firmware/radeon/oland_pfp.bin
3681.302Sriastrad		/libdata/firmware/radeon/oland_rlc.bin
3691.302Sriastrad		/libdata/firmware/radeon/oland_smc.bin
3701.302Sriastrad		/libdata/firmware/radeon/pitcairn_ce.bin
3711.302Sriastrad		/libdata/firmware/radeon/pitcairn_mc.bin
3721.302Sriastrad		/libdata/firmware/radeon/pitcairn_me.bin
3731.302Sriastrad		/libdata/firmware/radeon/pitcairn_pfp.bin
3741.302Sriastrad		/libdata/firmware/radeon/pitcairn_rlc.bin
3751.302Sriastrad		/libdata/firmware/radeon/pitcairn_smc.bin
3761.302Sriastrad		/libdata/firmware/radeon/tahiti_ce.bin
3771.302Sriastrad		/libdata/firmware/radeon/tahiti_mc.bin
3781.302Sriastrad		/libdata/firmware/radeon/tahiti_me.bin
3791.302Sriastrad		/libdata/firmware/radeon/tahiti_pfp.bin
3801.302Sriastrad		/libdata/firmware/radeon/tahiti_rlc.bin
3811.302Sriastrad		/libdata/firmware/radeon/tahiti_smc.bin
3821.302Sriastrad		/libdata/firmware/radeon/verde_ce.bin
3831.302Sriastrad		/libdata/firmware/radeon/verde_mc.bin
3841.302Sriastrad		/libdata/firmware/radeon/verde_me.bin
3851.302Sriastrad		/libdata/firmware/radeon/verde_pfp.bin
3861.302Sriastrad		/libdata/firmware/radeon/verde_rlc.bin
3871.302Sriastrad		/libdata/firmware/radeon/verde_smc.bin
3881.302Sriastrad
3891.302Sriastrad	We will re-import these radeon firmware images another way
3901.302Sriastrad	later.
3911.302Sriastrad
3921.301Smartin20190727:
3931.301Smartin	The uefi bootloader has gained tftp support and needs a clean
3941.301Smartin	build. If you do update builds, manually clean its object
3951.301Smartin	directory by something like:
3961.301Smartin	cd sys/arch/i386/stand/efiboot && make clean
3971.301Smartin
3981.300Smartin20190723:
3991.344Sgutterid	The jemalloc allocator in libc is now built without extended
4001.300Smartin	debugging (for performance reasons). In update builds make sure
4011.326Sandvar	to rebuild it completely, by removing all affected object files,
4021.300Smartin	including compat builds, something like:
4031.300Smartin	cd /usr/obj && find . -type d -name jemalloc|xargs rm -rf
4041.300Smartin
4051.299Smrg20190207:
4061.299Smrg	GCC 7 switched for many ports.  Update builds are likely to fail.
4071.299Smrg
4081.1SabsHints for a more successful build:
4091.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4101.123Sjmc    Use build.sh, but do not use its "expert mode":
4111.132Sjmmv	This will automatically build the tools in the
4121.123Sjmc	   correct order, and it will keep the tools and the
4131.123Sjmc	   new build products from interfering with the running
4141.123Sjmc	   system.  This will allow you to ignore most of the
4151.123Sjmc	   other advice in this file.
4161.2Smrg    Build a new kernel first:
4171.2Smrg	This makes sure that any new system calls or features
4181.2Smrg	   expected by the new userland will be present.  This
4191.2Smrg	   helps to avoid critical errors when upgrading.
4201.1Sabs    Use object directories:
4211.1Sabs	This helps to keep stale object
4221.1Sabs	   files from polluting the build if a Makefile "forgets"
4231.1Sabs	   about one.  It also makes it easier to clean up after
4241.1Sabs	   a build.  It's also necessary if you want to use the
4251.1Sabs	   same source tree for multiple machines.
4261.123Sjmc	   To use object directories with build.sh:
4271.123Sjmc	    a) invoke build.sh with the "-M" or "-O" options.
4281.123Sjmc	   To use object directories without using build.sh:
4291.1Sabs	    a) cd /usr/src ; make cleandir
4301.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
4311.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
4321.1Sabs	    d) cd /usr/src ; make build
4331.2Smrg	   Note that running "make obj" in a directory will create
4341.2Smrg	   in obj.$MACHINE directory.
4351.1Sabs    Build to a DESTDIR:
4361.123Sjmc	This helps to keep old installed files (especially libraries)
4371.123Sjmc	   from interfering with the new build.
4381.123Sjmc	   To build to a DESTDIR with build.sh, use the "-D" option.
4391.123Sjmc	   To build to a DESTDIR without using build.sh, set the DESTDIR
4401.123Sjmc	   environment variable before running make build.  It should be
4411.123Sjmc	   set to the pathname of an initially empty directory.
4421.123Sjmc	   Problems: if you do not use build.sh, you might need to
4431.123Sjmc		update critical utilities without using DESTDIR since
4441.123Sjmc		nothing is executed from what is installed in DESTDIR.
4451.123Sjmc		(See critical utils, below.)
4461.1Sabs    Build often:
4471.1Sabs	This keeps critical utilities current enough to not choke
4481.1Sabs	on any other part of the source tree that depends on up to
4491.123Sjmc	date functionality.  If you use build.sh, you should not have
4501.123Sjmc	this problem.
4511.241Swiz
4521.1SabsWhat to do if things don't work:
4531.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4541.230StlsWhen things don't work there are usually a few things that commonly
4551.1Sabsshould be done.
4561.1Sabs    1)	make includes
4571.1Sabs	This should be done automatically by make build.
4581.1Sabs    2)  cd share/mk && make install
4591.1Sabs	Again, automatically done by make build.
4601.1Sabs
4611.1SabsFailsafe rebuild of a small part of the tree:
4621.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4631.1SabsTo make sure you rebuild something correctly you want to do
4641.1Sabssomething like the following:
4651.1Sabs    1)  Make sure the includes and .mk files are up to date.
4661.1Sabs    2)  Make sure any program used to build the particular
4671.1Sabs	utility is up to date.  (yacc, lex, etc...)
4681.1Sabs    3)  cd ...path/to/util...
4691.1Sabs	make cleandir
4701.1Sabs	rm ...all obj directories...
4711.1Sabs	make cleandir			# yes, again
4721.1Sabs	make obj
4731.1Sabs	make depend && make
4741.1Sabs
4751.1SabsFailsafe rebuild of the entire tree:
4761.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4771.1SabsIf you really want to make sure the source tree is clean and
4781.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
4791.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
4801.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
4811.1Sabs
4821.1Sabs---cut here---
4831.1Sabs#!/bin/sh
4841.1Sabs. /etc/mk.conf
4851.1Sabs
4861.58Slukemif [ -z $NETBSDSRCDIR ] ; then
4871.58Slukem    NETBSDSRCDIR=/usr/src
4881.1Sabsfi
4891.58Slukemif [ \! -d $NETBSDSRCDIR ] ; then
4901.1Sabs    echo Unable to find sources
4911.1Sabs    exit 1
4921.1Sabsfi
4931.58Slukemfind $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
4941.1Sabs
4951.1Sabsif [ -z $BSDOBJDIR ] ; then
4961.1Sabs    BSDOBJDIR=/usr/obj
4971.1Sabsfi
4981.1Sabsif [ -d $BSDOBJDIR ] ; then
4991.1Sabs    rm -rf $BSDOBJDIR
5001.1Sabsfi
5011.1Sabs
5021.58Slukemcd $NETBSDSRCDIR && make cleandir
5031.1Sabs
5041.1Sabs---cut here---
5051.1Sabs
5061.1SabsCritical utilities:
5071.1Sabs^^^^^^^^^^^^^^^^^^^
5081.1Sabs	usr.bin/make
5091.1Sabs	usr.bin/yacc
5101.1Sabs	usr.bin/lex
5111.11Slukem	usr.bin/xlint
5121.142Sdrochner	usr.bin/config
5131.1Sabs
5141.34SsimonbOther problems and possible solutions:
5151.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5161.1SabsSymptom:Complaints involving a Makefile.
5171.17SerhFix:	Rebuild usr.bin/make:
5181.17Serh	cd usr.bin/make && make && make install
5191.111Ssimonb	Or, a failsafe method if that doesn't work:
5201.348Srillig	cd usr.bin/make && cc -DMAKE_NATIVE *.c -I. -o make \
5211.348Srillig	&& install make /usr/bin
5221.17Serh
5231.1SabsFix:	Make sure .mk files are up to date.
5241.1Sabs	cd share/mk && make install
5251.2Smrg
5261.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
5271.142SdrochnerFix:	Rebuild usr.bin/config
5281.1Sabs
5291.4SitojunSymptom:Obsolete intermediate files are used during compilation
5301.4SitojunFix:	Try the following sequence of commands in the directory in question.
5311.4Sitojun	make cleandir; rm `make print-objdir`; make cleandir; make obj
5321.4Sitojun	(If you built the tree without "make obj" in the past, obsolete files
5331.4Sitojun	may remain.  The command tries to clean everything up)
5341.5Swiz
5351.207SmbalmerSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible
5361.207Smbalmer	pointer type
5371.5SwizFix:	Rebuild and install usr.bin/menuc
5381.12Sitojun
5391.12SitojunSymptom:mklocale not found during build in share/locale/ctype
5401.12SitojunFix:	Build and install usr.bin/mklocale
5411.13Sdogcow
5421.86SkleinkSymptom:undefined reference to `__assert13' or `__unsetenv13'
5431.13SdogcowFix:    Rebuild and install lib/libc
5441.13Sdogcow
5451.142SdrochnerSymptom:usr.bin/config fails to build.
5461.19ScgdFix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
5471.13Sdogcow
5481.19ScgdSymptom:undefined reference to `getprogname' or `setprogname'
5491.19ScgdFix:    Rebuild and install lib/libc
5501.24Sabs
5511.223SjoergSymptom:Update build fails in src/tools/gcc complaining that a variable
5521.223Sjoerg	(e.g. CPPFLAGS) has changed since the previous run.
5531.223SjoergFix:    Run "nbmake-${ARCH} clean" in src/tools/gcc or do a clean build.
5541.257Sapb
5551.257SapbSymptom:cvs [update aborted]: cannot open directory /cvsroot/src/...:
5561.257Sapb	No such file or directory.
5571.257SapbCause:	If a directory is created by mistake, then it is sometimes
5581.257Sapb	deleted from the CVS repository using administrative commands
5591.257Sapb	that bypass the normal cvs access controls.  If your cvs working tree
5601.257Sapb	contains references to a directory that has been deleted on the
5611.257Sapb	server in this way, then "cvs update" reports this error.
5621.257SapbFix:	Recursively delete the affected directory from your working tree
5631.257Sapb	and try the update again.
564