Home | History | Annotate | Line # | Download | only in src
UPDATING revision 1.65
      1 $NetBSD: UPDATING,v 1.65 2002/08/24 13:25:01 lukem 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 20020822:
     12 	Crunched rescue tools (contents of /bin and /sbin, plus others)
     13 	are now provided in /rescue.
     14 
     15 	To ensure that these are built statically linked (no matter
     16 	what the setting of LDSTATIC is), use a crunchgen(1) built
     17 	from sources newer than 20020820 (see the next entry).
     18 
     19 20020820:
     20 	crunchgen(1) changed to ensure that the generated program
     21 	is statically linked.
     22 
     23 	Solution: update and reinstall usr.bin/crunch
     24 
     25 20020515:
     26 	sshd user/group has been added.  Need to hand add this in, or sshd
     27 	will not let you log in (with default, or UsePrivlegeSeparation=yes)
     28 
     29 	Add the following into /etc/group:
     30 
     31 	sshd:*:16:
     32 
     33 	and the following to /etc/master.passwd (via vipw):
     34 
     35 	sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin
     36 	
     37 	also /var/chroot/sshd directory needs to be present (digged as a part of
     38 	build process).
     39 
     40 20020426:
     41 	NBUILDJOBS obsoleted in favor of just using -j.
     42 
     43 20020426:
     44 	etc/postinstall added, which performs various checks for 
     45 	configuration file updates and changes, and can fix most of
     46 	the problems identified.
     47 	This should make it much easier to upgrade a system's
     48 	configuration from earlier systems (as far back as NetBSD 1.5).
     49 
     50 20020320:
     51 	<bsd.lib.mk> needs a new install(1) for it's "-a cmd" support.
     52 	build and install at usr.bin/xinstall before the build.
     53 
     54 20020319:
     55 	raw IPv6 socket now makes strict checking for sa_family and sa_len
     56 	on send(2) operation.  be sure to have sbin/rtsol and usr.sbin/rtsold
     57 	newer than November 2001 when you upgrade the kernel.
     58 
     59 20020311:
     60 	ssh configuration files were moved from /etc to /etc/ssh.  Beware
     61 	if you restart your machine from remote.  Note that sshd.conf needs
     62 	to be changed (due to the use of "/etc" inside).
     63 
     64 20020223:
     65 	Users of the VAX port will need to rebuild and install gas
     66 	so it deal with the now present register prefix used in all
     67 	the VAX assembly files.
     68 
     69 20020118:
     70 
     71 	ntpd user/group has been added.  Need to hand add this in or builds
     72 	will break as mtree aborts early.
     73 
     74 	Add the following into /etc/group:
     75 
     76 	ntpd:*:15:
     77 
     78 	and the following to /etc/master.passwd (via vipw):
     79 
     80 	ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin
     81 
     82 20011207:
     83 
     84 	If you're attempting to build a snapshot on sparc64 and are getting
     85 	reloc errors from the toolchain groff binary this means your native
     86 	toolchain has some broken C++ bits.
     87 
     88 	To fix:
     89 
     90 	Build a new toolchain (i.e. build.sh -t)
     91 	Use the new toolchain to build and install natively (i.e. /usr/lib)
     92 
     93 	gnu/lib/libgcc
     94 	gnu/lib/libstdc++
     95 
     96 	After this a snapshot will be able to be built.
     97 
     98 20011201:
     99 	In order for a sparc64 build to work you must have a working awk. If
    100 	you've built and installed a system with the new toolchain up to this
    101 	point you do not have a working awk as its ability to do floating
    102 	point is broken. 
    103 
    104 	To build:
    105 
    106 	remake and install gnu/lib/libgcc
    107 	remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links
    108 	against the new libgcc.a)
    109 
    110 20011128:
    111 	Kernel config information was changed to use defflag in
    112 	the various "files" files.  Bug fixes to config(8) are
    113 	required in order for this to work properly.  Make sure
    114 	to build and install in usr.sbin/config before attempting
    115 	to build a new kernel.
    116 
    117 20011030:
    118 	libc/locale/wcstod.c now needs new lint(1). Update lint(1)
    119 	before building libc.
    120 
    121 20011029:
    122 	The new document BUILDING.mdoc (view with nroff | more, or
    123 	see pre-generated .txt and .html versions) describes the build
    124 	procedure in great detail.  BUILDING, and the USE_NEW_TOOLCHAIN
    125 	build process, are intended in the long run to replace this
    126 	manual update log.
    127 
    128 	Users building a USE_NEW_TOOLCHAIN system should read the
    129 	BUILDING document for caveats.  Generally, BUILDING supersedes
    130 	UPDATING for these systems, as tool updating is taken care of
    131 	by the new build system.
    132 
    133 20011028:
    134 	src/etc/Makefile now needs install to be able to handle
    135 	symlinks that point to nowhere. A bug in install that
    136 	prevented this was corrected.
    137 
    138 	Solution: update and reinstall usr.bin/xinstall
    139 	Better Solution: Use the new toolchain and it will just work
    140 	for you.
    141 
    142 20011006:
    143 	/etc/mtree/NetBSD.dist has been updated to take advantage of
    144 	absolute path support added to mtree(8). Older mtree(8)s don't
    145 	understand the format.
    146 
    147 	Solution: update and reinstall usr.sbin/mtree
    148 
    149 20011004:
    150 	Crunchgen has been updated to work via reach-over makefiles. Updating
    151 	is suggested before running a snapshot build
    152 
    153 20010915:
    154 	The new "ubcperf" code committed by Chuck Silvers removed
    155 	a header file, uvm/uvm_vnode.h.  There may be stale .depend
    156 	files that still reference this file.
    157 
    158 	Solution: "make cleandir && make dependall" in affected
    159 	directories.
    160 
    161 20010803:
    162 	grep.info is now built from grep.texi using makeinfo.  Since it
    163 	requires makeinfo v4.0, you need to install new texinfo before
    164 	building gnu/usr.bin/grep.  To install new texinfo, please follow
    165 	the instruction described in 20010726 entry.
    166 
    167 20010803: 
    168 	(i386 only): i386 kernel now uses new instructions like
    169         `fxsave' which old gas doesn't understand.  To build the
    170 	kernel successfully, you need to build and install a new toolchain, 
    171 	(i.e., build.sh -t) or 	(temporarily) comment out "options I686_CPU" 
    172 	from your kernel configuration until you rebuild your userland.
    173 	See 20011029 above and BUILDING file in this directory for more information.
    174 	[updated 20020630 since i386 gas moved when USE_NEW_TOOLCHAIN enabled]
    175 
    176 20010731:
    177 	Bootloader update on ELF platforms.  DDB in kernels from before
    178 	this will be unable to read symbol tables provided by newer
    179 	bootloaders.
    180 
    181 20010726:
    182 	Texinfo was updated to 4.0.  To avoid failures when trying to
    183 	build the included texinfo files, do:
    184 
    185 	cd src/gnu/usr.bin/texinfo
    186 	make MKINFO=no dependall install
    187 
    188 20010718:
    189 	Enabled correct .init/.fini processing in crt0.  The way this
    190 	was done was to change a -I directive to cc(1), which means
    191 	make(1) will have a stale dependency (it will be checking the
    192 	timestamp on the wrong "dot_init.h").
    193 
    194 	The symptom you will see is that new programs die with SIGSEGV
    195 	if you have a stale dependency.
    196 
    197 	Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
    198 	before starting your build.
    199 
    200 20010628:
    201 	A construct was added to uvm_page.h that uncovered a bug
    202 	in lint(1).  If you get a warning/error about a non-portable
    203 	bitfield, update your lint(1) before proceeding.
    204 
    205 20010226:
    206 	Added named user/group to system. Need to hand add this in or builds
    207 	will break as mtree aborts early.
    208 
    209 	To work around add by hand:
    210 
    211 	named:*:14:
    212 
    213 	to /etc/group and add:
    214 
    215 	named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
    216 
    217 	to master.passwd (use vipw for instance if doing by hand).
    218 
    219 	Now a make build should progress.
    220 
    221 20010219:
    222 	get/setprogname() added. Any hostprogs that may use this will need
    223         to be bootstrapped manually until the host system is current.
    224 
    225         Known problems: sys/arch/macppc/stand/fixcoff
    226 			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
    227 			  CFLAGS and rebuilding should work)
    228 			usr.sbin/mdsetimage - Build a static copy if
    229   		          building a snapshot before fully bootstrapped.
    230 
    231 20010204:
    232 	prepare the code to compile with stricter gcc flags. in
    233 	particular start eliminating redundant declarations. Yacc
    234 	needs to be installed before make build.
    235 
    236 20010114:
    237 	introduce .if commands(target) in make(1). You need to
    238 	bring everything up-to-date first, then without installing
    239 	anything make and install in usr.bin/make, then proceed
    240 	with make build.
    241 
    242 20010101:
    243 	bsd.subdir.mk committed 20001230 had a bug which caused
    244 	afterinstall targets to run too soon; update again.
    245 
    246 20001230:
    247 	New share/mk files needed to support .WAIT in SUBDIR variables.
    248 	If you get make errors, 
    249 		(cd share/mk; make install)
    250 	Also, PRINTOBJDIR has changed and is now used more heavily.
    251 
    252 20001019:
    253 	The `ca' device driver has been replaced by `ld'; although the
    254 	major and minor numbers haven't changed, you should update your /dev
    255 	directory.
    256 
    257 20000929:
    258 	The following make directives are obsoleted.
    259 	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
    260 	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
    261 	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
    262 	additional library libcrypto_{idea,rc5}.
    263 
    264 
    265 Hints for a more successful build:
    266 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    267     Build a new kernel first:
    268 	This makes sure that any new system calls or features
    269 	   expected by the new userland will be present.  This
    270 	   helps to avoid critical errors when upgrading.
    271     Use object directories:
    272 	This helps to keep stale object
    273 	   files from polluting the build if a Makefile "forgets"
    274 	   about one.  It also makes it easier to clean up after
    275 	   a build.  It's also necessary if you want to use the
    276 	   same source tree for multiple machines.
    277 	   To use object directories:
    278 	    a) cd /usr/src ; make cleandir
    279 	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
    280 	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
    281 	    d) cd /usr/src ; make build
    282 	   Note that running "make obj" in a directory will create
    283 	   in obj.$MACHINE directory.
    284     Build to a DESTDIR:
    285 	This helps to keep old
    286 	   installed files (especially libraries) from interfering
    287 	   with the new build.
    288 	   To build to a DESTDIR, set the DESTDIR environment
    289 	   variable before running make build.  It should be set to
    290 	   the pathname of an initially empty directory.
    291 	   Problems: you might need to update critical utilities
    292 		without using DESTDIR since nothing is executed
    293 		from what is installed in DESTDIR.
    294 		(See critical utils, below)
    295     Build often:
    296 	This keeps critical utilities current enough to not choke
    297 	on any other part of the source tree that depends on up to
    298 	date functionality.
    299  
    300 What to do if things don't work:
    301 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    302 When things don't work there is usually a few things that commonly
    303 should be done.
    304     1)	make includes
    305 	This should be done automatically by make build.
    306     2)  cd share/mk && make install
    307 	Again, automatically done by make build.
    308 
    309 Failsafe rebuild of a small part of the tree:
    310 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    311 To make sure you rebuild something correctly you want to do
    312 something like the following:
    313     1)  Make sure the includes and .mk files are up to date.
    314     2)  Make sure any program used to build the particular
    315 	utility is up to date.  (yacc, lex, etc...)
    316     3)  cd ...path/to/util...
    317 	make cleandir
    318 	rm ...all obj directories...
    319 	make cleandir			# yes, again
    320 	make obj
    321 	make depend && make
    322 
    323 Failsafe rebuild of the entire tree:
    324 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    325 If you really want to make sure the source tree is clean and
    326 ready for a build try the following.  Note that sourcing /etc/mk.conf
    327 (a make(1) Makefile) in this manner is not right, and will not work
    328 for anyone who uses any make(1) features in /etc/mk.conf.
    329 
    330 ---cut here---
    331 #!/bin/sh
    332 . /etc/mk.conf
    333 
    334 if [ -z $NETBSDSRCDIR ] ; then
    335     NETBSDSRCDIR=/usr/src
    336 fi
    337 if [ \! -d $NETBSDSRCDIR ] ; then
    338     echo Unable to find sources
    339     exit 1
    340 fi
    341 find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
    342 
    343 if [ -z $BSDOBJDIR ] ; then
    344     BSDOBJDIR=/usr/obj
    345 fi
    346 if [ -d $BSDOBJDIR ] ; then
    347     rm -rf $BSDOBJDIR
    348 fi
    349 
    350 cd $NETBSDSRCDIR && make cleandir
    351 
    352 ---cut here---
    353 
    354 Critical utilities:
    355 ^^^^^^^^^^^^^^^^^^^
    356 	gnu/usr.bin/egcs
    357 	usr.bin/compile_et
    358 	usr.bin/make
    359 	usr.bin/yacc
    360 	usr.bin/lex
    361 	usr.bin/xlint
    362 	usr.sbin/config
    363 
    364 Other problems and possible solutions:
    365 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    366 Symptom:Unreasonable compiler errors.
    367 Fix:	Rebuild gnu/usr.bin/egcs
    368 
    369 Symptom:Complaints involving a Makefile.
    370 Fix:	Rebuild usr.bin/make:
    371 	cd usr.bin/make && make && make install
    372         Or, a failsafe method if that doesn't work:
    373 	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
    374 
    375 Fix:	Make sure .mk files are up to date.
    376 	cd share/mk && make install
    377 
    378 Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
    379 Fix:	Rebuild usr.sbin/config
    380 
    381 Symptom:
    382 Fix:	Rebuild usr.bin/yacc
    383 
    384 Symptom:
    385 Fix:	Rebuild usr.bin/lex
    386 
    387 Symptom:
    388 Fix:	rm /usr/lib/libbfd.a
    389 
    390 Symptom:Obsolete intermediate files are used during compilation
    391 Fix:	Try the following sequence of commands in the directory in question.
    392 	make cleandir; rm `make print-objdir`; make cleandir; make obj
    393 	(If you built the tree without "make obj" in the past, obsolete files
    394 	may remain.  The command tries to clean everything up)
    395 
    396 Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
    397 Fix:	Rebuild and install usr.bin/menuc
    398 
    399 Symptom:mklocale not found during build in share/locale/ctype
    400 Fix:	Build and install usr.bin/mklocale
    401 
    402 Symptom:undefined reference to `__assert13'
    403 Fix:    Rebuild and install lib/libc
    404 
    405 Symptom:usr.sbin/config fails to build.
    406 Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
    407 
    408 Symptom:undefined reference to `getprogname' or `setprogname'
    409 Fix:    Rebuild and install lib/libc
    410 
    411 Symptom:lint does not understand the '-X' option
    412 Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
    413