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