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