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