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