Subject: Latest modification of pax/ar_subs.c breaks cross-building
To: None <current-users@netbsd.org>
From: Emil =?unknown-8bit?Q?Sk=F6ldberg?= <emil.skoldberg@nuigalway.ie>
List: current-users
Date: 10/19/2004 17:32:45
Hi,

trying to cross build tools from linux exits with error in pax.
After undoing the latest change to pax/ar_subs.c the tools build
without any errors, (this is not a fix, but works well enough to
later build the distribution).


/emil


The relevant bit of the latest change was:
------------------------------------------

--- src/bin/pax/ar_subs.c	2004/10/10 22:03:08	1.32
+++ src/bin/pax/ar_subs.c	2004/10/17 18:49:55	1.33

[snipped}
 
@@ -198,6 +198,10 @@ extract(void)
 		return;
 
 	now = time((time_t *)NULL);
+	if (do_chroot && fchroot(cwdfd) != 0) {
+		syswarn(1, errno, "Can't fchroot to \".\"");
+		return;
+	}
 
 	/*
 	 * When we are doing interactive rename, we store the mapping of 
names



Relevant part of the output:
---------------------------


bash-2.05b$ ./build.sh -m pmax -T ../mycross -O ../myobj -U tools

[snip]

#      link  pax/pax
cc -O -I/var/nfs/netbsd-current/src/../myobj/tools/compat 
-I/var/nfs/netbsd-current/src/../myobj/tools/compat/include  
-I/var/nfs/netbsd-current/src/tools/pax/../compat 
-DHAVE_NBTOOL_CONFIG_H=1  -D_FILE_OFFSET_BITS=64  
-I/var/nfs/netbsd-current/src/usr.sbin/mtree  
-I/var/nfs/netbsd-current/src/sbin/mknod  
-I/var/nfs/netbsd-current/src/bin/ls -DHOSTPROG   -o pax ar_io.lo 
ar_subs.lo buf_subs.lo cpio.lo file_subs.lo ftree.lo gen_subs.lo 
getoldopt.lo options.lo pat_rep.lo pax.lo sel_subs.lo tables.lo tar.lo 
tty_subs.lo getid.lo spec.lo misc.lo stat_flags.lo pack_dev.lo 
-L/var/nfs/netbsd-current/src/../myobj/tools/compat -lnbcompat -lz
ar_subs.lo(.text+0x254): In function `extract':
: undefined reference to `fchroot'
collect2: ld returned 1 exit status

*** Failed target:  pax
*** Failed command: cc -O 
-I/var/nfs/netbsd-current/src/../myobj/tools/compat 
-I/var/nfs/netbsd-current/src/../myobj/tools/compat/include 
-I/var/nfs/netbsd-current/src/tools/pax/../compat 
-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 
-I/var/nfs/netbsd-current/src/usr.sbin/mtree 
-I/var/nfs/netbsd-current/src/sbin/mknod 
-I/var/nfs/netbsd-current/src/bin/ls -DHOSTPROG -o pax ar_io.lo 
ar_subs.lo buf_subs.lo cpio.lo file_subs.lo ftree.lo gen_subs.lo 
getoldopt.lo options.lo pat_rep.lo pax.lo sel_subs.lo tables.lo tar.lo 
tty_subs.lo getid.lo spec.lo misc.lo stat_flags.lo pack_dev.lo 
-L/var/nfs/netbsd-current/src/../myobj/tools/compat -lnbcompat -lz
*** Error code 1

Stop.
nbmake: stopped in /var/nfs/netbsd-current/src/tools/pax

*** Failed target:  dependall
*** Failed command: cd /var/nfs/netbsd-current/src/tools/pax; 
/var/nfs/netbsd-current/src/../mycross/bin/nbmake realall
*** Error code 1

Stop.
nbmake: stopped in /var/nfs/netbsd-current/src/tools/pax

*** Failed target:  dependall-pax
*** Failed command: _makedirtarget() { dir="$1"; shift; target="$1"; 
shift; case "${dir}" in /*) this="${dir}/"; real="${dir}" ;; .) this=""; 
real="/var/nfs/netbsd-current/src/tools" ;; *) this="${dir}/"; 
real="/var/nfs/netbsd-current/src/tools/${dir}" ;; esac; 
show=${this:-.}; echo "${target} ===> ${show%/}${1:+ (with: $@)}"; cd 
"${real}" && /var/nfs/netbsd-current/src/../mycross/bin/nbmake 
_THISDIR_="${this}" "$@" ${target}; }; _makedirtarget pax dependall
*** Error code 1

Stop.
nbmake: stopped in /var/nfs/netbsd-current/src/tools

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