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