Subject: Error in netbsd guide: /usr/obj
To: None <netbsd-docs@netbsd.org>
From: Jeffrey A. Edlund <jae-bsd@glaxonlabs.com>
List: netbsd-docs
Date: 04/09/2005 18:12:30
Hi, 

I installed NetBSD 2.0 on i386 from CD and then followed the directions in Chapters 25 and 26 to download the netbsd sources and compile them for i386.  (A learning experience.)
I found that I had to create a /usr/obj directory that is not described in
http://www.netbsd.org/guide/en/chap-cvs.html#chap-cvs-dirs

Here's how I got to the problem:

As root:

#mkdir /usr/src
#chown username /usr/src

As me:

#export CVS_RSH=ssh
#export CVSROOT=anoncvs@anoncvs.NetBSD.org:/cvsroot

#cd /usr/
#cvs checkout -rnetbsd-2-0 -P src

#cd /usr/src
#./build.sh -m i386 tools
lots of output............
cc  -O -o nbmake *.o  
BSDOBJDIR /usr/obj does not exist, bailing...

*** Failed target:  obj
*** Failed command: cd /usr/src/tools; here=`/bin/pwd`/; subdir=${here#/usr/src/}; if [ "$here" != "$subdir" ]; then if [ ! -d /usr/obj ]; then echo "BSDOBJDIR /usr/obj does not exist, bailing..."; exit 1; fi; subdir=${subdir%/}; dest=/usr/obj/$subdir; if [ -x /usr/src/tooldir.NetBSD-2.0-i386/bin/nbstat ] && ttarg=`/usr/src/tooldir.NetBSD-2.0-i386/bin/nbstat -qf '%Y' ${here}obj` && [ "$dest" = "$ttarg" ]; then : ; else echo '# ' " objdir $dest"; rm -rf obj; ln -s $dest obj; fi; if [ ! -d $dest ]; then mkdir -p $dest; else true; fi; else true ; dest=${here}obj ; if [ ! -d obj ] || [ -h obj ]; then echo '# ' " objdir $dest"; rm -f obj; mkdir $dest; fi ; fi;
*** Error code 1

Stop.
nbmake: stopped in /usr/src/tools

ERROR: Failed to make obj in tools
*** BUILD ABORTED ***

Fix:

If in addition to creating the src directory I run the following as root:
#mkdir /usr/obj
#chown username /usr/obj

The tools build correctly and I can follow the rest of the directions.

Thanks, 

Jeffrey