UPDATING revision 1.227
11.227Sriastrad$NetBSD: UPDATING,v 1.227 2011/08/12 03:26:51 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.123SjmcSee also: BUILDING, build.sh, Makefile.
151.1Sabs
161.1SabsRecent changes:
171.1Sabs^^^^^^^^^^^^^^^
181.227Sriastrad20110806:
191.227Sriastrad	i386 and amd64 have been changed to use GCC 4.5.3, so any
201.227Sriastrad	objdir or DESTDIR for them should be deleted before updating.
211.227Sriastrad
221.226Smrg20110805:
231.226Smrg	The update to GCC 4.5.3 requires a non-trivial portion of
241.226Smrg	the tree to be cleaned.  Best to delete both objdir and
251.226Smrg	DESTDIR before running this update.  So far, only the
261.226Smrg	sparc64, mips and powerpc platforms have changed.
271.226Smrg
281.225Smatt20110803:
291.225Smatt	The layout of external/public-domain/xz has changed. To do an
301.225Smatt	update build you will have to remove the contents of the OBJDIR
311.225Smatt	for external/public-domain/xz/bin by hand as the xz entry there
321.225Smatt	is now a directory.
331.225Smatt
341.223Sjoerg20110410:
351.224Sdholland	The configuration of src/tools/gcc has changed. To do an
361.224Sdholland	update build you have to clean both tools/binutils and
371.224Sdholland	tools/gcc by hand.
381.223Sjoerg
391.222Splunky20110328:
401.222Splunky	Building the Xorg binary was moved into a subdirectory to fix
411.222Splunky	ordering issues with "make all". It may be necessary to remove
421.222Splunky	the OBJDIR for external/mit/xorg/server/xorg-server/hw/xfree86
431.222Splunky	if your update build fails, as the "Xorg" entry there is now a
441.222Splunky	directory.
451.222Splunky
461.220Sjoerg20110121:
471.221Slukem	Assembler files no longer use -traditional-cpp.  This can break
481.220Sjoerg	the build of individual parts of the tree.  This is handled
491.220Sjoerg	correctly by build.sh.  Manual builds have to update /usr/share/mk
501.220Sjoerg	and re-run config(1) for any kernel configurations as needed.
511.218Sjoerg
521.217Sjruoho20101217:
531.217Sjruoho	The tcpdump(8) program was changed to drop privileges and chroot(2)
541.217Sjruoho	by default. It may be necessary to manually update passwd(5) and
551.217Sjruoho	group(5) in order to make the program work with existing setups.
561.217Sjruoho
571.216Schristos20101125:
581.216Schristos	The latest changes to setenv(3) dissallow setting environment
591.216Schristos	variables with names that contain '='. Revision 1.18 of env.c
601.216Schristos	assumed that this was allowed. Installing a new libc with an
611.216Schristos	old copy of /usr/bin/env causes env x=1 printenv | grep x= to
621.216Schristos	break which affects the autoconf tests for dependency finding,
631.216Schristos	so building gcc will end up printing:
641.216Schristos	    checking dependency style of gcc... none
651.216Schristos	    configure: error: no usable dependency style found
661.216Schristos	Fix it by rebuilding and re-installing env.
671.138Slukem
681.215Smrg20101119:
691.215Smrg	Recent Xorg updates in xsrc/external/mit/ may cause various build
701.215Smrg	or run-time problems.  Delete your entire DESTDIR and OBJDIR if you
711.215Smrg	have any build problems with xsrc, or problems with mismatched
721.215Smrg	versions between xorg-server and drivers.
731.215Smrg
741.213Sjmmv20100604:
751.213Sjmmv	The update of ATF to 0.9 causes old tests written in shell to fail
761.213Sjmmv	unless they are rebuilt.  If you are building with MKUPDATE=yes,
771.213Sjmmv	you need to clean the src/external/bsd/atf/tests/ and the src/tests/
781.213Sjmmv	trees by hand.
791.213Sjmmv
801.211Stnozaki20100522:
811.212Smrg	Recent Xorg updates in xsrc/external/mit/ will cause various build
821.212Smrg	problems.  Delete your entire DESTDIR and OBJDIR if you have any
831.212Smrg	build problems with xsrc.
841.212Smrg
851.212Smrg20100522:
861.211Stnozaki	private section of <ctype.h> was splitted, and now mklocale(1)
871.214Sdholland	include ctype_local.h, so you have to make cleandir in tools/mklocale.
881.211Stnozaki
891.210Schristos20100520:
901.210Schristos	The location of the xkb compiled descriptions has changed. Please
911.210Schristos	remove usr/X11R7/lib/X11/xkb/compiled from your $DESTDIR.
921.210Schristos
931.209Snjoly20100222:
941.209Snjoly	The shared objects file extension has been changed from .so to
951.209Snjoly	.pico, in order to avoid conflicts with shared libraries names
961.209Snjoly	libXX.so.  All now stale regular .so files can be removed from
971.209Snjoly	your object directories.
981.209Snjoly
991.208Sroy20100204:
1001.208Sroy	The termcap database has been removed from the sources,
1011.208Sroy	but has not been marked obsolete so it is not removed
1021.208Sroy	from the system when upgrading.
1031.208Sroy	As such, you will need to remove them from your object
1041.208Sroy	and destination directories.
1051.208Sroy
1061.203Sdyoung20091101:
1071.205Sdholland        After updating, it may be necessary to make the 'cleandir'
1081.205Sdholland        target in src/tools/yacc/ and in src/usr.bin/yacc/ before a
1091.205Sdholland        'build.sh -u tools' or 'build.sh -u distribution'.  Ditto
1101.205Sdholland        src/tools/lex/ and src/usr.bin/lex/.
1111.203Sdyoung
1121.202Smrg20091001:
1131.206Sdholland	On amd64 you must rebuild tools (to get the new binutils)
1141.206Sdholland	before building a kernel, or the build fails on cpufunc.S.
1151.206Sdholland
1161.206Sdholland20091001:
1171.202Smrg	An error will create a ./usr/X11R7/lib/X11/xkb/compiled/xkb
1181.202Smrg	symlink, failing the build.  Delete the link, and the subdir
1191.202Smrg	it is in, and retry your build.
1201.202Smrg
1211.201Sdsl20090718:
1221.201Sdsl	libc build changed so that strchr() provides the extra entry
1231.201Sdsl	point for index(). Update build of libc.a (and libc_pic.a)
1241.201Sdsl	may fail because the archive contains the unwanted index.o.
1251.201Sdsl	(Similarly for strrchr() and rindex().)
1261.201Sdsl
1271.198Smrg20090709:
1281.198Smrg	Native Xorg was upgraded again.  Builds will probably fail again
1291.198Smrg	without a clean objdir, at least for src/external/mit/xorg.
1301.198Smrg
1311.197Smrg20090616:
1321.197Smrg	Native Xorg was upgraded.  Builds will need a clean objdir for
1331.197Smrg	src/external/mit/xorg.  Upgrading a system from sets will not
1341.197Smrg	work properly yet as the /usr/X11R7/lib/X11/xkb/symbols/pc
1351.197Smrg	subdirectory has been changed into a file, and this needs to
1361.197Smrg	be manually "rm -r"'ed before installing xbase.tgz.
1371.197Smrg
1381.195Sperry20090501:
1391.195Sperry	Several new functions were added to string.h/libc, and this
1401.195Sperry	can cause autoconf problems during the tool build for people
1411.195Sperry	who fail to clean out their tools objects properly. If you
1421.195Sperry	note messages about stpcpy, stpncpy or strnlen accompanying a
1431.195Sperry	failure during the tool build, clean out all your tools
1441.195Sperry	objects and start again.
1451.195Sperry
1461.194Smrg20090325:
1471.194Smrg	The i386 port was switched to i486 default toolchain.  This requires
1481.194Smrg	cleaning your src/tools directory and $TOOLDIR and rebuilding them.
1491.194Smrg
1501.192Sskrll20090126:
1511.207Smbalmer	The __posix_fadvise50 system call changed assembly stub type. You
1521.207Smbalmer	need to 'rm -f __posix_fadvise50.*' in the libc build directory
1531.207Smbalmer	to avoid using the old assembly stub.
1541.192Sskrll
1551.191Sjoerg20090202:
1561.191Sjoerg	pkg_install now depends on the pkgdb cache for automatic conflict
1571.191Sjoerg	detection.  It is recommented to rebuild the cache with
1581.191Sjoerg	``pkg_admin rebuild''.
1591.191Sjoerg
1601.184Schristos20090110:
1611.184Schristos	time_t and dev_t have been bumped to 64 bit quantities. To upgrade:
1621.184Schristos	1. Make sure your kernel has COMPAT_50 in it. Build and install.
1631.188Schristos	   This is needed even in the MODULAR kernel because there is
1641.188Schristos	   conditionally compiled code in rtsock.c.
1651.184Schristos	2. make sure build.sh completes and the binaries in a chroot work
1661.184Schristos	   before installing.
1671.184Schristos	3. If you don't use build.sh and you build directly to root, and
1681.187Sdholland	   your build breaks in the middle, don't despair. Make sure headers
1691.184Schristos	   are installed properly, and start building libraries first libc
1701.184Schristos	   and libutil, install them and then continue building all the
1711.184Schristos	   libraries in src/lib and src/gnu/lib and install them. Once
1721.184Schristos	   the new libraries are installed, you can restart the build.
1731.184Schristos	4. If you compile packages and you notice link time warnings,
1741.189Shubertf	   rebuild the required packages to update their shared libraries.
1751.189Shubertf	   Any package you rebuild will require rebuilding all the packages
1761.189Shubertf	   that depend on it.
1771.186Schristos	5. Next time you run pwd_mkdb with the new binary, the file
1781.186Schristos	   will be upgraded and it will not be backwards compatible.
1791.190Sapb	6. The utmpx/wtmpx files (/var/run/utmpx and /var/log/wtmpx, see
1801.190Sapb	   lastlogx(5)) have been versioned, and there is a heuristic
1811.190Sapb	   for utmp. You are better off removing the old files after
1821.190Sapb	   upgrading.  The automated clearing of /var/run during
1831.190Sapb	   boot, and the automated rotating of files in /var/log by
1841.190Sapb	   newsyslog(8), may mean that you do not have to remove the
1851.190Sapb	   files manually.
1861.190Sapb	7. The optional accounting file (/var/account/acct, see
1871.190Sapb	   accton(8)) has not been versioned, and will need to be
1881.190Sapb	   removed.  The automatic rotation of the accounting file by
1891.190Sapb	   /etc/daily limits the bad consequences of failure to remove
1901.190Sapb	   the file.
1911.196Sdholland	8. Application software that writes time_t to binary files on
1921.196Sdholland	   disk will break or need attention. Most notably: if you are
1931.196Sdholland	   using PostgreSQL < 8.4, you need to dump your databases,
1941.196Sdholland	   rebuild PostgreSQL with the new time_t, then restore.
1951.185Sjmcneill
1961.183Spgoyette20081219:
1971.183Spgoyette	config(1) has been updated, and one of the files it creates -
1981.183Spgoyette	swapnetbsd.o - has changed format.  You need to rebuild config
1991.183Spgoyette	(done automatically by build.sh) and then you need to rerun
2001.183Spgoyette	config on all kernel configuration files before rebuilding those
2011.183Spgoyette	kernels.
2021.183Spgoyette
2031.181Scube20081205:
2041.181Scube	If you build with MKX11=no, you should remove /etc/rc.d/xdm and
2051.181Scube	/etc/rc.d/xfs from DESTDIR because those files were moved to the xetc
2061.181Scube	set and will appear as extra files for MKX11=no update builds.
2071.178Slukem
2081.179Stsutsui20081122:
2091.182Stsutsui	On i386, various kernel options(4) in GENERIC including
2101.180Swiz	file systems have been disabled and moved into kernel modules.
2111.180Swiz	Before trying a new GENERIC kernel, you have to prepare the
2121.179Stsutsui	following files as well as a new GENERIC kernel:
2131.179Stsutsui
2141.179Stsutsui	- build and install kernel modules from src/sys/modules
2151.179Stsutsui
2161.179Stsutsui	- install the latest bootloader, which will load a module
2171.180Swiz	  for the file system from which the kernel is loaded automatically
2181.179Stsutsui
2191.180Swiz	If you have to load your kernel from a file system which is not of
2201.180Swiz	the same type as the root file system, you have to load the necessary
2211.180Swiz	file system module manually on the boot prompt or in the boot.cfg file.
2221.179Stsutsui
2231.178Slukem20080827:
2241.178Slukem	If you built and installed a libc from sources between
2251.178Slukem	2008/08/20 and 2008/08/26 you got a broken strtouq(3)
2261.178Slukem	which results in false errors reported by lint(1).
2271.178Slukem	Since this breaks the libc build itself, manual help is
2281.180Swiz	needed -- lint must be disabled temporarily, e.g.:
2291.178Slukem	  $ (cd lib/libc && make MKLINT=no dependall install)
2301.178Slukem
2311.177Schristos20080813:
2321.177Schristos	MKDEBUG build was broken because the .depend files did not know
2331.177Schristos	about .go files. You need to remove all .depend files and rebuild.
2341.177Schristos
2351.200Sdholland20080802:
2361.200Sdholland	A regression in binary compatibility for pthread_mutex_t has
2371.200Sdholland	been fixed. Unfortunately, the price is breaking compatibility
2381.200Sdholland	for -current.
2391.200Sdholland
2401.200Sdholland	Threaded programs (using libpthread) and C++ programs (using
2411.200Sdholland	libstdc++) compiled after 20070907 and before 20080802 need to
2421.200Sdholland	be recompiled.
2431.200Sdholland
2441.200Sdholland	One way to find affected pkgsrc packages:
2451.200Sdholland
2461.200Sdholland	  $ grep REQUIRES=/usr/lib/libpthread /var/db/pkg/*/+BUILD_INFO
2471.200Sdholland	  $ grep REQUIRES=/usr/lib/libstdc++ /var/db/pkg/*/+BUILD_INFO
2481.200Sdholland
2491.175Ssimonb20080731:
2501.175Ssimonb	WAPBL (metadata journaling support) has been added, but at this
2511.175Ssimonb	time isn't backwards compatible with pre-WAPBL aware kernels
2521.175Ssimonb	and userland (fsck_ffs in particular).  Please make sure you
2531.175Ssimonb	don't use a journaled filesystem with an older kernel/userland,
2541.176Ssimonb	especially an uncleanly mounted journaled filesystem.  WAPBL
2551.176Ssimonb	also requires the super block to be in the UFS2 format.  You
2561.176Ssimonb	can use fsck_ffs -c 4 to update the superblock format.
2571.175Ssimonb
2581.174Slukem20080721:
2591.174Slukem	Assembler warnings are now fatal if $WARNS>0 and $NOGCCERROR
2601.174Slukem	isn't defined.
2611.174Slukem
2621.173Sfreza20080531:
2631.173Sfreza	The ioctl number of DRVSUSPENDDEV command on /dev/drvctl changed 
2641.173Sfreza	from 125 (conflicted with DRVCTLCOMMAND) to 129. The drvctl(8)
2651.173Sfreza	utility needs to be rebuilt and reinstalled as older binaries
2661.173Sfreza	won't work correctly. The following sequence of commands:
2671.173Sfreza
2681.173Sfreza	  $ (cd sys/sys/ && nbmake-$arch includes)
2691.173Sfreza	  $ (cd sbin/drvctl/ && nbmake-$arch clean)
2701.173Sfreza	  $ (cd sbin/drvctl/ && nbmake-$arch all)
2711.173Sfreza
2721.173Sfreza	leaves new drvctl utility in sbin/drvctl build directory.
2731.173Sfreza
2741.172Slukem20080503:
2751.172Slukem	The <bsd.lib.mk> variable MKPRIVATELIB was renamed to LIBISPRIVATE.
2761.172Slukem
2771.171She20080521:
2781.171She	For a while, unprivileged UPDATE builds would fail to
2791.171She	succeed at the checkflist stage, complaining that
2801.171She	${DESTDIR}/stand/<arch>/ did not exist.  A fix for this
2811.171She	problem was committed to share/mk/bsd.kmodule.mk, revision 1.9.
2821.171She	If you already hit this problem, update the .mk file,
2831.171She	remove ${DESTDIR}/stand/<arch>, and re-run the build.
2841.171She
2851.174Slukem20080303:
2861.174Slukem	Linker warnings are now fatal if $WARNS>0.
2871.174Slukem
2881.170Schristos20080126:
2891.170Schristos	The posix_fadvise system call has been changed from an assembly
2901.170Schristos	stub, to a c file that calls an assembly stub. You need to
2911.170Schristos	'rm -f posix_fadvise.* .depend' in the libc build directory to
2921.170Schristos	avoid using the old assembly stub.
2931.170Schristos
2941.168Sjoerg20071209:
2951.168Sjoerg	The acpiec(4) driver has been split into two attachments. If you
2961.168Sjoerg	get ACPI errors before the attachment, please update your kernel
2971.169Swiz	configuration file appropriately or see GENERIC for more details.
2981.168Sjoerg
2991.166Sxtraeme20071115:
3001.166Sxtraeme	The it(4) driver has been renamed to itesio(4) and the old port
3011.166Sxtraeme	argument specified in the kernel configuration file is not valid
3021.166Sxtraeme	anymore. The itesio(4) driver now uses the Super I/O address port
3031.166Sxtraeme	rather than the EC address port. Please update your kernel
3041.167Swiz	configuration file appropriately or see GENERIC for more details.
3051.166Sxtraeme
3061.165Sjmmv20071028:
3071.165Sjmmv	The pccons(4) driver has been removed from the NetBSD/shark port.
3081.165Sjmmv	You need to update any custom kernel configuration file you have
3091.165Sjmmv	to remove any references to pccons (which includes removing the
3101.165Sjmmv	now useless XSERVER option) and replace them with the correct
3111.165Sjmmv	entries for the wscons driver.  See the GENERIC configuration file
3121.165Sjmmv	for more details.
3131.165Sjmmv
3141.164Sgdt20070913:
3151.164Sgdt	A latent bug in dhclient/dhcpd that caused it to be unable to
3161.164Sgdt	enumerate interfaces was fixed.  The bug began to cause
3171.164Sgdt	problems after 20070911 when the kernel's SIOCGIFCONF
3181.164Sgdt	implementation was repaired.  From 20070529 to 20070911 racoon
3191.164Sgdt	could not enumerate interfaces.  (These are noted because
3201.164Sgdt	normal kernel/userspace version matching hygiene is not
3211.164Sgdt	sufficient to avoid this problem.)  Ensure that both kernel
3221.164Sgdt	and userland are from after 20070913.
3231.164Sgdt
3241.163Sjoerg20070703:
3251.199Sdholland	nbinstall has been renamed ${MACHINE_GNU_ARCH}-install. It
3261.199Sdholland	calls the target-specific strip program, and the logic to pass
3271.199Sdholland	down STRIP from make has been removed.  This requires a
3281.199Sdholland	re-installation of tools.
3291.163Sjoerg
3301.161Sdsl20070422:
3311.161Sdsl	The way OS emulations lookup filenames inside the emulation root
3321.161Sdsl	has been changed.  Rather than modify the pathname (and copy back
3331.161Sdsl	to userspace) namei() and lookup() directly check the emulation
3341.161Sdsl	root. One side effect is that absolute symlinks inside the emulated
3351.167Swiz	root file system will be relative to that file system - unless they
3361.161Sdsl	start /../ this is useful when the emulated root is a real install
3371.161Sdsl	that has such links.
3381.161Sdsl	This might affect symlinks that have been added to reference outside
3391.161Sdsl	the emulated root.
3401.161Sdsl
3411.160Sjmcneill20070412:
3421.160Sjmcneill	The pckbc driver on sgimips IP32 has been removed. Use macekbc
3431.160Sjmcneill	instead. See the GENERIC32_IP3x kernel configuration for an
3441.160Sjmcneill	example.
3451.160Sjmcneill
3461.159Sgdt20070319:
3471.159Sgdt        src/lib/libc/Makefile revision 1.129 broke libc and ld.elf_so
3481.159Sgdt        on many platforms due to incorrect flags settings.  If you
3491.159Sgdt        updated and built after about 20070315, do "nbmake-$arch
3501.159Sgdt	cleandir" in src/lib/libc and src/libexec/ld.elf_so to force a
3511.159Sgdt	rebuild of object files that might have been built
3521.159Sgdt	incorrectly, and ensure that you have at least
3531.159Sgdt	src/lib/libc/Makefile 1.130.
3541.159Sgdt
3551.158Sdbj20070210: 
3561.158Sdbj        src/sys/sys/{sa.h,savar.h} were removed.
3571.158Sdbj          find ${OBJDIR} \( -name .depend -o -name '*.d' \) -print \
3581.158Sdbj              | xargs egrep -l '/sa.h|/savar.h' | xargs rm
3591.158Sdbj        will allow dependencies on those files to get get rebuilt
3601.158Sdbj
3611.157Sapb20070209:
3621.157Sapb        The threading model was changed when the newlock2 branch
3631.157Sapb        was merged to NetBSD-current.  If you boot with a new
3641.157Sapb        kernel (version 4.99.10), then you also need a new pthread
3651.157Sapb        library (/usr/lib/libpthread.so.0.7).  If you boot with
3661.157Sapb        an old kernel, then you need the old pthread library
3671.157Sapb        (/usr/lib/libpthread.so.0.6).  Provided you keep the kernel and
3681.157Sapb        the pthread library in sync, old threaded applications should
3691.157Sapb        continue to work with an old or new kernel.  Note that named(8)
3701.157Sapb	is the only threaded application in the base system.
3711.157Sapb
3721.154She20061214:
3731.154She	Following the move of string_to_flags() and flags_to_string()
3741.154She	from the bin/ls/ sources to libutil, users doing UPDATE builds
3751.154She	will need to do a "make cleandir" in
3761.154She		tools/mtree/, tools/makefs/, tools/binstall/, tools/pax/,
3771.154She		bin/pax/, bin/ls/, usr.sbin/mtree/, usr.sbin/makefs/,
3781.156She		usr.bin/xinstall/, libexec/ftpd/, rescue/, as well
3791.156She		as the installation images in distrib/
3801.154She	in order to excise stale references to the old stat_flags.h header
3811.154She	file in the ls sources -- stat_flags.h has been removed.
3821.154She
3831.152Schristos20061108:
3841.152Schristos	The configure script used in the src/tools/gcc compiler has been
3851.152Schristos	changed to indicate that our libc has ssp support built-in and
3861.152Schristos	does not depend on -lssp and -lssp-nonshared. You'll need to
3871.152Schristos	make clean in src/tools/gcc first to rebuild the compiler.
3881.152Schristos
3891.151Srpaulo20061009:
3901.151Srpaulo	The sysctl variables net.inet{,6}.tcp{,6}.newreno are no longer
3911.151Srpaulo	available. Use net.inet{,6}.tcp{,6}.congctl.selected instead.
3921.151Srpaulo
3931.150Sbjh2120060814:
3941.150Sbjh21	The vt, vidcconsole, kbd, and rpckbd drivers on acorn32 have been
3951.150Sbjh21	withdrawn.  Use vidcvideo and pckbd instead.  See the GENERIC
3961.150Sbjh21	kernel configuration for an example.  X servers from the last
3971.150Sbjh21	few years should cope.
3981.150Sbjh21
3991.149Schristos20060703:
4001.149Schristos	MPACPI is no more. We always configure PCI interrupts using ACPI
4011.149Schristos	if we have an ACPI kernel. The option MPACPI_SCANPCI has been renamed
4021.149Schristos	to ACPI_SCANPCI. Thanks to work from fvdl.
4031.149Schristos
4041.148Sdogcow20060627:
4051.148Sdogcow	socket(2) has changed, and its system call has been versioned.
4061.148Sdogcow	For userlands with the old version of socket(2), make sure that
4071.148Sdogcow	your kernel has 'options COMPAT_30' set, or else 'bad system call'
4081.148Sdogcow	errors will result.
4091.148Sdogcow
4101.1SabsHints for a more successful build:
4111.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4121.123Sjmc    Use build.sh, but do not use its "expert mode":
4131.132Sjmmv	This will automatically build the tools in the
4141.123Sjmc	   correct order, and it will keep the tools and the
4151.123Sjmc	   new build products from interfering with the running
4161.123Sjmc	   system.  This will allow you to ignore most of the
4171.123Sjmc	   other advice in this file.
4181.2Smrg    Build a new kernel first:
4191.2Smrg	This makes sure that any new system calls or features
4201.2Smrg	   expected by the new userland will be present.  This
4211.2Smrg	   helps to avoid critical errors when upgrading.
4221.1Sabs    Use object directories:
4231.1Sabs	This helps to keep stale object
4241.1Sabs	   files from polluting the build if a Makefile "forgets"
4251.1Sabs	   about one.  It also makes it easier to clean up after
4261.1Sabs	   a build.  It's also necessary if you want to use the
4271.1Sabs	   same source tree for multiple machines.
4281.123Sjmc	   To use object directories with build.sh:
4291.123Sjmc	    a) invoke build.sh with the "-M" or "-O" options.
4301.123Sjmc	   To use object directories without using build.sh:
4311.1Sabs	    a) cd /usr/src ; make cleandir
4321.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
4331.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
4341.1Sabs	    d) cd /usr/src ; make build
4351.2Smrg	   Note that running "make obj" in a directory will create
4361.2Smrg	   in obj.$MACHINE directory.
4371.1Sabs    Build to a DESTDIR:
4381.123Sjmc	This helps to keep old installed files (especially libraries)
4391.123Sjmc	   from interfering with the new build.
4401.123Sjmc	   To build to a DESTDIR with build.sh, use the "-D" option.
4411.123Sjmc	   To build to a DESTDIR without using build.sh, set the DESTDIR
4421.123Sjmc	   environment variable before running make build.  It should be
4431.123Sjmc	   set to the pathname of an initially empty directory.
4441.123Sjmc	   Problems: if you do not use build.sh, you might need to
4451.123Sjmc		update critical utilities without using DESTDIR since
4461.123Sjmc		nothing is executed from what is installed in DESTDIR.
4471.123Sjmc		(See critical utils, below.)
4481.1Sabs    Build often:
4491.1Sabs	This keeps critical utilities current enough to not choke
4501.1Sabs	on any other part of the source tree that depends on up to
4511.123Sjmc	date functionality.  If you use build.sh, you should not have
4521.123Sjmc	this problem.
4531.1Sabs 
4541.1SabsWhat to do if things don't work:
4551.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4561.1SabsWhen things don't work there is usually a few things that commonly
4571.1Sabsshould be done.
4581.1Sabs    1)	make includes
4591.1Sabs	This should be done automatically by make build.
4601.1Sabs    2)  cd share/mk && make install
4611.1Sabs	Again, automatically done by make build.
4621.1Sabs
4631.1SabsFailsafe rebuild of a small part of the tree:
4641.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4651.1SabsTo make sure you rebuild something correctly you want to do
4661.1Sabssomething like the following:
4671.1Sabs    1)  Make sure the includes and .mk files are up to date.
4681.1Sabs    2)  Make sure any program used to build the particular
4691.1Sabs	utility is up to date.  (yacc, lex, etc...)
4701.1Sabs    3)  cd ...path/to/util...
4711.1Sabs	make cleandir
4721.1Sabs	rm ...all obj directories...
4731.1Sabs	make cleandir			# yes, again
4741.1Sabs	make obj
4751.1Sabs	make depend && make
4761.1Sabs
4771.1SabsFailsafe rebuild of the entire tree:
4781.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4791.1SabsIf you really want to make sure the source tree is clean and
4801.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
4811.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
4821.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
4831.1Sabs
4841.1Sabs---cut here---
4851.1Sabs#!/bin/sh
4861.1Sabs. /etc/mk.conf
4871.1Sabs
4881.58Slukemif [ -z $NETBSDSRCDIR ] ; then
4891.58Slukem    NETBSDSRCDIR=/usr/src
4901.1Sabsfi
4911.58Slukemif [ \! -d $NETBSDSRCDIR ] ; then
4921.1Sabs    echo Unable to find sources
4931.1Sabs    exit 1
4941.1Sabsfi
4951.58Slukemfind $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
4961.1Sabs
4971.1Sabsif [ -z $BSDOBJDIR ] ; then
4981.1Sabs    BSDOBJDIR=/usr/obj
4991.1Sabsfi
5001.1Sabsif [ -d $BSDOBJDIR ] ; then
5011.1Sabs    rm -rf $BSDOBJDIR
5021.1Sabsfi
5031.1Sabs
5041.58Slukemcd $NETBSDSRCDIR && make cleandir
5051.1Sabs
5061.1Sabs---cut here---
5071.1Sabs
5081.1SabsCritical utilities:
5091.1Sabs^^^^^^^^^^^^^^^^^^^
5101.3Sitojun	usr.bin/compile_et
5111.1Sabs	usr.bin/make
5121.1Sabs	usr.bin/yacc
5131.1Sabs	usr.bin/lex
5141.11Slukem	usr.bin/xlint
5151.142Sdrochner	usr.bin/config
5161.1Sabs
5171.34SsimonbOther problems and possible solutions:
5181.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5191.1SabsSymptom:Complaints involving a Makefile.
5201.17SerhFix:	Rebuild usr.bin/make:
5211.17Serh	cd usr.bin/make && make && make install
5221.111Ssimonb	Or, a failsafe method if that doesn't work:
5231.17Serh	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
5241.17Serh
5251.1SabsFix:	Make sure .mk files are up to date.
5261.1Sabs	cd share/mk && make install
5271.2Smrg
5281.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
5291.142SdrochnerFix:	Rebuild usr.bin/config
5301.1Sabs
5311.1SabsSymptom:
5321.1SabsFix:	Rebuild usr.bin/yacc
5331.1Sabs
5341.1SabsSymptom:
5351.1SabsFix:	Rebuild usr.bin/lex
5361.1Sabs
5371.1SabsSymptom:
5381.1SabsFix:	rm /usr/lib/libbfd.a
5391.4Sitojun
5401.4SitojunSymptom:Obsolete intermediate files are used during compilation
5411.4SitojunFix:	Try the following sequence of commands in the directory in question.
5421.4Sitojun	make cleandir; rm `make print-objdir`; make cleandir; make obj
5431.4Sitojun	(If you built the tree without "make obj" in the past, obsolete files
5441.4Sitojun	may remain.  The command tries to clean everything up)
5451.5Swiz
5461.207SmbalmerSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible
5471.207Smbalmer	pointer type
5481.5SwizFix:	Rebuild and install usr.bin/menuc
5491.12Sitojun
5501.12SitojunSymptom:mklocale not found during build in share/locale/ctype
5511.12SitojunFix:	Build and install usr.bin/mklocale
5521.13Sdogcow
5531.86SkleinkSymptom:undefined reference to `__assert13' or `__unsetenv13'
5541.13SdogcowFix:    Rebuild and install lib/libc
5551.13Sdogcow
5561.142SdrochnerSymptom:usr.bin/config fails to build.
5571.19ScgdFix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
5581.13Sdogcow
5591.19ScgdSymptom:undefined reference to `getprogname' or `setprogname'
5601.19ScgdFix:    Rebuild and install lib/libc
5611.24Sabs
5621.24SabsSymptom:lint does not understand the '-X' option
5631.24SabsFix:    May need to build & install libs with NOLINT=1 before rebuilding lint
5641.223Sjoerg
5651.223SjoergSymptom:Update build fails in src/tools/gcc complaining that a variable
5661.223Sjoerg	(e.g. CPPFLAGS) has changed since the previous run.
5671.223SjoergFix:    Run "nbmake-${ARCH} clean" in src/tools/gcc or do a clean build.
568