UPDATING revision 1.363
11.363Smartin$NetBSD: UPDATING,v 1.363 2024/11/05 06:54:46 martin 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.363Smartin20241104:
231.363Smartin	Changes around the integration of the zstd compression
241.363Smartin	library may require manual deletion of some object directories
251.363Smartin	if you update from a build from a few days ago.
261.363Smartin	rm -rf ${OBJ}/tools/gcc/ ${OBJ}/external/gpl3/gcc/
271.363Smartin	rm -rf ${OBJ}/external/bsd/libarchive/ ${OBJ}/external/bsd/file/
281.363Smartin
291.360Swiz20240926:
301.360Swiz	Building -current when running on amd64 from about 20240924
311.360Swiz	to about 20240926 will not work due to a "malloc_np.h"
321.360Swiz	error. Please downgrade to a version from 20240924 or older,
331.360Swiz	or upgrade to a newer version e.g. using a binary release from
341.360Swiz	the NetBSD build servers.
351.360Swiz
361.358Smartin20240923:
371.358Smartin	Update builds will require cleaning the object directories for
381.359Smartin	jemalloc (like: "rm -rf $OBJ/external/bsd/jemalloc*") and the
391.359Smartin	libc dependency files (like: "rm $OBJ/lib/libc/jemalloc.*").
401.359Smartin	On architectures with COMPAT libs, those also have to be cleaned,
411.359Smartin	e.g. on sparc64: "rm -rf $OBJ/compat/sparc64/sparc/external/bsd/jemalloc*"
421.359Smartin	and "rm $OBJ/compat/sparc64/sparc/lib/libc/jemalloc.*".
431.358Smartin
441.357Schristos20240817:
451.357Schristos	Update builds will require cleaning in src/external/historical/nawk/bin
461.357Schristos	in order to remove the awk binary since now there is a subdirectory
471.357Schristos	called awk.
481.358Smartin
491.355Smartin20240812:
501.355Smartin	Update builds will require removing the tools objdir for gdb
511.355Smartin	if building with MKCROSSGDB=yes. All architectures use gdb.old
521.355Smartin	now.
531.356Sriastrad
541.354Smartin20240630:
551.353Smartin	Update builds will require removing the tools objdir for binutils
561.353Smartin	(as most architectures should use binutils.old now).
571.353Smartin
581.352Skre20240610:
591.352Skre	Update builds are likely to require removing the objdir for
601.352Skre	distrib/<arch>/cdroms - or at least references to libarchive
611.352Skre	from within there after the recent libarchive update.
621.352Skre
631.350Sriastrad20240504:
641.350Sriastrad	Update builds on x86 require making the `cleandir' target in
651.350Sriastrad	lib/libm, or deleting the objdir for lib/libm.
661.350Sriastrad
671.349Smaya20240423:
681.349Smaya	Update builds with x11 may fail after switching to Mesa 21.
691.349Smaya
701.346Sriastrad20240410:
711.346Sriastrad	Update builds may require manually deleting
721.346Sriastrad	$DESTDIR/var/run/named (and, potentially,
731.346Sriastrad	$DESTDIR/var/run/lwresd) in order to avoid checkflist failure.
741.346Sriastrad
751.347Snia20240409:
761.347Snia	32-bit compatibility libraries were moved into the base32
771.347Snia	and debug32 sets.  HTML man pages were moved into the manhtml set.
781.347Snia
791.343Sriastrad20230828:
801.343Sriastrad	If:
811.343Sriastrad        - you updated to current and ran postinstall between 20230826
821.343Sriastrad	  and 20230828 inclusive, and
831.343Sriastrad        - you are not using anything outside the base system to
841.343Sriastrad	  populate /etc/openssl/certs (e.g., manually adding
851.343Sriastrad	  certificates or using ca-certificates or mozilla-rootcerts or
861.343Sriastrad	  mozilla-rootcerts-openssl from pkgsrc),
871.343Sriastrad	delete /etc/openssl/certs and rerun postinstall or just
881.343Sriastrad	`certctl rehash'.
891.343Sriastrad
901.343Sriastrad	Otherwise, certctl(8) will think someone else has left
911.343Sriastrad	/etc/openssl/certs in the way and will avoid clobbering it on
921.343Sriastrad	upgrade from older NetBSD.
931.343Sriastrad
941.341Slukem20230718:
951.341Slukem	build.sh will use mk.conf in the same directory as build.sh instead
961.341Slukem	of /etc/mk.conf, unless MAKECONF is already defined in the environment.
971.341Slukem
981.342Smartin20230714:
991.342Smartin	Import of gcc 10.5 requires a clean build of at least tools/gcc
1001.342Smartin	and external/gpl3/gcc* object directories. An update build
1011.342Smartin	without cleaning will result in obscure failures in rare corner
1021.342Smartin	cases.
1031.342Smartin
1041.339Smartin20230604:
1051.339Smartin	Building native kernels with the installed make(1) instead of
1061.339Smartin	the $TOOLDIR/bin/nbmake-${arch} wrapper will fail if userland
1071.339Smartin	has not been updated. Note that this is an unsupported build
1081.339Smartin	configuration (but usually works if userland is -current enough).
1091.338Slukem
1101.338Slukem20230523:
1111.338Slukem	ctfmerge was fixed as macOS host tool. This may require a clean tools
1121.338Slukem	rebuild to detect the update to tools/compat/configure.
1131.338Slukem
1141.340Smartin20230515:
1151.340Smartin	New openssl build requires removal of the crypto/external/bsd/openssl
1161.345Sandvar	and tests/crypto/libcrypto subdirectories in the ${OBJDIR} hierarchy.
1171.340Smartin	Otherwise test results may be wrong due to wrong "golden" output
1181.340Smartin	files being installed.
1191.340Smartin
1201.337Smrg20230322:
1211.337Smrg	Fixes for moved /lib/libisns* mean that builds will complain about
1221.337Smrg	./usr/lib/libisns* being missing until src/lib/libisns is forced
1231.337Smrg	to (re)install the files, including the symlinks.  The simplest
1241.337Smrg	way is to clean this subdir before building.
1251.337Smrg
1261.336Smartin20230112:
1271.336Smartin	New binutils require an updated ld.elf_so. If you are doing
1281.336Smartin	(unsupported) in-place self builds (with the -E flag to build.sh),
1291.336Smartin	make sure to have installed latest ld.elf_so before you rebuild
1301.336Smartin	userland.
1311.336Smartin
1321.335Schs20221116:
1331.335Schs	The addition to NetBSD's version of UFS2 of support for extended
1341.335Schs	attributes broke backward compatibility with previous releases
1351.335Schs	of NetBSD, so UFS2 has been restored to being compatible with
1361.335Schs	previous NetBSD releases by disabling extended attributes.
1371.335Schs	(Note that ACLs are implemented as extended attributes, so
1381.335Schs	this changes disables ACLs as well.)
1391.335Schs
1401.335Schs	Support for UFS2 with extended attributes is now available in a new
1411.335Schs	UFS variant called UFS2ea.  If you have created extended attributes
1421.335Schs	in an original UFS2 file system then "fsck -p" will now fail due to
1431.335Schs	the unexpected presence of extended attributes and "fsck -y" will
1441.335Schs	remove all extended attributes.  If you wish to preserve extended
1451.335Schs	attributes rather than delete them, there is a utility to convert
1461.335Schs	a UFS2 file system to UFS2ea and leave extended attributes in place,
1471.335Schs	but this should be used with caution since it will preserve any
1481.335Schs	extended attributes that have been corrupted by the backward
1491.335Schs	incompatibility too.
1501.335Schs
1511.335Schs	If you wish to use a UFS2ea file system as your root file system,
1521.335Schs	then you will need to update your boot loader to a version that
1531.335Schs	supports UFS2ea.
1541.335Schs
1551.335Schs	For more information, see:
1561.335Schs	https://wiki.netbsd.org/features/UFS2ea
1571.335Schs
1581.334Smrg20221111:
1591.334Smrg	The new libdrm import worsened the conflict issues for the
1601.334Smrg	kdump/ktruss ioctl, and i915 now conflicts with base, and has
1611.334Smrg	been turned off.  This will cause update build issues like:
1621.334Smrg
1631.334Smrg		kdump-ioctl.c:12175:143: error: 'DRM_IOCTL_I915_DESTROY_HEAP'
1641.334Smrg		   undeclared here (not in a function);
1651.334Smrg		   did you mean 'DRM_IOCTL_MODE_DESTROY_DUMB'?
1661.334Smrg
1671.334Smrg	You'll need to clean usr.bin/ktruss, usr.bin/kdump, and rescue.
1681.334Smrg
1691.331Sriastrad20220921:
1701.331Sriastrad	Since the kernel version was bumped to 9.99.100, the bootloader
1711.333Sriastrad	must be updated on x86 or EFI boot platforms in order to load
1721.333Sriastrad	modules from boot.cfg(5) or interactively at the bootloader
1731.333Sriastrad	prompt.
1741.333Sriastrad
1751.333Sriastrad	The kernel can still load modules at runtime, with modload(8)
1761.333Sriastrad	or modules.conf(5), with no bootloader update.  This will not
1771.333Sriastrad	affect release branches because it only applies to patch
1781.333Sriastrad	numbers >=100.
1791.333Sriastrad
1801.333Sriastrad	On x86 (i386 or amd64) with BIOS boot, this requires copying a
1811.333Sriastrad	new /usr/mdec/boot to /boot.  You can build this in the destdir
1821.333Sriastrad	by running `$TOOLDIR/bin/nbmake-$ARCH dependall install' in
1831.333Sriastrad	sys/arch/i386/stand.
1841.333Sriastrad
1851.333Sriastrad	On platforms with EFI boot (including x86 with EFI boot), this
1861.333Sriastrad	requires copying a new /usr/mdec/boot*.efi to the EFI/BOOT/
1871.333Sriastrad	directory on the EFI system partition.  The boot*.efi file is:
1881.333Sriastrad
1891.333Sriastrad	aarch64	bootaa64.efi
1901.333Sriastrad	amd64	bootx64.efi
1911.333Sriastrad	arm	bootarm.efi	(32-bit arm)
1921.333Sriastrad	i386	bootx32.efi
1931.333Sriastrad
1941.333Sriastrad	You can build this in the destdir by running
1951.333Sriastrad	`$TOOLDIR/bin/nbmake-$ARCH dependall install' in
1961.333Sriastrad	sys/stand/efiboot/boot*.
1971.331Sriastrad
1981.330Slukem20220821:
1991.330Slukem	Support for building extsrc/ has been deprecated.
2001.330Slukem	EXTSRCSRCDIR and MKEXTSRC have been deprecated.
2011.330Slukem
2021.329Smrg20220714:
2031.329Smrg	Updates to xorg-server and associated drivers may cause builds to
2041.329Smrg	fail.  Cleaning both DESTDIR and the xorg build tree may be needed.
2051.329Smrg
2061.328Smartin20220628:
2071.328Smartin	Changes in the build of src/games/robots require a clean build
2081.328Smartin	of that program.
2091.328Smartin
2101.324Smartin20211116:
2111.324Smartin	Changes in the xorg build require clean obj dirs for external/mit/xorg
2121.325Smartin	(or a full clean/non-update build).
2131.324Smartin
2141.323Snia20211112:
2151.323Snia	Device tree sources were updated for evbarm.  Some device nodes
2161.323Snia	(in particular, ld(4) devices on the ROCKPro64) will be renumbered.
2171.323Snia
2181.322Smartin20211014:
2191.323Snia	MKPIE default for aarch64 has changed, a clean build is required.
2201.322Smartin
2211.321Schristos20210917:
2221.321Schristos	Changed MNT_ACLS to default to POSIX1e ACLs instead of NFSv4
2231.321Schristos	ACLs, to be compatible with FreeBSD. If you are using NFSv4 ACLs
2241.321Schristos	and have "acls" in /etc/fstab you'll need to change it to "nfs4acls".
2251.321Schristos
2261.319Smrg20210711:
2271.319Smrg	Updated GMP sources may require cleaning in tools/gmp and/or in
2281.319Smrg	external/lgpl3/gmp/lib, particularly if GCC itself does not build.
2291.319Smrg
2301.318Smrg20210417:
2311.318Smrg	GCC 10 was enabled for several platforms.  If builds fail in either
2321.351Sgutterid	tools/gcc or external/gpl3/gcc, first try cleaning those objects and
2331.318Smrg	removing the $DESTDIR/usr/include/g++ subdirectory.
2341.318Smrg
2351.316Smrg20201016:
2361.316Smrg	MIPS kernel modules have been disabled until they work.  This will
2371.316Smrg	turn up in extra files in the DESTDIR, which should be cleaned.
2381.316Smrg
2391.315Smrg20200925:
2401.315Smrg	GNU MPC and MPFR have been updated.  At least MPFR needs cleaning
2411.315Smrg	in both the tools and external dirs.
2421.315Smrg
2431.314Smrg20200912:
2441.314Smrg	GCC 9 has arrived for Arm and x86 platforms, and will be coming
2451.314Smrg	for several more, as will binutils 2.34.  Clean as required.
2461.314Smrg
2471.313Smrg20200907:
2481.313Smrg	GCC 9 is coming, and binutils has been updated for MIPS.  This
2491.313Smrg	probably requires cleaning the tools/binutils.
2501.313Smrg
2511.311Smrg20200811:
2521.312Smrg	GCC updates may require cleaning the objdir.  This may occur
2531.312Smrg	due to GCC 7.5 update, GCC 8.4 move to gcc.old, or the upcoming
2541.312Smrg	GCC 9 upgrade.
2551.311Smrg
2561.309Schristos20200614:
2571.310Schristos	blacklist* has been renamed to blocklist*. postinstall(8)
2581.332Sgutterid	should handle the migration.
2591.309Schristos
2601.308Schristos20200601:
2611.308Schristos	Due to a mistake in LIBISPRIVATE handling, .so libraries were
2621.308Schristos	created in the build directories and need cleaning.
2631.308Schristos
2641.307Smrg20200311:
2651.307Smrg	GCC 8 ports will need cleaning in src/tools/gcc and
2661.307Smrg	src/external/gpl3/gcc due to GCC 8.4 update.
2671.307Smrg
2681.306Schristos20191118:
2691.306Schristos	More architectures were switched to gcc8:
2701.306Schristos	    i386, ia64 powerpc64, sparc, sparc64, arm
2711.306Schristos	The same comments as in 20191022 apply.
2721.306Schristos
2731.305Smartin20191112:
2741.305Smartin	The LLVM update requires a clean rebuild for all architectures using
2751.305Smartin	LLVM during the tools build phase (i386, amd64, aarch64).
2761.305Smartin
2771.304Smartin20191022:
2781.304Smartin	Ports amd64 and aarch64 switched to GCC 8.3 by default.
2791.304Smartin	In-place ("expert mode", build.sh -E) builds are not supported
2801.304Smartin	when going from a GCC 7 userland to GCC 8. Do a regular
2811.304Smartin	build to a different DESTDIR (or preferably: build.sh -U) at least
2821.306Schristos	once and install sets, or download comp.{tar.xz,tgz} from the
2831.304Smartin	daily builds and install that before doing the next in-place build.
2841.304Smartin
2851.303Smrg20191001:
2861.303Smrg	GCC 8.3 was imported.  Builds of src/tools/gcc may fail if
2871.303Smrg	old builds with GCC 7 output now uses GCC 8.  Clean this
2881.303Smrg	directory, and also clean src/external/gpl3/gcc.
2891.303Smrg
2901.302Sriastrad20190903:
2911.306Schristos	Files with names that coincide with existing files' names on
2921.302Sriastrad	case-insensitive file systems were inadvertently committed, for
2931.302Sriastrad	radeon GPU firmware.  We cannot mark these as obsolete for
2941.302Sriastrad	postinstall to fix, so if you updated src since 2019-08-26, and
2951.302Sriastrad	ran build.sh distribution or ran build.sh release, you must
2961.302Sriastrad	manually delete the following files in your DESTDIR (which is
2971.302Sriastrad	usually $OBJDIR/destir.$ARCH), or from / if you have installed
2981.302Sriastrad	them:
2991.302Sriastrad
3001.302Sriastrad		/libdata/firmware/radeon/bonaire_ce.bin
3011.302Sriastrad		/libdata/firmware/radeon/bonaire_mc.bin
3021.302Sriastrad		/libdata/firmware/radeon/bonaire_me.bin
3031.302Sriastrad		/libdata/firmware/radeon/bonaire_mec.bin
3041.302Sriastrad		/libdata/firmware/radeon/bonaire_pfp.bin
3051.302Sriastrad		/libdata/firmware/radeon/bonaire_rlc.bin
3061.302Sriastrad		/libdata/firmware/radeon/bonaire_sdma.bin
3071.302Sriastrad		/libdata/firmware/radeon/bonaire_smc.bin
3081.302Sriastrad		/libdata/firmware/radeon/bonaire_uvd.bin
3091.302Sriastrad		/libdata/firmware/radeon/hainan_ce.bin
3101.302Sriastrad		/libdata/firmware/radeon/hainan_mc.bin
3111.302Sriastrad		/libdata/firmware/radeon/hainan_me.bin
3121.302Sriastrad		/libdata/firmware/radeon/hainan_pfp.bin
3131.302Sriastrad		/libdata/firmware/radeon/hainan_rlc.bin
3141.302Sriastrad		/libdata/firmware/radeon/hainan_smc.bin
3151.302Sriastrad		/libdata/firmware/radeon/hawaii_ce.bin
3161.302Sriastrad		/libdata/firmware/radeon/hawaii_mc.bin
3171.302Sriastrad		/libdata/firmware/radeon/hawaii_me.bin
3181.302Sriastrad		/libdata/firmware/radeon/hawaii_mec.bin
3191.302Sriastrad		/libdata/firmware/radeon/hawaii_pfp.bin
3201.302Sriastrad		/libdata/firmware/radeon/hawaii_rlc.bin
3211.302Sriastrad		/libdata/firmware/radeon/hawaii_sdma.bin
3221.302Sriastrad		/libdata/firmware/radeon/hawaii_smc.bin
3231.302Sriastrad		/libdata/firmware/radeon/kabini_ce.bin
3241.302Sriastrad		/libdata/firmware/radeon/kabini_me.bin
3251.302Sriastrad		/libdata/firmware/radeon/kabini_mec.bin
3261.302Sriastrad		/libdata/firmware/radeon/kabini_pfp.bin
3271.302Sriastrad		/libdata/firmware/radeon/kabini_rlc.bin
3281.302Sriastrad		/libdata/firmware/radeon/kabini_sdma.bin
3291.302Sriastrad		/libdata/firmware/radeon/kaveri_ce.bin
3301.302Sriastrad		/libdata/firmware/radeon/kaveri_me.bin
3311.302Sriastrad		/libdata/firmware/radeon/kaveri_mec.bin
3321.302Sriastrad		/libdata/firmware/radeon/kaveri_mec2.bin
3331.302Sriastrad		/libdata/firmware/radeon/kaveri_pfp.bin
3341.302Sriastrad		/libdata/firmware/radeon/kaveri_rlc.bin
3351.302Sriastrad		/libdata/firmware/radeon/kaveri_sdma.bin
3361.302Sriastrad		/libdata/firmware/radeon/mullins_ce.bin
3371.302Sriastrad		/libdata/firmware/radeon/mullins_me.bin
3381.302Sriastrad		/libdata/firmware/radeon/mullins_mec.bin
3391.302Sriastrad		/libdata/firmware/radeon/mullins_pfp.bin
3401.302Sriastrad		/libdata/firmware/radeon/mullins_rlc.bin
3411.302Sriastrad		/libdata/firmware/radeon/mullins_sdma.bin
3421.302Sriastrad		/libdata/firmware/radeon/oland_ce.bin
3431.302Sriastrad		/libdata/firmware/radeon/oland_mc.bin
3441.302Sriastrad		/libdata/firmware/radeon/oland_me.bin
3451.302Sriastrad		/libdata/firmware/radeon/oland_pfp.bin
3461.302Sriastrad		/libdata/firmware/radeon/oland_rlc.bin
3471.302Sriastrad		/libdata/firmware/radeon/oland_smc.bin
3481.302Sriastrad		/libdata/firmware/radeon/pitcairn_ce.bin
3491.302Sriastrad		/libdata/firmware/radeon/pitcairn_mc.bin
3501.302Sriastrad		/libdata/firmware/radeon/pitcairn_me.bin
3511.302Sriastrad		/libdata/firmware/radeon/pitcairn_pfp.bin
3521.302Sriastrad		/libdata/firmware/radeon/pitcairn_rlc.bin
3531.302Sriastrad		/libdata/firmware/radeon/pitcairn_smc.bin
3541.302Sriastrad		/libdata/firmware/radeon/tahiti_ce.bin
3551.302Sriastrad		/libdata/firmware/radeon/tahiti_mc.bin
3561.302Sriastrad		/libdata/firmware/radeon/tahiti_me.bin
3571.302Sriastrad		/libdata/firmware/radeon/tahiti_pfp.bin
3581.302Sriastrad		/libdata/firmware/radeon/tahiti_rlc.bin
3591.302Sriastrad		/libdata/firmware/radeon/tahiti_smc.bin
3601.302Sriastrad		/libdata/firmware/radeon/verde_ce.bin
3611.302Sriastrad		/libdata/firmware/radeon/verde_mc.bin
3621.302Sriastrad		/libdata/firmware/radeon/verde_me.bin
3631.302Sriastrad		/libdata/firmware/radeon/verde_pfp.bin
3641.302Sriastrad		/libdata/firmware/radeon/verde_rlc.bin
3651.302Sriastrad		/libdata/firmware/radeon/verde_smc.bin
3661.302Sriastrad
3671.302Sriastrad	We will re-import these radeon firmware images another way
3681.302Sriastrad	later.
3691.302Sriastrad
3701.301Smartin20190727:
3711.301Smartin	The uefi bootloader has gained tftp support and needs a clean
3721.301Smartin	build. If you do update builds, manually clean its object
3731.301Smartin	directory by something like:
3741.301Smartin	cd sys/arch/i386/stand/efiboot && make clean
3751.301Smartin
3761.300Smartin20190723:
3771.344Sgutterid	The jemalloc allocator in libc is now built without extended
3781.300Smartin	debugging (for performance reasons). In update builds make sure
3791.326Sandvar	to rebuild it completely, by removing all affected object files,
3801.300Smartin	including compat builds, something like:
3811.300Smartin	cd /usr/obj && find . -type d -name jemalloc|xargs rm -rf
3821.300Smartin
3831.299Smrg20190207:
3841.299Smrg	GCC 7 switched for many ports.  Update builds are likely to fail.
3851.299Smrg
3861.1SabsHints for a more successful build:
3871.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3881.123Sjmc    Use build.sh, but do not use its "expert mode":
3891.132Sjmmv	This will automatically build the tools in the
3901.123Sjmc	   correct order, and it will keep the tools and the
3911.123Sjmc	   new build products from interfering with the running
3921.123Sjmc	   system.  This will allow you to ignore most of the
3931.123Sjmc	   other advice in this file.
3941.2Smrg    Build a new kernel first:
3951.2Smrg	This makes sure that any new system calls or features
3961.2Smrg	   expected by the new userland will be present.  This
3971.2Smrg	   helps to avoid critical errors when upgrading.
3981.1Sabs    Use object directories:
3991.1Sabs	This helps to keep stale object
4001.1Sabs	   files from polluting the build if a Makefile "forgets"
4011.1Sabs	   about one.  It also makes it easier to clean up after
4021.1Sabs	   a build.  It's also necessary if you want to use the
4031.1Sabs	   same source tree for multiple machines.
4041.123Sjmc	   To use object directories with build.sh:
4051.123Sjmc	    a) invoke build.sh with the "-M" or "-O" options.
4061.123Sjmc	   To use object directories without using build.sh:
4071.1Sabs	    a) cd /usr/src ; make cleandir
4081.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
4091.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
4101.1Sabs	    d) cd /usr/src ; make build
4111.2Smrg	   Note that running "make obj" in a directory will create
4121.2Smrg	   in obj.$MACHINE directory.
4131.1Sabs    Build to a DESTDIR:
4141.123Sjmc	This helps to keep old installed files (especially libraries)
4151.123Sjmc	   from interfering with the new build.
4161.123Sjmc	   To build to a DESTDIR with build.sh, use the "-D" option.
4171.123Sjmc	   To build to a DESTDIR without using build.sh, set the DESTDIR
4181.123Sjmc	   environment variable before running make build.  It should be
4191.123Sjmc	   set to the pathname of an initially empty directory.
4201.123Sjmc	   Problems: if you do not use build.sh, you might need to
4211.123Sjmc		update critical utilities without using DESTDIR since
4221.123Sjmc		nothing is executed from what is installed in DESTDIR.
4231.123Sjmc		(See critical utils, below.)
4241.1Sabs    Build often:
4251.1Sabs	This keeps critical utilities current enough to not choke
4261.1Sabs	on any other part of the source tree that depends on up to
4271.123Sjmc	date functionality.  If you use build.sh, you should not have
4281.123Sjmc	this problem.
4291.241Swiz
4301.1SabsWhat to do if things don't work:
4311.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4321.230StlsWhen things don't work there are usually a few things that commonly
4331.1Sabsshould be done.
4341.1Sabs    1)	make includes
4351.1Sabs	This should be done automatically by make build.
4361.1Sabs    2)  cd share/mk && make install
4371.1Sabs	Again, automatically done by make build.
4381.1Sabs
4391.1SabsFailsafe rebuild of a small part of the tree:
4401.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4411.1SabsTo make sure you rebuild something correctly you want to do
4421.1Sabssomething like the following:
4431.1Sabs    1)  Make sure the includes and .mk files are up to date.
4441.1Sabs    2)  Make sure any program used to build the particular
4451.1Sabs	utility is up to date.  (yacc, lex, etc...)
4461.1Sabs    3)  cd ...path/to/util...
4471.1Sabs	make cleandir
4481.1Sabs	rm ...all obj directories...
4491.1Sabs	make cleandir			# yes, again
4501.1Sabs	make obj
4511.1Sabs	make depend && make
4521.1Sabs
4531.1SabsFailsafe rebuild of the entire tree:
4541.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4551.1SabsIf you really want to make sure the source tree is clean and
4561.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
4571.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
4581.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
4591.1Sabs
4601.1Sabs---cut here---
4611.1Sabs#!/bin/sh
4621.1Sabs. /etc/mk.conf
4631.1Sabs
4641.58Slukemif [ -z $NETBSDSRCDIR ] ; then
4651.58Slukem    NETBSDSRCDIR=/usr/src
4661.1Sabsfi
4671.58Slukemif [ \! -d $NETBSDSRCDIR ] ; then
4681.1Sabs    echo Unable to find sources
4691.1Sabs    exit 1
4701.1Sabsfi
4711.58Slukemfind $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
4721.1Sabs
4731.1Sabsif [ -z $BSDOBJDIR ] ; then
4741.1Sabs    BSDOBJDIR=/usr/obj
4751.1Sabsfi
4761.1Sabsif [ -d $BSDOBJDIR ] ; then
4771.1Sabs    rm -rf $BSDOBJDIR
4781.1Sabsfi
4791.1Sabs
4801.58Slukemcd $NETBSDSRCDIR && make cleandir
4811.1Sabs
4821.1Sabs---cut here---
4831.1Sabs
4841.1SabsCritical utilities:
4851.1Sabs^^^^^^^^^^^^^^^^^^^
4861.1Sabs	usr.bin/make
4871.1Sabs	usr.bin/yacc
4881.1Sabs	usr.bin/lex
4891.11Slukem	usr.bin/xlint
4901.142Sdrochner	usr.bin/config
4911.1Sabs
4921.34SsimonbOther problems and possible solutions:
4931.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4941.1SabsSymptom:Complaints involving a Makefile.
4951.17SerhFix:	Rebuild usr.bin/make:
4961.17Serh	cd usr.bin/make && make && make install
4971.111Ssimonb	Or, a failsafe method if that doesn't work:
4981.348Srillig	cd usr.bin/make && cc -DMAKE_NATIVE *.c -I. -o make \
4991.348Srillig	&& install make /usr/bin
5001.17Serh
5011.1SabsFix:	Make sure .mk files are up to date.
5021.1Sabs	cd share/mk && make install
5031.2Smrg
5041.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
5051.142SdrochnerFix:	Rebuild usr.bin/config
5061.1Sabs
5071.4SitojunSymptom:Obsolete intermediate files are used during compilation
5081.4SitojunFix:	Try the following sequence of commands in the directory in question.
5091.4Sitojun	make cleandir; rm `make print-objdir`; make cleandir; make obj
5101.4Sitojun	(If you built the tree without "make obj" in the past, obsolete files
5111.4Sitojun	may remain.  The command tries to clean everything up)
5121.5Swiz
5131.207SmbalmerSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible
5141.207Smbalmer	pointer type
5151.5SwizFix:	Rebuild and install usr.bin/menuc
5161.12Sitojun
5171.12SitojunSymptom:mklocale not found during build in share/locale/ctype
5181.12SitojunFix:	Build and install usr.bin/mklocale
5191.13Sdogcow
5201.86SkleinkSymptom:undefined reference to `__assert13' or `__unsetenv13'
5211.13SdogcowFix:    Rebuild and install lib/libc
5221.13Sdogcow
5231.142SdrochnerSymptom:usr.bin/config fails to build.
5241.19ScgdFix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
5251.13Sdogcow
5261.19ScgdSymptom:undefined reference to `getprogname' or `setprogname'
5271.19ScgdFix:    Rebuild and install lib/libc
5281.24Sabs
5291.223SjoergSymptom:Update build fails in src/tools/gcc complaining that a variable
5301.223Sjoerg	(e.g. CPPFLAGS) has changed since the previous run.
5311.223SjoergFix:    Run "nbmake-${ARCH} clean" in src/tools/gcc or do a clean build.
5321.257Sapb
5331.257SapbSymptom:cvs [update aborted]: cannot open directory /cvsroot/src/...:
5341.257Sapb	No such file or directory.
5351.257SapbCause:	If a directory is created by mistake, then it is sometimes
5361.257Sapb	deleted from the CVS repository using administrative commands
5371.257Sapb	that bypass the normal cvs access controls.  If your cvs working tree
5381.257Sapb	contains references to a directory that has been deleted on the
5391.257Sapb	server in this way, then "cvs update" reports this error.
5401.257SapbFix:	Recursively delete the affected directory from your working tree
5411.257Sapb	and try the update again.
542