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