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