Subject: Re: misc/9986: make fails in src/games/phantasia with 1.4X userland
To: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
From: Bill Studenmund <wrstuden@zembu.com>
List: tech-userlevel
Date: 05/01/2000 17:41:43
On Sat, 29 Apr 2000, Julian Coleman wrote:

> konishi@hauN.org wrote:
> > 	make fails in src/games/phantasia with DESTDIR, 
> > 	because DESTDIR does not work.
> > 
> > >How-To-Repeat:
> > 	(1) /usr/include/wchar.h does not exist in Mar-16 userland 

This is the bug. See below.

> > 	(2) cd /usr/src/games/phantasia
> > 	(3) make DESTDIR=somewhere dependall
> > 
> > then get following result
> > 
> > # make DESTDIR=/export/NetBSD-current/root/20000426 dependall
> > cc -O  -c -o host_phantglobs.o /usr/src/games/phantasia/phantglobs.c
> > In file included from /usr/src/games/phantasia/include.h:8,
> >                  from /usr/src/games/phantasia/phantglobs.c:7:
> > /usr/include/curses.h:43: wchar.h: No such file or directory
> 
> I looked at this because I thought it was a curses bug.  However, the
> problem is that compiling phantglobs.c (and setup.c) uses :
> 
> > host_phantglobs.o: ${.CURDIR}/phantglobs.c
> > 	${HOST_COMPILE.c} -o host_phantglobs.o ${.CURDIR}/phantglobs.c
> 
> This results in :
> 
> > cc -O  -c -o host_phantglobs.o /usr/src/games/phantasia/phantglobs.c
> 
> while the other files are compiled as :
> 
> > cc -O2 -nostdinc -idirafter ${DESTDIR}/usr/include -c /usr/src/games/phantasia/gamesupport.c
> 
> etc.  I guess the fix is to add the DESTDIR additions to the HOST_COMPILE.c
> in bsd.sys.mk :

NO! :-)

If you're using the HOST_ directives, you're compiling a program to run on
the host system. You have NO guarantee that the include files in DESTDIR
have anything to do with programs on your host.

> --- /usr/share/mk/bsd.sys.mk-	Sat Feb  5 17:49:57 2000
> +++ /usr/share/mk/bsd.sys.mk	Sat Apr 29 18:50:29 2000
> @@ -18,6 +18,7 @@
>  
>  .if defined(DESTDIR)
>  CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
> +HOST_CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
>  LINTFLAGS+= -d ${DESTDIR}/usr/include
>  .endif
> 
> Should HOST_LDFLAGS also be changed (to have -nostdlib -L${DESTDIR}/usr/lib)?

Consider cross-compiling from an i386 to a mac68k. DESTDIR is full of m68k
libraries, which won't link with i386 binaries. :-)

The bug is either in step (1) or in assuming that you can compile this
game with a March-16th userland. That discussion is best had with whomever
changed the code to need wchar.h.

I'd say it's a bug for the host-compiled code to expect wchar.h to be
there, but that's just my opinion. :-)

Take care,

Bill