UPDATING revision 1.231 1 $NetBSD: UPDATING,v 1.231 2011/11/26 01:20:25 tls Exp $
2
3 This file (UPDATING) is intended to be a brief reference to recent
4 changes that might cause problems in the build process, and a guide for
5 what to do if something doesn't work.
6
7 For a more detailed description of the recommended way to build NetBSD
8 using build.sh, see the BUILDING file.
9
10 Note that much of the advice in this UPDATING file was written before
11 build.sh existed. Nevertheless, the advice here may be useful for
12 working around specific problems with build.sh.
13
14 See also: BUILDING, build.sh, Makefile.
15
16 Recent changes:
17 ^^^^^^^^^^^^^^^
18
19 20111125:
20 The "rnd" pseudodevice has been added to sys/conf/std, which
21 means it should no longer be explicitly listed in kernel
22 configuration files. The line "pseudo-device rnd" should be
23 removed from any custom kernel config files users may have.
24
25 20111119:
26 A problem with the datastructures used by the rndctl(8)
27 utility (pointers in datastructures in an array, making 32->64
28 bit compatibility very painful) has been fixed in a
29 non-backwards-compatible way. If you replace your kernel,
30 replace your rndctl executable too.
31
32 20111001:
33 the prop_*_send_syscall() functions from proplib(3) have been
34 changed and their new version is not backward compatible with the old
35 one. So ensure that all consumers of these functions (currently:
36 quota2 code and its tests) are updated together with the new lib.
37
38 20110817:
39 sparc has been changed to use GCC 4.5.3, so any objdir or
40 DESTDIR for them should be deleted before updating.
41
42 20110806:
43 i386 and amd64 have been changed to use GCC 4.5.3, so any
44 objdir or DESTDIR for them should be deleted before updating.
45
46 20110805:
47 The update to GCC 4.5.3 requires a non-trivial portion of
48 the tree to be cleaned. Best to delete both objdir and
49 DESTDIR before running this update. So far, only the
50 sparc64, mips and powerpc platforms have changed.
51
52 20110803:
53 The layout of external/public-domain/xz has changed. To do an
54 update build you will have to remove the contents of the OBJDIR
55 for external/public-domain/xz/bin by hand as the xz entry there
56 is now a directory.
57
58 20110410:
59 The configuration of src/tools/gcc has changed. To do an
60 update build you have to clean both tools/binutils and
61 tools/gcc by hand.
62
63 20110328:
64 Building the Xorg binary was moved into a subdirectory to fix
65 ordering issues with "make all". It may be necessary to remove
66 the OBJDIR for external/mit/xorg/server/xorg-server/hw/xfree86
67 if your update build fails, as the "Xorg" entry there is now a
68 directory.
69
70 20110121:
71 Assembler files no longer use -traditional-cpp. This can break
72 the build of individual parts of the tree. This is handled
73 correctly by build.sh. Manual builds have to update /usr/share/mk
74 and re-run config(1) for any kernel configurations as needed.
75
76 20101217:
77 The tcpdump(8) program was changed to drop privileges and chroot(2)
78 by default. It may be necessary to manually update passwd(5) and
79 group(5) in order to make the program work with existing setups.
80
81 20101125:
82 The latest changes to setenv(3) dissallow setting environment
83 variables with names that contain '='. Revision 1.18 of env.c
84 assumed that this was allowed. Installing a new libc with an
85 old copy of /usr/bin/env causes env x=1 printenv | grep x= to
86 break which affects the autoconf tests for dependency finding,
87 so building gcc will end up printing:
88 checking dependency style of gcc... none
89 configure: error: no usable dependency style found
90 Fix it by rebuilding and re-installing env.
91
92 20101119:
93 Recent Xorg updates in xsrc/external/mit/ may cause various build
94 or run-time problems. Delete your entire DESTDIR and OBJDIR if you
95 have any build problems with xsrc, or problems with mismatched
96 versions between xorg-server and drivers.
97
98 20100604:
99 The update of ATF to 0.9 causes old tests written in shell to fail
100 unless they are rebuilt. If you are building with MKUPDATE=yes,
101 you need to clean the src/external/bsd/atf/tests/ and the src/tests/
102 trees by hand.
103
104 20100522:
105 Recent Xorg updates in xsrc/external/mit/ will cause various build
106 problems. Delete your entire DESTDIR and OBJDIR if you have any
107 build problems with xsrc.
108
109 20100522:
110 private section of <ctype.h> was splitted, and now mklocale(1)
111 include ctype_local.h, so you have to make cleandir in tools/mklocale.
112
113 20100520:
114 The location of the xkb compiled descriptions has changed. Please
115 remove usr/X11R7/lib/X11/xkb/compiled from your $DESTDIR.
116
117 20100222:
118 The shared objects file extension has been changed from .so to
119 .pico, in order to avoid conflicts with shared libraries names
120 libXX.so. All now stale regular .so files can be removed from
121 your object directories.
122
123 20100204:
124 The termcap database has been removed from the sources,
125 but has not been marked obsolete so it is not removed
126 from the system when upgrading.
127 As such, you will need to remove them from your object
128 and destination directories.
129
130 20091101:
131 After updating, it may be necessary to make the 'cleandir'
132 target in src/tools/yacc/ and in src/usr.bin/yacc/ before a
133 'build.sh -u tools' or 'build.sh -u distribution'. Ditto
134 src/tools/lex/ and src/usr.bin/lex/.
135
136 20091001:
137 On amd64 you must rebuild tools (to get the new binutils)
138 before building a kernel, or the build fails on cpufunc.S.
139
140 20091001:
141 An error will create a ./usr/X11R7/lib/X11/xkb/compiled/xkb
142 symlink, failing the build. Delete the link, and the subdir
143 it is in, and retry your build.
144
145 20090718:
146 libc build changed so that strchr() provides the extra entry
147 point for index(). Update build of libc.a (and libc_pic.a)
148 may fail because the archive contains the unwanted index.o.
149 (Similarly for strrchr() and rindex().)
150
151 20090709:
152 Native Xorg was upgraded again. Builds will probably fail again
153 without a clean objdir, at least for src/external/mit/xorg.
154
155 20090616:
156 Native Xorg was upgraded. Builds will need a clean objdir for
157 src/external/mit/xorg. Upgrading a system from sets will not
158 work properly yet as the /usr/X11R7/lib/X11/xkb/symbols/pc
159 subdirectory has been changed into a file, and this needs to
160 be manually "rm -r"'ed before installing xbase.tgz.
161
162 20090501:
163 Several new functions were added to string.h/libc, and this
164 can cause autoconf problems during the tool build for people
165 who fail to clean out their tools objects properly. If you
166 note messages about stpcpy, stpncpy or strnlen accompanying a
167 failure during the tool build, clean out all your tools
168 objects and start again.
169
170 20090325:
171 The i386 port was switched to i486 default toolchain. This requires
172 cleaning your src/tools directory and $TOOLDIR and rebuilding them.
173
174 20090126:
175 The __posix_fadvise50 system call changed assembly stub type. You
176 need to 'rm -f __posix_fadvise50.*' in the libc build directory
177 to avoid using the old assembly stub.
178
179 20090202:
180 pkg_install now depends on the pkgdb cache for automatic conflict
181 detection. It is recommented to rebuild the cache with
182 ``pkg_admin rebuild''.
183
184 20090110:
185 time_t and dev_t have been bumped to 64 bit quantities. To upgrade:
186 1. Make sure your kernel has COMPAT_50 in it. Build and install.
187 This is needed even in the MODULAR kernel because there is
188 conditionally compiled code in rtsock.c.
189 2. make sure build.sh completes and the binaries in a chroot work
190 before installing.
191 3. If you don't use build.sh and you build directly to root, and
192 your build breaks in the middle, don't despair. Make sure headers
193 are installed properly, and start building libraries first libc
194 and libutil, install them and then continue building all the
195 libraries in src/lib and src/gnu/lib and install them. Once
196 the new libraries are installed, you can restart the build.
197 4. If you compile packages and you notice link time warnings,
198 rebuild the required packages to update their shared libraries.
199 Any package you rebuild will require rebuilding all the packages
200 that depend on it.
201 5. Next time you run pwd_mkdb with the new binary, the file
202 will be upgraded and it will not be backwards compatible.
203 6. The utmpx/wtmpx files (/var/run/utmpx and /var/log/wtmpx, see
204 lastlogx(5)) have been versioned, and there is a heuristic
205 for utmp. You are better off removing the old files after
206 upgrading. The automated clearing of /var/run during
207 boot, and the automated rotating of files in /var/log by
208 newsyslog(8), may mean that you do not have to remove the
209 files manually.
210 7. The optional accounting file (/var/account/acct, see
211 accton(8)) has not been versioned, and will need to be
212 removed. The automatic rotation of the accounting file by
213 /etc/daily limits the bad consequences of failure to remove
214 the file.
215 8. Application software that writes time_t to binary files on
216 disk will break or need attention. Most notably: if you are
217 using PostgreSQL < 8.4, you need to dump your databases,
218 rebuild PostgreSQL with the new time_t, then restore.
219
220 20081219:
221 config(1) has been updated, and one of the files it creates -
222 swapnetbsd.o - has changed format. You need to rebuild config
223 (done automatically by build.sh) and then you need to rerun
224 config on all kernel configuration files before rebuilding those
225 kernels.
226
227 20081205:
228 If you build with MKX11=no, you should remove /etc/rc.d/xdm and
229 /etc/rc.d/xfs from DESTDIR because those files were moved to the xetc
230 set and will appear as extra files for MKX11=no update builds.
231
232 20081122:
233 On i386, various kernel options(4) in GENERIC including
234 file systems have been disabled and moved into kernel modules.
235 Before trying a new GENERIC kernel, you have to prepare the
236 following files as well as a new GENERIC kernel:
237
238 - build and install kernel modules from src/sys/modules
239
240 - install the latest bootloader, which will load a module
241 for the file system from which the kernel is loaded automatically
242
243 If you have to load your kernel from a file system which is not of
244 the same type as the root file system, you have to load the necessary
245 file system module manually on the boot prompt or in the boot.cfg file.
246
247 20080827:
248 If you built and installed a libc from sources between
249 2008/08/20 and 2008/08/26 you got a broken strtouq(3)
250 which results in false errors reported by lint(1).
251 Since this breaks the libc build itself, manual help is
252 needed -- lint must be disabled temporarily, e.g.:
253 $ (cd lib/libc && make MKLINT=no dependall install)
254
255 20080813:
256 MKDEBUG build was broken because the .depend files did not know
257 about .go files. You need to remove all .depend files and rebuild.
258
259 20080802:
260 A regression in binary compatibility for pthread_mutex_t has
261 been fixed. Unfortunately, the price is breaking compatibility
262 for -current.
263
264 Threaded programs (using libpthread) and C++ programs (using
265 libstdc++) compiled after 20070907 and before 20080802 need to
266 be recompiled.
267
268 One way to find affected pkgsrc packages:
269
270 $ grep REQUIRES=/usr/lib/libpthread /var/db/pkg/*/+BUILD_INFO
271 $ grep REQUIRES=/usr/lib/libstdc++ /var/db/pkg/*/+BUILD_INFO
272
273 20080731:
274 WAPBL (metadata journaling support) has been added, but at this
275 time isn't backwards compatible with pre-WAPBL aware kernels
276 and userland (fsck_ffs in particular). Please make sure you
277 don't use a journaled filesystem with an older kernel/userland,
278 especially an uncleanly mounted journaled filesystem. WAPBL
279 also requires the super block to be in the UFS2 format. You
280 can use fsck_ffs -c 4 to update the superblock format.
281
282 20080721:
283 Assembler warnings are now fatal if $WARNS>0 and $NOGCCERROR
284 isn't defined.
285
286 20080531:
287 The ioctl number of DRVSUSPENDDEV command on /dev/drvctl changed
288 from 125 (conflicted with DRVCTLCOMMAND) to 129. The drvctl(8)
289 utility needs to be rebuilt and reinstalled as older binaries
290 won't work correctly. The following sequence of commands:
291
292 $ (cd sys/sys/ && nbmake-$arch includes)
293 $ (cd sbin/drvctl/ && nbmake-$arch clean)
294 $ (cd sbin/drvctl/ && nbmake-$arch all)
295
296 leaves new drvctl utility in sbin/drvctl build directory.
297
298 20080503:
299 The <bsd.lib.mk> variable MKPRIVATELIB was renamed to LIBISPRIVATE.
300
301 20080521:
302 For a while, unprivileged UPDATE builds would fail to
303 succeed at the checkflist stage, complaining that
304 ${DESTDIR}/stand/<arch>/ did not exist. A fix for this
305 problem was committed to share/mk/bsd.kmodule.mk, revision 1.9.
306 If you already hit this problem, update the .mk file,
307 remove ${DESTDIR}/stand/<arch>, and re-run the build.
308
309 20080303:
310 Linker warnings are now fatal if $WARNS>0.
311
312 20080126:
313 The posix_fadvise system call has been changed from an assembly
314 stub, to a c file that calls an assembly stub. You need to
315 'rm -f posix_fadvise.* .depend' in the libc build directory to
316 avoid using the old assembly stub.
317
318 20071209:
319 The acpiec(4) driver has been split into two attachments. If you
320 get ACPI errors before the attachment, please update your kernel
321 configuration file appropriately or see GENERIC for more details.
322
323 20071115:
324 The it(4) driver has been renamed to itesio(4) and the old port
325 argument specified in the kernel configuration file is not valid
326 anymore. The itesio(4) driver now uses the Super I/O address port
327 rather than the EC address port. Please update your kernel
328 configuration file appropriately or see GENERIC for more details.
329
330 20071028:
331 The pccons(4) driver has been removed from the NetBSD/shark port.
332 You need to update any custom kernel configuration file you have
333 to remove any references to pccons (which includes removing the
334 now useless XSERVER option) and replace them with the correct
335 entries for the wscons driver. See the GENERIC configuration file
336 for more details.
337
338 20070913:
339 A latent bug in dhclient/dhcpd that caused it to be unable to
340 enumerate interfaces was fixed. The bug began to cause
341 problems after 20070911 when the kernel's SIOCGIFCONF
342 implementation was repaired. From 20070529 to 20070911 racoon
343 could not enumerate interfaces. (These are noted because
344 normal kernel/userspace version matching hygiene is not
345 sufficient to avoid this problem.) Ensure that both kernel
346 and userland are from after 20070913.
347
348 20070703:
349 nbinstall has been renamed ${MACHINE_GNU_ARCH}-install. It
350 calls the target-specific strip program, and the logic to pass
351 down STRIP from make has been removed. This requires a
352 re-installation of tools.
353
354 20070422:
355 The way OS emulations lookup filenames inside the emulation root
356 has been changed. Rather than modify the pathname (and copy back
357 to userspace) namei() and lookup() directly check the emulation
358 root. One side effect is that absolute symlinks inside the emulated
359 root file system will be relative to that file system - unless they
360 start /../ this is useful when the emulated root is a real install
361 that has such links.
362 This might affect symlinks that have been added to reference outside
363 the emulated root.
364
365 20070412:
366 The pckbc driver on sgimips IP32 has been removed. Use macekbc
367 instead. See the GENERIC32_IP3x kernel configuration for an
368 example.
369
370 20070319:
371 src/lib/libc/Makefile revision 1.129 broke libc and ld.elf_so
372 on many platforms due to incorrect flags settings. If you
373 updated and built after about 20070315, do "nbmake-$arch
374 cleandir" in src/lib/libc and src/libexec/ld.elf_so to force a
375 rebuild of object files that might have been built
376 incorrectly, and ensure that you have at least
377 src/lib/libc/Makefile 1.130.
378
379 20070210:
380 src/sys/sys/{sa.h,savar.h} were removed.
381 find ${OBJDIR} \( -name .depend -o -name '*.d' \) -print \
382 | xargs egrep -l '/sa.h|/savar.h' | xargs rm
383 will allow dependencies on those files to get get rebuilt
384
385 20070209:
386 The threading model was changed when the newlock2 branch
387 was merged to NetBSD-current. If you boot with a new
388 kernel (version 4.99.10), then you also need a new pthread
389 library (/usr/lib/libpthread.so.0.7). If you boot with
390 an old kernel, then you need the old pthread library
391 (/usr/lib/libpthread.so.0.6). Provided you keep the kernel and
392 the pthread library in sync, old threaded applications should
393 continue to work with an old or new kernel. Note that named(8)
394 is the only threaded application in the base system.
395
396 20061214:
397 Following the move of string_to_flags() and flags_to_string()
398 from the bin/ls/ sources to libutil, users doing UPDATE builds
399 will need to do a "make cleandir" in
400 tools/mtree/, tools/makefs/, tools/binstall/, tools/pax/,
401 bin/pax/, bin/ls/, usr.sbin/mtree/, usr.sbin/makefs/,
402 usr.bin/xinstall/, libexec/ftpd/, rescue/, as well
403 as the installation images in distrib/
404 in order to excise stale references to the old stat_flags.h header
405 file in the ls sources -- stat_flags.h has been removed.
406
407 20061108:
408 The configure script used in the src/tools/gcc compiler has been
409 changed to indicate that our libc has ssp support built-in and
410 does not depend on -lssp and -lssp-nonshared. You'll need to
411 make clean in src/tools/gcc first to rebuild the compiler.
412
413 20061009:
414 The sysctl variables net.inet{,6}.tcp{,6}.newreno are no longer
415 available. Use net.inet{,6}.tcp{,6}.congctl.selected instead.
416
417 20060814:
418 The vt, vidcconsole, kbd, and rpckbd drivers on acorn32 have been
419 withdrawn. Use vidcvideo and pckbd instead. See the GENERIC
420 kernel configuration for an example. X servers from the last
421 few years should cope.
422
423 20060703:
424 MPACPI is no more. We always configure PCI interrupts using ACPI
425 if we have an ACPI kernel. The option MPACPI_SCANPCI has been renamed
426 to ACPI_SCANPCI. Thanks to work from fvdl.
427
428 20060627:
429 socket(2) has changed, and its system call has been versioned.
430 For userlands with the old version of socket(2), make sure that
431 your kernel has 'options COMPAT_30' set, or else 'bad system call'
432 errors will result.
433
434 Hints for a more successful build:
435 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
436 Use build.sh, but do not use its "expert mode":
437 This will automatically build the tools in the
438 correct order, and it will keep the tools and the
439 new build products from interfering with the running
440 system. This will allow you to ignore most of the
441 other advice in this file.
442 Build a new kernel first:
443 This makes sure that any new system calls or features
444 expected by the new userland will be present. This
445 helps to avoid critical errors when upgrading.
446 Use object directories:
447 This helps to keep stale object
448 files from polluting the build if a Makefile "forgets"
449 about one. It also makes it easier to clean up after
450 a build. It's also necessary if you want to use the
451 same source tree for multiple machines.
452 To use object directories with build.sh:
453 a) invoke build.sh with the "-M" or "-O" options.
454 To use object directories without using build.sh:
455 a) cd /usr/src ; make cleandir
456 b) Add "OBJMACHINE=yes" to /etc/mk.conf
457 c) Add "MKOBJDIRS=yes" to /etc/mk.conf
458 d) cd /usr/src ; make build
459 Note that running "make obj" in a directory will create
460 in obj.$MACHINE directory.
461 Build to a DESTDIR:
462 This helps to keep old installed files (especially libraries)
463 from interfering with the new build.
464 To build to a DESTDIR with build.sh, use the "-D" option.
465 To build to a DESTDIR without using build.sh, set the DESTDIR
466 environment variable before running make build. It should be
467 set to the pathname of an initially empty directory.
468 Problems: if you do not use build.sh, you might need to
469 update critical utilities without using DESTDIR since
470 nothing is executed from what is installed in DESTDIR.
471 (See critical utils, below.)
472 Build often:
473 This keeps critical utilities current enough to not choke
474 on any other part of the source tree that depends on up to
475 date functionality. If you use build.sh, you should not have
476 this problem.
477
478 What to do if things don't work:
479 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
480 When things don't work there are usually a few things that commonly
481 should be done.
482 1) make includes
483 This should be done automatically by make build.
484 2) cd share/mk && make install
485 Again, automatically done by make build.
486
487 Failsafe rebuild of a small part of the tree:
488 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
489 To make sure you rebuild something correctly you want to do
490 something like the following:
491 1) Make sure the includes and .mk files are up to date.
492 2) Make sure any program used to build the particular
493 utility is up to date. (yacc, lex, etc...)
494 3) cd ...path/to/util...
495 make cleandir
496 rm ...all obj directories...
497 make cleandir # yes, again
498 make obj
499 make depend && make
500
501 Failsafe rebuild of the entire tree:
502 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
503 If you really want to make sure the source tree is clean and
504 ready for a build try the following. Note that sourcing /etc/mk.conf
505 (a make(1) Makefile) in this manner is not right, and will not work
506 for anyone who uses any make(1) features in /etc/mk.conf.
507
508 ---cut here---
509 #!/bin/sh
510 . /etc/mk.conf
511
512 if [ -z $NETBSDSRCDIR ] ; then
513 NETBSDSRCDIR=/usr/src
514 fi
515 if [ \! -d $NETBSDSRCDIR ] ; then
516 echo Unable to find sources
517 exit 1
518 fi
519 find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
520
521 if [ -z $BSDOBJDIR ] ; then
522 BSDOBJDIR=/usr/obj
523 fi
524 if [ -d $BSDOBJDIR ] ; then
525 rm -rf $BSDOBJDIR
526 fi
527
528 cd $NETBSDSRCDIR && make cleandir
529
530 ---cut here---
531
532 Critical utilities:
533 ^^^^^^^^^^^^^^^^^^^
534 usr.bin/compile_et
535 usr.bin/make
536 usr.bin/yacc
537 usr.bin/lex
538 usr.bin/xlint
539 usr.bin/config
540
541 Other problems and possible solutions:
542 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
543 Symptom:Complaints involving a Makefile.
544 Fix: Rebuild usr.bin/make:
545 cd usr.bin/make && make && make install
546 Or, a failsafe method if that doesn't work:
547 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
548
549 Fix: Make sure .mk files are up to date.
550 cd share/mk && make install
551
552 Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
553 Fix: Rebuild usr.bin/config
554
555 Symptom:
556 Fix: Rebuild usr.bin/yacc
557
558 Symptom:
559 Fix: Rebuild usr.bin/lex
560
561 Symptom:
562 Fix: rm /usr/lib/libbfd.a
563
564 Symptom:Obsolete intermediate files are used during compilation
565 Fix: Try the following sequence of commands in the directory in question.
566 make cleandir; rm `make print-objdir`; make cleandir; make obj
567 (If you built the tree without "make obj" in the past, obsolete files
568 may remain. The command tries to clean everything up)
569
570 Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible
571 pointer type
572 Fix: Rebuild and install usr.bin/menuc
573
574 Symptom:mklocale not found during build in share/locale/ctype
575 Fix: Build and install usr.bin/mklocale
576
577 Symptom:undefined reference to `__assert13' or `__unsetenv13'
578 Fix: Rebuild and install lib/libc
579
580 Symptom:usr.bin/config fails to build.
581 Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
582
583 Symptom:undefined reference to `getprogname' or `setprogname'
584 Fix: Rebuild and install lib/libc
585
586 Symptom:lint does not understand the '-X' option
587 Fix: May need to build & install libs with NOLINT=1 before rebuilding lint
588
589 Symptom:Update build fails in src/tools/gcc complaining that a variable
590 (e.g. CPPFLAGS) has changed since the previous run.
591 Fix: Run "nbmake-${ARCH} clean" in src/tools/gcc or do a clean build.
592