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