UPDATING revision 1.355
1$NetBSD: UPDATING,v 1.355 2024/08/13 09:49:05 martin Exp $ 2 3This file (UPDATING) is intended to be a brief reference to recent 4changes that might cause problems in the build process, and a guide for 5what to do if something doesn't work. 6 7For a more detailed description of the recommended way to build NetBSD 8using build.sh, see the BUILDING file. 9 10Note that much of the advice in this UPDATING file was written before 11build.sh existed. Nevertheless, the advice here may be useful for 12working around specific problems with build.sh. 13 14Sections are marked with "^^^^^". After the section on "Recent changes" 15are several sections containing more general information. 16 17See also: BUILDING, build.sh, Makefile. 18 19Recent changes: 20^^^^^^^^^^^^^^^ 21 2220240812: 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 2720240630: 28 Update builds will require removing the tools objdir for binutils 29 (as most architectures should use binutils.old now). 30 3120240610: 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 3620240504: 37 Update builds on x86 require making the `cleandir' target in 38 lib/libm, or deleting the objdir for lib/libm. 39 4020240423: 41 Update builds with x11 may fail after switching to Mesa 21. 42 4320240410: 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 4820240409: 49 32-bit compatibility libraries were moved into the base32 50 and debug32 sets. HTML man pages were moved into the manhtml set. 51 5220230828: 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 6720230718: 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 7120230714: 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 7720230604: 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 8320230523: 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 8720230515: 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 9320230322: 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 9920230112: 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 10520221116: 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 13120221111: 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 14220220921: 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 17120220821: 172 Support for building extsrc/ has been deprecated. 173 EXTSRCSRCDIR and MKEXTSRC have been deprecated. 174 17520220714: 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 17920220628: 180 Changes in the build of src/games/robots require a clean build 181 of that program. 182 18320211116: 184 Changes in the xorg build require clean obj dirs for external/mit/xorg 185 (or a full clean/non-update build). 186 18720211112: 188 Device tree sources were updated for evbarm. Some device nodes 189 (in particular, ld(4) devices on the ROCKPro64) will be renumbered. 190 19120211014: 192 MKPIE default for aarch64 has changed, a clean build is required. 193 19420210917: 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 19920210711: 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 20320210417: 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 20820201016: 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 21220200925: 213 GNU MPC and MPFR have been updated. At least MPFR needs cleaning 214 in both the tools and external dirs. 215 21620200912: 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 22020200907: 221 GCC 9 is coming, and binutils has been updated for MIPS. This 222 probably requires cleaning the tools/binutils. 223 22420200811: 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 22920200614: 230 blacklist* has been renamed to blocklist*. postinstall(8) 231 should handle the migration. 232 23320200601: 234 Due to a mistake in LIBISPRIVATE handling, .so libraries were 235 created in the build directories and need cleaning. 236 23720200311: 238 GCC 8 ports will need cleaning in src/tools/gcc and 239 src/external/gpl3/gcc due to GCC 8.4 update. 240 24120191118: 242 More architectures were switched to gcc8: 243 i386, ia64 powerpc64, sparc, sparc64, arm 244 The same comments as in 20191022 apply. 245 24620191112: 247 The LLVM update requires a clean rebuild for all architectures using 248 LLVM during the tools build phase (i386, amd64, aarch64). 249 25020191022: 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 25820191001: 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 26320190903: 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 34320190727: 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 34920190723: 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 35620190207: 357 GCC 7 switched for many ports. Update builds are likely to fail. 358 359Hints 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 403What to do if things don't work: 404^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 405When things don't work there are usually a few things that commonly 406should 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 412Failsafe rebuild of a small part of the tree: 413^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 414To make sure you rebuild something correctly you want to do 415something 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 426Failsafe rebuild of the entire tree: 427^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 428If you really want to make sure the source tree is clean and 429ready 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 431for anyone who uses any make(1) features in /etc/mk.conf. 432 433---cut here--- 434#!/bin/sh 435. /etc/mk.conf 436 437if [ -z $NETBSDSRCDIR ] ; then 438 NETBSDSRCDIR=/usr/src 439fi 440if [ \! -d $NETBSDSRCDIR ] ; then 441 echo Unable to find sources 442 exit 1 443fi 444find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 445 446if [ -z $BSDOBJDIR ] ; then 447 BSDOBJDIR=/usr/obj 448fi 449if [ -d $BSDOBJDIR ] ; then 450 rm -rf $BSDOBJDIR 451fi 452 453cd $NETBSDSRCDIR && make cleandir 454 455---cut here--- 456 457Critical utilities: 458^^^^^^^^^^^^^^^^^^^ 459 usr.bin/make 460 usr.bin/yacc 461 usr.bin/lex 462 usr.bin/xlint 463 usr.bin/config 464 465Other problems and possible solutions: 466^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 467Symptom:Complaints involving a Makefile. 468Fix: 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 474Fix: Make sure .mk files are up to date. 475 cd share/mk && make install 476 477Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 478Fix: Rebuild usr.bin/config 479 480Symptom:Obsolete intermediate files are used during compilation 481Fix: 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 486Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible 487 pointer type 488Fix: Rebuild and install usr.bin/menuc 489 490Symptom:mklocale not found during build in share/locale/ctype 491Fix: Build and install usr.bin/mklocale 492 493Symptom:undefined reference to `__assert13' or `__unsetenv13' 494Fix: Rebuild and install lib/libc 495 496Symptom:usr.bin/config fails to build. 497Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 498 499Symptom:undefined reference to `getprogname' or `setprogname' 500Fix: Rebuild and install lib/libc 501 502Symptom:Update build fails in src/tools/gcc complaining that a variable 503 (e.g. CPPFLAGS) has changed since the previous run. 504Fix: Run "nbmake-${ARCH} clean" in src/tools/gcc or do a clean build. 505 506Symptom:cvs [update aborted]: cannot open directory /cvsroot/src/...: 507 No such file or directory. 508Cause: 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. 513Fix: Recursively delete the affected directory from your working tree 514 and try the update again. 515