UPDATING revision 1.165
1$NetBSD: UPDATING,v 1.165 2007/10/28 18:13:38 jmmv 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
14See also: BUILDING, build.sh, Makefile.
15
16Recent changes:
17^^^^^^^^^^^^^^^
18
1920071028:
20	The pccons(4) driver has been removed from the NetBSD/shark port.
21	You need to update any custom kernel configuration file you have
22	to remove any references to pccons (which includes removing the
23	now useless XSERVER option) and replace them with the correct
24	entries for the wscons driver.  See the GENERIC configuration file
25	for more details.
26
2720070913:
28	A latent bug in dhclient/dhcpd that caused it to be unable to
29	enumerate interfaces was fixed.  The bug began to cause
30	problems after 20070911 when the kernel's SIOCGIFCONF
31	implementation was repaired.  From 20070529 to 20070911 racoon
32	could not enumerate interfaces.  (These are noted because
33	normal kernel/userspace version matching hygiene is not
34	sufficient to avoid this problem.)  Ensure that both kernel
35	and userland are from after 20070913.
36
3720070703:
38	nbinstall has been renamed as it calls the target specific and
39	the logic to pass down STRIP from mk been removed.  This forces
40	a re-installation of tools.
41
4220070422:
43	The way OS emulations lookup filenames inside the emulation root
44	has been changed.  Rather than modify the pathname (and copy back
45	to userspace) namei() and lookup() directly check the emulation
46	root. One side effect is that absolute symlinks inside the emulated
47	root filesytem will be relative to that filesystem - unless they
48	start /../ this is useful when the emulated root is a real install
49	that has such links.
50	This might affect symlinks that have been added to reference outside
51	the emulated root.
52
5320070412:
54	The pckbc driver on sgimips IP32 has been removed. Use macekbc
55	instead. See the GENERIC32_IP3x kernel configuration for an
56	example.
57
5820070319:
59        src/lib/libc/Makefile revision 1.129 broke libc and ld.elf_so
60        on many platforms due to incorrect flags settings.  If you
61        updated and built after about 20070315, do "nbmake-$arch
62	cleandir" in src/lib/libc and src/libexec/ld.elf_so to force a
63	rebuild of object files that might have been built
64	incorrectly, and ensure that you have at least
65	src/lib/libc/Makefile 1.130.
66
6720070210: 
68        src/sys/sys/{sa.h,savar.h} were removed.
69          find ${OBJDIR} \( -name .depend -o -name '*.d' \) -print \
70              | xargs egrep -l '/sa.h|/savar.h' | xargs rm
71        will allow dependencies on those files to get get rebuilt
72
7320070209:
74        The threading model was changed when the newlock2 branch
75        was merged to NetBSD-current.  If you boot with a new
76        kernel (version 4.99.10), then you also need a new pthread
77        library (/usr/lib/libpthread.so.0.7).  If you boot with
78        an old kernel, then you need the old pthread library
79        (/usr/lib/libpthread.so.0.6).  Provided you keep the kernel and
80        the pthread library in sync, old threaded applications should
81        continue to work with an old or new kernel.  Note that named(8)
82	is the only threaded application in the base system.
83
8420061214:
85	Following the move of string_to_flags() and flags_to_string()
86	from the bin/ls/ sources to libutil, users doing UPDATE builds
87	will need to do a "make cleandir" in
88		tools/mtree/, tools/makefs/, tools/binstall/, tools/pax/,
89		bin/pax/, bin/ls/, usr.sbin/mtree/, usr.sbin/makefs/,
90		usr.bin/xinstall/, libexec/ftpd/, rescue/, as well
91		as the installation images in distrib/
92	in order to excise stale references to the old stat_flags.h header
93	file in the ls sources -- stat_flags.h has been removed.
94
9520061108:
96	The configure script used in the src/tools/gcc compiler has been
97	changed to indicate that our libc has ssp support built-in and
98	does not depend on -lssp and -lssp-nonshared. You'll need to
99	make clean in src/tools/gcc first to rebuild the compiler.
100
10120061009:
102	The sysctl variables net.inet{,6}.tcp{,6}.newreno are no longer
103	available. Use net.inet{,6}.tcp{,6}.congctl.selected instead.
104
10520060814:
106	The vt, vidcconsole, kbd, and rpckbd drivers on acorn32 have been
107	withdrawn.  Use vidcvideo and pckbd instead.  See the GENERIC
108	kernel configuration for an example.  X servers from the last
109	few years should cope.
110
11120060703:
112	MPACPI is no more. We always configure PCI interrupts using ACPI
113	if we have an ACPI kernel. The option MPACPI_SCANPCI has been renamed
114	to ACPI_SCANPCI. Thanks to work from fvdl.
115
11620060627:
117	socket(2) has changed, and its system call has been versioned.
118	For userlands with the old version of socket(2), make sure that
119	your kernel has 'options COMPAT_30' set, or else 'bad system call'
120	errors will result.
121
122Hints for a more successful build:
123^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
124    Use build.sh, but do not use its "expert mode":
125	This will automatically build the tools in the
126	   correct order, and it will keep the tools and the
127	   new build products from interfering with the running
128	   system.  This will allow you to ignore most of the
129	   other advice in this file.
130    Build a new kernel first:
131	This makes sure that any new system calls or features
132	   expected by the new userland will be present.  This
133	   helps to avoid critical errors when upgrading.
134    Use object directories:
135	This helps to keep stale object
136	   files from polluting the build if a Makefile "forgets"
137	   about one.  It also makes it easier to clean up after
138	   a build.  It's also necessary if you want to use the
139	   same source tree for multiple machines.
140	   To use object directories with build.sh:
141	    a) invoke build.sh with the "-M" or "-O" options.
142	   To use object directories without using build.sh:
143	    a) cd /usr/src ; make cleandir
144	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
145	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
146	    d) cd /usr/src ; make build
147	   Note that running "make obj" in a directory will create
148	   in obj.$MACHINE directory.
149    Build to a DESTDIR:
150	This helps to keep old installed files (especially libraries)
151	   from interfering with the new build.
152	   To build to a DESTDIR with build.sh, use the "-D" option.
153	   To build to a DESTDIR without using build.sh, set the DESTDIR
154	   environment variable before running make build.  It should be
155	   set to the pathname of an initially empty directory.
156	   Problems: if you do not use build.sh, you might need to
157		update critical utilities without using DESTDIR since
158		nothing is executed from what is installed in DESTDIR.
159		(See critical utils, below.)
160    Build often:
161	This keeps critical utilities current enough to not choke
162	on any other part of the source tree that depends on up to
163	date functionality.  If you use build.sh, you should not have
164	this problem.
165 
166What to do if things don't work:
167^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168When things don't work there is usually a few things that commonly
169should be done.
170    1)	make includes
171	This should be done automatically by make build.
172    2)  cd share/mk && make install
173	Again, automatically done by make build.
174
175Failsafe rebuild of a small part of the tree:
176^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
177To make sure you rebuild something correctly you want to do
178something like the following:
179    1)  Make sure the includes and .mk files are up to date.
180    2)  Make sure any program used to build the particular
181	utility is up to date.  (yacc, lex, etc...)
182    3)  cd ...path/to/util...
183	make cleandir
184	rm ...all obj directories...
185	make cleandir			# yes, again
186	make obj
187	make depend && make
188
189Failsafe rebuild of the entire tree:
190^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
191If you really want to make sure the source tree is clean and
192ready for a build try the following.  Note that sourcing /etc/mk.conf
193(a make(1) Makefile) in this manner is not right, and will not work
194for anyone who uses any make(1) features in /etc/mk.conf.
195
196---cut here---
197#!/bin/sh
198. /etc/mk.conf
199
200if [ -z $NETBSDSRCDIR ] ; then
201    NETBSDSRCDIR=/usr/src
202fi
203if [ \! -d $NETBSDSRCDIR ] ; then
204    echo Unable to find sources
205    exit 1
206fi
207find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
208
209if [ -z $BSDOBJDIR ] ; then
210    BSDOBJDIR=/usr/obj
211fi
212if [ -d $BSDOBJDIR ] ; then
213    rm -rf $BSDOBJDIR
214fi
215
216cd $NETBSDSRCDIR && make cleandir
217
218---cut here---
219
220Critical utilities:
221^^^^^^^^^^^^^^^^^^^
222	usr.bin/compile_et
223	usr.bin/make
224	usr.bin/yacc
225	usr.bin/lex
226	usr.bin/xlint
227	usr.bin/config
228
229Other problems and possible solutions:
230^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
231Symptom:Complaints involving a Makefile.
232Fix:	Rebuild usr.bin/make:
233	cd usr.bin/make && make && make install
234	Or, a failsafe method if that doesn't work:
235	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
236
237Fix:	Make sure .mk files are up to date.
238	cd share/mk && make install
239
240Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
241Fix:	Rebuild usr.bin/config
242
243Symptom:
244Fix:	Rebuild usr.bin/yacc
245
246Symptom:
247Fix:	Rebuild usr.bin/lex
248
249Symptom:
250Fix:	rm /usr/lib/libbfd.a
251
252Symptom:Obsolete intermediate files are used during compilation
253Fix:	Try the following sequence of commands in the directory in question.
254	make cleandir; rm `make print-objdir`; make cleandir; make obj
255	(If you built the tree without "make obj" in the past, obsolete files
256	may remain.  The command tries to clean everything up)
257
258Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
259Fix:	Rebuild and install usr.bin/menuc
260
261Symptom:mklocale not found during build in share/locale/ctype
262Fix:	Build and install usr.bin/mklocale
263
264Symptom:undefined reference to `__assert13' or `__unsetenv13'
265Fix:    Rebuild and install lib/libc
266
267Symptom:usr.bin/config fails to build.
268Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
269
270Symptom:undefined reference to `getprogname' or `setprogname'
271Fix:    Rebuild and install lib/libc
272
273Symptom:lint does not understand the '-X' option
274Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
275