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