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