UPDATING revision 1.20
11.20Sjmc$NetBSD: UPDATING,v 1.20 2001/02/24 20:23:10 jmc Exp $ 21.1Sabs 31.1SabsThis file is intended to be a brief introduction to the build 41.1Sabsprocess and a reference on what to do if something doesn't work. 51.1Sabs 61.1SabsFor a more detailed description see Makefile. 71.1Sabs 81.1SabsRecent changes: 91.1Sabs^^^^^^^^^^^^^^^ 101.18Sjmc 111.18Sjmc20010219: 121.18Sjmc get/setprogname() added. Any hostprog's that may use this will need 131.20Sjmc to be bootstrapped manually until the host system is current. 141.18Sjmc 151.18Sjmc Known problems: sys/arch/macppc/stand/fixcoff 161.19Scgd usr.sbin/config (adding -DMAKE_BOOTSTRAP to 171.19Scgd CFLAGS and rebuilding should work) 181.20Sjmc usr.sbin/mdsetimage - Build a static copy if 191.20Sjmc building a snapshot before fully bootstrapped. 201.15Schristos 211.15Schristos20010204: 221.15Schristos prepare the code to compile with stricter gcc flags. in 231.15Schristos particular start eliminating redundant declarations. Yacc 241.15Schristos needs to be installed before make build. 251.10Schristos 261.10Schristos20010114: 271.10Schristos introduce .if commands(target) in make(1). You need to 281.10Schristos bring everything up-to-date first, then without installing 291.10Schristos anything make and install in /usr/bin/make, then proceed 301.10Schristos with make build. 311.9Ssommerfe 321.9Ssommerfe20010101: 331.9Ssommerfe bsd.subdir.mk committed 20001230 had a bug which caused 341.9Ssommerfe afterinstall targets to run too soon; update again. 351.8Ssommerfe 361.8Ssommerfe20001230: 371.8Ssommerfe New share/mk files needed to support .WAIT in SUBDIR variables. 381.8Ssommerfe If you get make errors, 391.8Ssommerfe (cd share/mk; make install) 401.8Ssommerfe Also, PRINTOBJDIR has changed and is now used more heavily. 411.6Sad 421.6Sad20001019: 431.7Sad The `ca' device driver has been replaced by `ld'; although the 441.6Sad major and minor numbers haven't changed, you should update your /dev 451.6Sad directory. 461.1Sabs 471.4Sitojun20000929: 481.4Sitojun The following make directives are obsoleted. 491.4Sitojun MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 501.4Sitojun By default, RSA is built into libcrypto. IDEA and RC5 will not be 511.16Swiz built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 521.4Sitojun additional library libcrypto_{idea,rc5}. 531.4Sitojun 541.1Sabs20000623: 551.1Sabs MKCRYPTO and friends added to share/mk/bsd.own.mk. 561.1Sabs 'cd share/mk ; make install' needed before make build. 571.1Sabs 581.1Sabs 591.1SabsHints for a more successful build: 601.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 611.2Smrg Build a new kernel first: 621.2Smrg This makes sure that any new system calls or features 631.2Smrg expected by the new userland will be present. This 641.2Smrg helps to avoid critical errors when upgrading. 651.1Sabs Use object directories: 661.1Sabs This helps to keep stale object 671.1Sabs files from polluting the build if a Makefile "forgets" 681.1Sabs about one. It also makes it easier to clean up after 691.1Sabs a build. It's also necessary if you want to use the 701.1Sabs same source tree for multiple machines. 711.1Sabs To use object directories: 721.1Sabs a) cd /usr/src ; make cleandir 731.2Smrg b) Add "OBJMACHINE=yes" to /etc/mk.conf 741.2Smrg c) Add "MKOBJDIRS=yes" to /etc/mk.conf 751.1Sabs d) cd /usr/src ; make build 761.2Smrg Note that running "make obj" in a directory will create 771.2Smrg in obj.$MACHINE directory. 781.1Sabs Build to a DESTDIR: 791.1Sabs This helps to keep old 801.1Sabs installed files (especially libraries) from interfering 811.1Sabs with the new build. 821.1Sabs To build to a DESTDIR, set the DESTDIR environment 831.2Smrg variable before running make build. It should be set to 841.2Smrg the pathname of an initially empty directory. 851.1Sabs Problems: you might need to update critical utilities 861.1Sabs without using DESTDIR since nothing is executed 871.1Sabs from what is installed in DESTDIR. 881.1Sabs (See critical utils, below) 891.1Sabs Build often: 901.1Sabs This keeps critical utilities current enough to not choke 911.1Sabs on any other part of the source tree that depends on up to 921.1Sabs date functionality. 931.1Sabs 941.1SabsWhat to do if things don't work: 951.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 961.1SabsWhen things don't work there is usually a few things that commonly 971.1Sabsshould be done. 981.1Sabs 1) make includes 991.1Sabs This should be done automatically by make build. 1001.1Sabs 2) cd share/mk && make install 1011.1Sabs Again, automatically done by make build. 1021.1Sabs 1031.1SabsFailsafe rebuild of a small part of the tree: 1041.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1051.1SabsTo make sure you rebuild something correctly you want to do 1061.1Sabssomething like the following: 1071.1Sabs 1) Make sure the includes and .mk files are up to date. 1081.1Sabs 2) Make sure any program used to build the particular 1091.1Sabs utility is up to date. (yacc, lex, etc...) 1101.1Sabs 3) cd ...path/to/util... 1111.1Sabs make cleandir 1121.1Sabs rm ...all obj directories... 1131.1Sabs make cleandir # yes, again 1141.1Sabs make obj 1151.1Sabs make depend && make 1161.1Sabs 1171.1SabsFailsafe rebuild of the entire tree: 1181.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1191.1SabsIf you really want to make sure the source tree is clean and 1201.2Smrgready for a build try the following. Note that sourcing /etc/mk.conf 1211.2Smrg(a make(1) Makefile) in this manner is not right, and will not work 1221.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf. 1231.1Sabs 1241.1Sabs---cut here--- 1251.1Sabs#!/bin/sh 1261.1Sabs. /etc/mk.conf 1271.1Sabs 1281.1Sabsif [ -z $BSDSRCDIR ] ; then 1291.1Sabs BSDSRCDIR=/usr/src 1301.1Sabsfi 1311.1Sabsif [ \! -d $BSDSRCDIR ] ; then 1321.1Sabs echo Unable to find sources 1331.1Sabs exit 1 1341.1Sabsfi 1351.1Sabsfind $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 1361.1Sabs 1371.1Sabsif [ -z $BSDOBJDIR ] ; then 1381.1Sabs BSDOBJDIR=/usr/obj 1391.1Sabsfi 1401.1Sabsif [ -d $BSDOBJDIR ] ; then 1411.1Sabs rm -rf $BSDOBJDIR 1421.1Sabsfi 1431.1Sabs 1441.1Sabscd $BSDSRCDIR && make cleandir 1451.1Sabs 1461.1Sabs---cut here--- 1471.1Sabs 1481.1SabsCritical utilities: 1491.1Sabs^^^^^^^^^^^^^^^^^^^ 1501.1Sabs gnu/usr.bin/egcs 1511.3Sitojun usr.bin/compile_et 1521.1Sabs usr.bin/make 1531.1Sabs usr.bin/yacc 1541.1Sabs usr.bin/lex 1551.11Slukem usr.bin/xlint 1561.2Smrg usr.sbin/config 1571.1Sabs 1581.1SabsOther problems and possibly solutions: 1591.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1601.1SabsSymptom:Unreasonable compiler errors. 1611.1SabsFix: Rebuild gnu/usr.bin/egcs 1621.1Sabs 1631.1SabsSymptom:Complaints involving a Makefile. 1641.17SerhFix: Rebuild usr.bin/make: 1651.17Serh cd usr.bin/make && make && make install 1661.17Serh Or, a failsafe method if that doesn't work: 1671.17Serh cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 1681.17Serh 1691.1SabsFix: Make sure .mk files are up to date. 1701.1Sabs cd share/mk && make install 1711.2Smrg 1721.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC. 1731.2SmrgFix: Rebuild usr.sbin/config 1741.1Sabs 1751.1SabsSymptom: 1761.1SabsFix: Rebuild usr.bin/yacc 1771.1Sabs 1781.1SabsSymptom: 1791.1SabsFix: Rebuild usr.bin/lex 1801.1Sabs 1811.1SabsSymptom: 1821.1SabsFix: rm /usr/lib/libbfd.a 1831.4Sitojun 1841.4SitojunSymptom:Obsolete intermediate files are used during compilation 1851.4SitojunFix: Try the following sequence of commands in the directory in question. 1861.4Sitojun make cleandir; rm `make print-objdir`; make cleandir; make obj 1871.4Sitojun (If you built the tree without "make obj" in the past, obsolete files 1881.4Sitojun may remain. The command tries to clean everything up) 1891.5Swiz 1901.5SwizSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 1911.5SwizFix: Rebuild and install usr.bin/menuc 1921.12Sitojun 1931.12SitojunSymptom:mklocale not found during build in share/locale/ctype 1941.12SitojunFix: Build and install usr.bin/mklocale 1951.13Sdogcow 1961.13SdogcowSymptom:undefined reference to `__assert13' 1971.13SdogcowFix: Rebuild and install lib/libc 1981.13Sdogcow 1991.19ScgdSymptom:usr.sbin/config fails to build. 2001.19ScgdFix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 2011.13Sdogcow 2021.19ScgdSymptom:undefined reference to `getprogname' or `setprogname' 2031.19ScgdFix: Rebuild and install lib/libc 204