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