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