UPDATING revision 1.9
11.9Ssommerfe$NetBSD: UPDATING,v 1.9 2001/01/01 15:29:16 sommerfeld 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.9Ssommerfe 111.9Ssommerfe20010101: 121.9Ssommerfe bsd.subdir.mk committed 20001230 had a bug which caused 131.9Ssommerfe afterinstall targets to run too soon; update again. 141.8Ssommerfe 151.8Ssommerfe20001230: 161.8Ssommerfe New share/mk files needed to support .WAIT in SUBDIR variables. 171.8Ssommerfe If you get make errors, 181.8Ssommerfe (cd share/mk; make install) 191.8Ssommerfe Also, PRINTOBJDIR has changed and is now used more heavily. 201.6Sad 211.6Sad20001019: 221.7Sad The `ca' device driver has been replaced by `ld'; although the 231.6Sad major and minor numbers haven't changed, you should update your /dev 241.6Sad directory. 251.1Sabs 261.4Sitojun20000929: 271.4Sitojun The following make directives are obsoleted. 281.4Sitojun MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 291.4Sitojun By default, RSA is built into libcrypto. IDEA and RC5 will not be 301.4Sitojun bulit into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 311.4Sitojun additional library libcrypto_{idea,rc5}. 321.4Sitojun 331.1Sabs20000623: 341.1Sabs MKCRYPTO and friends added to share/mk/bsd.own.mk. 351.1Sabs 'cd share/mk ; make install' needed before make build. 361.1Sabs 371.1Sabs 381.1SabsHints for a more successful build: 391.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 401.2Smrg Build a new kernel first: 411.2Smrg This makes sure that any new system calls or features 421.2Smrg expected by the new userland will be present. This 431.2Smrg helps to avoid critical errors when upgrading. 441.1Sabs Use object directories: 451.1Sabs This helps to keep stale object 461.1Sabs files from polluting the build if a Makefile "forgets" 471.1Sabs about one. It also makes it easier to clean up after 481.1Sabs a build. It's also necessary if you want to use the 491.1Sabs same source tree for multiple machines. 501.1Sabs To use object directories: 511.1Sabs a) cd /usr/src ; make cleandir 521.2Smrg b) Add "OBJMACHINE=yes" to /etc/mk.conf 531.2Smrg c) Add "MKOBJDIRS=yes" to /etc/mk.conf 541.1Sabs d) cd /usr/src ; make build 551.2Smrg Note that running "make obj" in a directory will create 561.2Smrg in obj.$MACHINE directory. 571.1Sabs Build to a DESTDIR: 581.1Sabs This helps to keep old 591.1Sabs installed files (especially libraries) from interfering 601.1Sabs with the new build. 611.1Sabs To build to a DESTDIR, set the DESTDIR environment 621.2Smrg variable before running make build. It should be set to 631.2Smrg the pathname of an initially empty directory. 641.1Sabs Problems: you might need to update critical utilities 651.1Sabs without using DESTDIR since nothing is executed 661.1Sabs from what is installed in DESTDIR. 671.1Sabs (See critical utils, below) 681.1Sabs Build often: 691.1Sabs This keeps critical utilities current enough to not choke 701.1Sabs on any other part of the source tree that depends on up to 711.1Sabs date functionality. 721.1Sabs 731.1SabsWhat to do if things don't work: 741.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 751.1SabsWhen things don't work there is usually a few things that commonly 761.1Sabsshould be done. 771.1Sabs 1) make includes 781.1Sabs This should be done automatically by make build. 791.1Sabs 2) cd share/mk && make install 801.1Sabs Again, automatically done by make build. 811.1Sabs 821.1SabsFailsafe rebuild of a small part of the tree: 831.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 841.1SabsTo make sure you rebuild something correctly you want to do 851.1Sabssomething like the following: 861.1Sabs 1) Make sure the includes and .mk files are up to date. 871.1Sabs 2) Make sure any program used to build the particular 881.1Sabs utility is up to date. (yacc, lex, etc...) 891.1Sabs 3) cd ...path/to/util... 901.1Sabs make cleandir 911.1Sabs rm ...all obj directories... 921.1Sabs make cleandir # yes, again 931.1Sabs make obj 941.1Sabs make depend && make 951.1Sabs 961.1SabsFailsafe rebuild of the entire tree: 971.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 981.1SabsIf you really want to make sure the source tree is clean and 991.2Smrgready for a build try the following. Note that sourcing /etc/mk.conf 1001.2Smrg(a make(1) Makefile) in this manner is not right, and will not work 1011.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf. 1021.1Sabs 1031.1Sabs---cut here--- 1041.1Sabs#!/bin/sh 1051.1Sabs. /etc/mk.conf 1061.1Sabs 1071.1Sabsif [ -z $BSDSRCDIR ] ; then 1081.1Sabs BSDSRCDIR=/usr/src 1091.1Sabsfi 1101.1Sabsif [ \! -d $BSDSRCDIR ] ; then 1111.1Sabs echo Unable to find sources 1121.1Sabs exit 1 1131.1Sabsfi 1141.1Sabsfind $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 1151.1Sabs 1161.1Sabsif [ -z $BSDOBJDIR ] ; then 1171.1Sabs BSDOBJDIR=/usr/obj 1181.1Sabsfi 1191.1Sabsif [ -d $BSDOBJDIR ] ; then 1201.1Sabs rm -rf $BSDOBJDIR 1211.1Sabsfi 1221.1Sabs 1231.1Sabscd $BSDSRCDIR && make cleandir 1241.1Sabs 1251.1Sabs---cut here--- 1261.1Sabs 1271.1SabsCritical utilities: 1281.1Sabs^^^^^^^^^^^^^^^^^^^ 1291.1Sabs gnu/usr.bin/egcs 1301.3Sitojun usr.bin/compile_et 1311.1Sabs usr.bin/make 1321.1Sabs usr.bin/yacc 1331.1Sabs usr.bin/lex 1341.2Smrg usr.sbin/config 1351.1Sabs 1361.1SabsOther problems and possibly solutions: 1371.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1381.1SabsSymptom:Unreasonable compiler errors. 1391.1SabsFix: Rebuild gnu/usr.bin/egcs 1401.1Sabs 1411.1SabsSymptom:Complaints involving a Makefile. 1421.1SabsFix: Make sure .mk files are up to date. 1431.1Sabs cd share/mk && make install 1441.1SabsFix: Rebuild usr.bin/make 1451.2Smrg 1461.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC. 1471.2SmrgFix: Rebuild usr.sbin/config 1481.1Sabs 1491.1SabsSymptom: 1501.1SabsFix: Rebuild usr.bin/yacc 1511.1Sabs 1521.1SabsSymptom: 1531.1SabsFix: Rebuild usr.bin/lex 1541.1Sabs 1551.1SabsSymptom: 1561.1SabsFix: rm /usr/lib/libbfd.a 1571.4Sitojun 1581.4SitojunSymptom:Obsolete intermediate files are used during compilation 1591.4SitojunFix: Try the following sequence of commands in the directory in question. 1601.4Sitojun make cleandir; rm `make print-objdir`; make cleandir; make obj 1611.4Sitojun (If you built the tree without "make obj" in the past, obsolete files 1621.4Sitojun may remain. The command tries to clean everything up) 1631.5Swiz 1641.5SwizSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 1651.5SwizFix: Rebuild and install usr.bin/menuc 166