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