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