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