Subject: toolchain/22764: Crossbuild search includes in host's tree
To: None <gnats-bugs@gnats.netbsd.org>
From: Xavier HUMBERT <xavier@xavhome.fr.eu.org>
List: netbsd-bugs
Date: 09/12/2003 21:16:34
>Number:         22764
>Category:       toolchain
>Synopsis:       When crosscompiling, building the toolchain uses includes from mthe host, not from the sourcetree
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 12 19:17:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Xavier HUMBERT
>Release:        NetBSD 1.6Z
>Organization:
>Environment:
System: NetBSD arnor.xavhome.fr.eu.org 1.6Z NetBSD 1.6Z (XAVIER) #2: Tue Sep 9 23:45:04 CEST 2003 root@arnor.xavhome.fr.eu.org:/usr/obj.i386/sys/arch/i386/compile/XAVIER i386
Architecture: i386
Machine: i386
Host System: valinor.xavhome.fr.eu.org FreeBSD 5.1-CURRENT (XAVIER) #15: Fri Aug 15 10:18:41 CEST 2003
Host Architecture: i386
Host Machine: i386

>Description:
	I tried to build the toolchain on a FreeBSD host (I know, it is not officially supported).
	
	First, I had to clear BSDSRCDIR and BSDOBJDIR since they were sticked to /usr/src and /usr/obj, as shown by
	"./build.sh .... params". Dunno if it matters.
	
	Second, I was looking in the output for references outside the source tree, for two reasons 1- not to nuke my FreeBSD src
	2-I sometimes ran into a NetBSD hosted build using installed includes rather than those from source tree. It *generally* is
	not a problem, but sometimes, I had to boostrap with a "make includes"
	
	And in fact, I found the build process using FreeBSD's includes, which obviously is incorrect.
	
>How-To-Repeat:

Here is the build environment :

(note that /etc/mk.conf does NOT exists, purposely.

------------>8--------------------------------------------------------------------------------------------------------------------
[root@valinor ~]# cd /home/nb/src/
[root@valinor src]# ./build.sh -u -m i386 -D /home/nb/build.i386 -R /home/nb/release.i386 -O /home/nb/obj.i386 -T /home/nb/tools.i386 -V BSDSRCDIR= -V BSDOBJDIR=  params
[...]
           BSDSRCDIR = ''
           BSDOBJDIR = ''
             BUILDID = (undefined)
             DESTDIR = '/home/nb/build.i386'
  EXTERNAL_TOOLCHAIN = (undefined)
         KERNARCHDIR = 'arch/i386'
         KERNCONFDIR = '/home/nb/src/sys/arch/i386/conf'
          KERNOBJDIR = '/home/nb/src/sys/arch/i386/compile'
          KERNSRCDIR = '/home/nb/src/sys'
             MACHINE = 'i386'
        MACHINE_ARCH = 'i386'
            MAKECONF = '/etc/mk.conf'
           MAKEFLAGS = ' -d e -m /home/nb/src/share/mk -X HOST_OSTYPE=FreeBSD-5.1-CURRENT-i386 MKOBJDIRS=yes _SRC_TOP_=/home/nb/src'
          MAKEOBJDIR = '/home/nb/obj.i386'
    MAKEOBJDIRPREFIX = (undefined)
           MKOBJDIRS = 'yes'
          MKUNPRIVED = 'no'
            MKUPDATE = 'yes'
          RELEASEDIR = '/home/nb/release.i386'
   TOOLCHAIN_MISSING = 'no'
             TOOLDIR = '/home/nb/tools.i386'
            USETOOLS = 'yes'
------------>8--------------------------------------------------------------------------------------------------------------------

And here is the relevant part of the build output

------------>8--------------------------------------------------------------------------------------------------------------------
# ./build.sh -u -m i386 -D /home/nb/build.i386 -R /home/nb/release.i386 -O /home/nb/obj.i386 -T /home/nb/tools.i386 -V BSDSRCDIR= -V BSDOBJDIR= tools
===> build.sh command: ./build.sh -u -m i386 -D /home/nb/build.i386 -R /home/nb/release.i386 -O /home/nb/obj.i386 -T /home/nb/tools.i386 -V BSDSRCDIR= -V BSDOBJDIR= tools
===> build.sh started: Fri Sep 12 00:55:37 CEST 2003
===> MACHINE:          i386
===> MACHINE_ARCH:     i386
===> TOOLDIR path:     /home/nb/tools.i386
===> DESTDIR path:     /home/nb/build.i386
===> RELEASEDIR path:  /home/nb/release.i386
===> makewrapper:      /home/nb/tools.i386/bin/nbmake-i386
===> Updated /home/nb/tools.i386/bin/nbmake-i386
[........... compiling -apperently successfuly- a lot of stuff .......]
Configuring etc...
loading cache ../config.cache
checking for a BSD compatible install... /home/nb/tools.i386/bin/nbinstall -c -p -r
updating cache ../config.cache
creating ./config.status
creating Makefile
if [ x"" != x ] && [ ! -d pic ]; then  mkdir pic;  else true; fi
touch stamp-picdir
if [ x"" != x ]; then  cc -c -DHAVE_CONFIG_H -W -Wall -Wtraditional -pedantic -O  -I. -I/home/nb/src/tools/toolchain/../../gnu/dist/toolchain/libiberty/../include  /home/nb/src/tools/toolchain/../../gnu/dist/toolchain/libiberty/argv.c -o pic/argv.o;  else true; fi
cc -c -DHAVE_CONFIG_H -W -Wall -Wtraditional -pedantic -O  -I. -I/home/nb/src/tools/toolchain/../../gnu/dist/toolchain/libiberty/../include /home/nb/src/tools/toolchain/../../gnu/dist/toolchain/libiberty/argv.c
In file included from /home/nb/src/gnu/dist/toolchain/libiberty/argv.c:36:
/usr/include/stdlib.h:134: warning: ISO C90 does not support `long long'
/usr/include/stdlib.h:135: warning: ISO C90 does not support `long long'
/usr/include/stdlib.h:140: warning: ISO C90 does not support `long long'
/usr/include/stdlib.h:143: warning: ISO C90 does not support `long long'
/usr/include/stdlib.h:143: warning: ISO C90 does not support `long long'
/usr/include/stdlib.h:145: warning: ISO C90 does not support `long long'
/usr/include/stdlib.h:145: warning: ISO C90 does not support `long long'
/usr/include/stdlib.h:148: warning: ISO C90 does not support `long long'
/usr/include/stdlib.h:151: warning: ISO C90 does not support `long long'
if [ x"" != x ]; then  cc -c -DHAVE_CONFIG_H -W -Wall -Wtraditional -pedantic -O  -I. -I/home/nb/src/tools/toolchain/../../gnu/dist/toolchain/libiberty/../include  /home/nb/src/tools/toolchain/../../gnu/dist/toolchain/libiberty/choose-temp.c -o pic/choose-temp.o;  else true; fi
cc -c -DHAVE_CONFIG_H -W -Wall -Wtraditional -pedantic -O  -I. -I/home/nb/src/tools/toolchain/../../gnu/dist/toolchain/libiberty/../include /home/nb/src/tools/toolchain/../../gnu/dist/toolchain/libiberty/choose-temp.c
In file included from /home/nb/src/gnu/dist/toolchain/libiberty/choose-temp.c:26:
/usr/include/stdio.h: In function `__sputc':
/usr/include/stdio.h:397: warning: traditional C rejects ISO C style function definitions
In file included from /usr/include/sys/types.h:48,
                 from /home/nb/src/gnu/dist/toolchain/libiberty/choose-temp.c:27:
------------>8--------------------------------------------------------------------------------------------------------------------


>Fix:
	Dunno...

Thanks

Best regards,

-- 
Xav
>Release-Note:
>Audit-Trail:
>Unformatted: