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