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