UPDATING revision 1.28 1 $NetBSD: UPDATING,v 1.28 2001/07/26 08:51:17 assar Exp $
2
3 This file is intended to be a brief introduction to the build
4 process and a reference on what to do if something doesn't work.
5
6 For a more detailed description see Makefile.
7
8 Recent changes:
9 ^^^^^^^^^^^^^^^
10
11 20010726:
12 Texinfo was updated to 4.0. To avoid failures when trying to
13 build the included texinfo files, do:
14
15 cd src/gnu/usr.bin/texinfo
16 make MKINFO=no dependall install
17
18 20010718:
19
20 Enabled correct .init/.fini processing in crt0. The way this
21 was done was to change a -I directive to cc(1), which means
22 make(1) will have a stale dependency (it will be checking the
23 timestamp on the wrong "dot_init.h").
24
25 The symptom you will see is that new programs die with SIGSEGV
26 if you have a stale dependency.
27
28 Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
29 before starting your build.
30
31 20010628:
32
33 A construct was added to uvm_page.h that uncovered a bug
34 in lint(1). If you get a warning/error about a non-portable
35 bitfield, update your lint(1) before proceeding.
36
37 20010226:
38
39 Added named user/group to system. Need to hand add this in or builds
40 will break as mtree aborts early.
41
42 To work around add by hand:
43
44 named:*:14:
45
46 to /etc/group and add:
47
48 named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
49
50 to master.passwd (use vipw for instance if doing by hand).
51
52 Now a make build should progress.
53
54 20010219:
55 get/setprogname() added. Any hostprog's that may use this will need
56 to be bootstrapped manually until the host system is current.
57
58 Known problems: sys/arch/macppc/stand/fixcoff
59 usr.sbin/config (adding -DMAKE_BOOTSTRAP to
60 CFLAGS and rebuilding should work)
61 usr.sbin/mdsetimage - Build a static copy if
62 building a snapshot before fully bootstrapped.
63
64 20010204:
65 prepare the code to compile with stricter gcc flags. in
66 particular start eliminating redundant declarations. Yacc
67 needs to be installed before make build.
68
69 20010114:
70 introduce .if commands(target) in make(1). You need to
71 bring everything up-to-date first, then without installing
72 anything make and install in usr.bin/make, then proceed
73 with make build.
74
75 20010101:
76 bsd.subdir.mk committed 20001230 had a bug which caused
77 afterinstall targets to run too soon; update again.
78
79 20001230:
80 New share/mk files needed to support .WAIT in SUBDIR variables.
81 If you get make errors,
82 (cd share/mk; make install)
83 Also, PRINTOBJDIR has changed and is now used more heavily.
84
85 20001019:
86 The `ca' device driver has been replaced by `ld'; although the
87 major and minor numbers haven't changed, you should update your /dev
88 directory.
89
90 20000929:
91 The following make directives are obsoleted.
92 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA
93 By default, RSA is built into libcrypto. IDEA and RC5 will not be
94 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build
95 additional library libcrypto_{idea,rc5}.
96
97 20000623:
98 MKCRYPTO and friends added to share/mk/bsd.own.mk.
99 'cd share/mk ; make install' needed before make build.
100
101
102 Hints for a more successful build:
103 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104 Build a new kernel first:
105 This makes sure that any new system calls or features
106 expected by the new userland will be present. This
107 helps to avoid critical errors when upgrading.
108 Use object directories:
109 This helps to keep stale object
110 files from polluting the build if a Makefile "forgets"
111 about one. It also makes it easier to clean up after
112 a build. It's also necessary if you want to use the
113 same source tree for multiple machines.
114 To use object directories:
115 a) cd /usr/src ; make cleandir
116 b) Add "OBJMACHINE=yes" to /etc/mk.conf
117 c) Add "MKOBJDIRS=yes" to /etc/mk.conf
118 d) cd /usr/src ; make build
119 Note that running "make obj" in a directory will create
120 in obj.$MACHINE directory.
121 Build to a DESTDIR:
122 This helps to keep old
123 installed files (especially libraries) from interfering
124 with the new build.
125 To build to a DESTDIR, set the DESTDIR environment
126 variable before running make build. It should be set to
127 the pathname of an initially empty directory.
128 Problems: you might need to update critical utilities
129 without using DESTDIR since nothing is executed
130 from what is installed in DESTDIR.
131 (See critical utils, below)
132 Build often:
133 This keeps critical utilities current enough to not choke
134 on any other part of the source tree that depends on up to
135 date functionality.
136
137 What to do if things don't work:
138 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
139 When things don't work there is usually a few things that commonly
140 should be done.
141 1) make includes
142 This should be done automatically by make build.
143 2) cd share/mk && make install
144 Again, automatically done by make build.
145
146 Failsafe rebuild of a small part of the tree:
147 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
148 To make sure you rebuild something correctly you want to do
149 something like the following:
150 1) Make sure the includes and .mk files are up to date.
151 2) Make sure any program used to build the particular
152 utility is up to date. (yacc, lex, etc...)
153 3) cd ...path/to/util...
154 make cleandir
155 rm ...all obj directories...
156 make cleandir # yes, again
157 make obj
158 make depend && make
159
160 Failsafe rebuild of the entire tree:
161 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
162 If you really want to make sure the source tree is clean and
163 ready for a build try the following. Note that sourcing /etc/mk.conf
164 (a make(1) Makefile) in this manner is not right, and will not work
165 for anyone who uses any make(1) features in /etc/mk.conf.
166
167 ---cut here---
168 #!/bin/sh
169 . /etc/mk.conf
170
171 if [ -z $BSDSRCDIR ] ; then
172 BSDSRCDIR=/usr/src
173 fi
174 if [ \! -d $BSDSRCDIR ] ; then
175 echo Unable to find sources
176 exit 1
177 fi
178 find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
179
180 if [ -z $BSDOBJDIR ] ; then
181 BSDOBJDIR=/usr/obj
182 fi
183 if [ -d $BSDOBJDIR ] ; then
184 rm -rf $BSDOBJDIR
185 fi
186
187 cd $BSDSRCDIR && make cleandir
188
189 ---cut here---
190
191 Critical utilities:
192 ^^^^^^^^^^^^^^^^^^^
193 gnu/usr.bin/egcs
194 usr.bin/compile_et
195 usr.bin/make
196 usr.bin/yacc
197 usr.bin/lex
198 usr.bin/xlint
199 usr.sbin/config
200
201 Other problems and possibly solutions:
202 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
203 Symptom:Unreasonable compiler errors.
204 Fix: Rebuild gnu/usr.bin/egcs
205
206 Symptom:Complaints involving a Makefile.
207 Fix: Rebuild usr.bin/make:
208 cd usr.bin/make && make && make install
209 Or, a failsafe method if that doesn't work:
210 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
211
212 Fix: Make sure .mk files are up to date.
213 cd share/mk && make install
214
215 Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
216 Fix: Rebuild usr.sbin/config
217
218 Symptom:
219 Fix: Rebuild usr.bin/yacc
220
221 Symptom:
222 Fix: Rebuild usr.bin/lex
223
224 Symptom:
225 Fix: rm /usr/lib/libbfd.a
226
227 Symptom:Obsolete intermediate files are used during compilation
228 Fix: Try the following sequence of commands in the directory in question.
229 make cleandir; rm `make print-objdir`; make cleandir; make obj
230 (If you built the tree without "make obj" in the past, obsolete files
231 may remain. The command tries to clean everything up)
232
233 Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
234 Fix: Rebuild and install usr.bin/menuc
235
236 Symptom:mklocale not found during build in share/locale/ctype
237 Fix: Build and install usr.bin/mklocale
238
239 Symptom:undefined reference to `__assert13'
240 Fix: Rebuild and install lib/libc
241
242 Symptom:usr.sbin/config fails to build.
243 Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
244
245 Symptom:undefined reference to `getprogname' or `setprogname'
246 Fix: Rebuild and install lib/libc
247
248 Symptom:lint does not understand the '-X' option
249 Fix: May need to build & install libs with NOLINT=1 before rebuilding lint
250