UPDATING revision 1.19
11.19Scgd$NetBSD: UPDATING,v 1.19 2001/02/24 01:05:04 cgd 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.18Sjmc to be bootstraped 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.15Schristos 191.15Schristos20010204: 201.15Schristos prepare the code to compile with stricter gcc flags. in 211.15Schristos particular start eliminating redundant declarations. Yacc 221.15Schristos needs to be installed before make build. 231.10Schristos 241.10Schristos20010114: 251.10Schristos introduce .if commands(target) in make(1). You need to 261.10Schristos bring everything up-to-date first, then without installing 271.10Schristos anything make and install in /usr/bin/make, then proceed 281.10Schristos with make build. 291.9Ssommerfe 301.9Ssommerfe20010101: 311.9Ssommerfe bsd.subdir.mk committed 20001230 had a bug which caused 321.9Ssommerfe afterinstall targets to run too soon; update again. 331.8Ssommerfe 341.8Ssommerfe20001230: 351.8Ssommerfe New share/mk files needed to support .WAIT in SUBDIR variables. 361.8Ssommerfe If you get make errors, 371.8Ssommerfe (cd share/mk; make install) 381.8Ssommerfe Also, PRINTOBJDIR has changed and is now used more heavily. 391.6Sad 401.6Sad20001019: 411.7Sad The `ca' device driver has been replaced by `ld'; although the 421.6Sad major and minor numbers haven't changed, you should update your /dev 431.6Sad directory. 441.1Sabs 451.4Sitojun20000929: 461.4Sitojun The following make directives are obsoleted. 471.4Sitojun MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 481.4Sitojun By default, RSA is built into libcrypto. IDEA and RC5 will not be 491.16Swiz built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 501.4Sitojun additional library libcrypto_{idea,rc5}. 511.4Sitojun 521.1Sabs20000623: 531.1Sabs MKCRYPTO and friends added to share/mk/bsd.own.mk. 541.1Sabs 'cd share/mk ; make install' needed before make build. 551.1Sabs 561.1Sabs 571.1SabsHints for a more successful build: 581.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 591.2Smrg Build a new kernel first: 601.2Smrg This makes sure that any new system calls or features 611.2Smrg expected by the new userland will be present. This 621.2Smrg helps to avoid critical errors when upgrading. 631.1Sabs Use object directories: 641.1Sabs This helps to keep stale object 651.1Sabs files from polluting the build if a Makefile "forgets" 661.1Sabs about one. It also makes it easier to clean up after 671.1Sabs a build. It's also necessary if you want to use the 681.1Sabs same source tree for multiple machines. 691.1Sabs To use object directories: 701.1Sabs a) cd /usr/src ; make cleandir 711.2Smrg b) Add "OBJMACHINE=yes" to /etc/mk.conf 721.2Smrg c) Add "MKOBJDIRS=yes" to /etc/mk.conf 731.1Sabs d) cd /usr/src ; make build 741.2Smrg Note that running "make obj" in a directory will create 751.2Smrg in obj.$MACHINE directory. 761.1Sabs Build to a DESTDIR: 771.1Sabs This helps to keep old 781.1Sabs installed files (especially libraries) from interfering 791.1Sabs with the new build. 801.1Sabs To build to a DESTDIR, set the DESTDIR environment 811.2Smrg variable before running make build. It should be set to 821.2Smrg the pathname of an initially empty directory. 831.1Sabs Problems: you might need to update critical utilities 841.1Sabs without using DESTDIR since nothing is executed 851.1Sabs from what is installed in DESTDIR. 861.1Sabs (See critical utils, below) 871.1Sabs Build often: 881.1Sabs This keeps critical utilities current enough to not choke 891.1Sabs on any other part of the source tree that depends on up to 901.1Sabs date functionality. 911.1Sabs 921.1SabsWhat to do if things don't work: 931.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 941.1SabsWhen things don't work there is usually a few things that commonly 951.1Sabsshould be done. 961.1Sabs 1) make includes 971.1Sabs This should be done automatically by make build. 981.1Sabs 2) cd share/mk && make install 991.1Sabs Again, automatically done by make build. 1001.1Sabs 1011.1SabsFailsafe rebuild of a small part of the tree: 1021.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1031.1SabsTo make sure you rebuild something correctly you want to do 1041.1Sabssomething like the following: 1051.1Sabs 1) Make sure the includes and .mk files are up to date. 1061.1Sabs 2) Make sure any program used to build the particular 1071.1Sabs utility is up to date. (yacc, lex, etc...) 1081.1Sabs 3) cd ...path/to/util... 1091.1Sabs make cleandir 1101.1Sabs rm ...all obj directories... 1111.1Sabs make cleandir # yes, again 1121.1Sabs make obj 1131.1Sabs make depend && make 1141.1Sabs 1151.1SabsFailsafe rebuild of the entire tree: 1161.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1171.1SabsIf you really want to make sure the source tree is clean and 1181.2Smrgready for a build try the following. Note that sourcing /etc/mk.conf 1191.2Smrg(a make(1) Makefile) in this manner is not right, and will not work 1201.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf. 1211.1Sabs 1221.1Sabs---cut here--- 1231.1Sabs#!/bin/sh 1241.1Sabs. /etc/mk.conf 1251.1Sabs 1261.1Sabsif [ -z $BSDSRCDIR ] ; then 1271.1Sabs BSDSRCDIR=/usr/src 1281.1Sabsfi 1291.1Sabsif [ \! -d $BSDSRCDIR ] ; then 1301.1Sabs echo Unable to find sources 1311.1Sabs exit 1 1321.1Sabsfi 1331.1Sabsfind $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 1341.1Sabs 1351.1Sabsif [ -z $BSDOBJDIR ] ; then 1361.1Sabs BSDOBJDIR=/usr/obj 1371.1Sabsfi 1381.1Sabsif [ -d $BSDOBJDIR ] ; then 1391.1Sabs rm -rf $BSDOBJDIR 1401.1Sabsfi 1411.1Sabs 1421.1Sabscd $BSDSRCDIR && make cleandir 1431.1Sabs 1441.1Sabs---cut here--- 1451.1Sabs 1461.1SabsCritical utilities: 1471.1Sabs^^^^^^^^^^^^^^^^^^^ 1481.1Sabs gnu/usr.bin/egcs 1491.3Sitojun usr.bin/compile_et 1501.1Sabs usr.bin/make 1511.1Sabs usr.bin/yacc 1521.1Sabs usr.bin/lex 1531.11Slukem usr.bin/xlint 1541.2Smrg usr.sbin/config 1551.1Sabs 1561.1SabsOther problems and possibly solutions: 1571.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1581.1SabsSymptom:Unreasonable compiler errors. 1591.1SabsFix: Rebuild gnu/usr.bin/egcs 1601.1Sabs 1611.1SabsSymptom:Complaints involving a Makefile. 1621.17SerhFix: Rebuild usr.bin/make: 1631.17Serh cd usr.bin/make && make && make install 1641.17Serh Or, a failsafe method if that doesn't work: 1651.17Serh cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 1661.17Serh 1671.1SabsFix: Make sure .mk files are up to date. 1681.1Sabs cd share/mk && make install 1691.2Smrg 1701.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC. 1711.2SmrgFix: Rebuild usr.sbin/config 1721.1Sabs 1731.1SabsSymptom: 1741.1SabsFix: Rebuild usr.bin/yacc 1751.1Sabs 1761.1SabsSymptom: 1771.1SabsFix: Rebuild usr.bin/lex 1781.1Sabs 1791.1SabsSymptom: 1801.1SabsFix: rm /usr/lib/libbfd.a 1811.4Sitojun 1821.4SitojunSymptom:Obsolete intermediate files are used during compilation 1831.4SitojunFix: Try the following sequence of commands in the directory in question. 1841.4Sitojun make cleandir; rm `make print-objdir`; make cleandir; make obj 1851.4Sitojun (If you built the tree without "make obj" in the past, obsolete files 1861.4Sitojun may remain. The command tries to clean everything up) 1871.5Swiz 1881.5SwizSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 1891.5SwizFix: Rebuild and install usr.bin/menuc 1901.12Sitojun 1911.12SitojunSymptom:mklocale not found during build in share/locale/ctype 1921.12SitojunFix: Build and install usr.bin/mklocale 1931.13Sdogcow 1941.13SdogcowSymptom:undefined reference to `__assert13' 1951.13SdogcowFix: Rebuild and install lib/libc 1961.13Sdogcow 1971.19ScgdSymptom:usr.sbin/config fails to build. 1981.19ScgdFix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 1991.13Sdogcow 2001.19ScgdSymptom:undefined reference to `getprogname' or `setprogname' 2011.19ScgdFix: Rebuild and install lib/libc 202