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