Subject: Re: Xaw3d - wrong compiler flags on Solaris w gcc
To: Malte Dehling <>
From: Dan McMahill <dmcmahill@NetBSD.Org>
List: tech-pkg
Date: 02/24/2005 08:09:09
On Wed, Feb 23, 2005 at 09:37:22PM +0100, Malte Dehling wrote:
> Last week I tried to build Xaw3d from pkgsrc on a dual Ultra-2 / Solaris 9
> with gcc3 installed from pkgsrc. GCC complained about unknown compiler
> flags (-Kpic -xF and -xarch=v8) which makes me believe that Xaw3d checks
> for the operating system and automatically assumes Im using the SUN C
> compiler with Solaris... Anyway, I removed all occurences of '-xF' and
> '-xarch=v8' from the Makefile and replaced all '-Kpic's with '-fPIC's
> (without this, linking didnt work.)

this is because Xaw3d uses imake.

In /usr/openwin/lib/config you'll need to edit site.def and uncomment out
these sections:

#ifndef HasGcc2
#define HasGcc2 YES

#ifndef HasCplusplus
#define HasCplusplus YES

I ended up also editing and adding 
#if HasGcc || HasGcc2
#define PositionIndependentCFlags -fPIC -DPIC
#if HasGcc || HasGcc2
#define PositionIndependentCplusplusFlags -fPIC -DPIC

right near where the tests for SunC are.  Search for -Kpic and you'll
find it.

I wonder if perhaps our bootstrap kit should set these things based
on if PKGSRC_COMPILER=        gcc

or not.

> After this everything built fine but experienced another problem:
> 'make install' install the headers in ../pkg/include/X11/X11/Xaw3d, which
> should be ../pkg/include/X11/Xaw3d I think. Just moving the directory there
> works, but this is not a real fix of course...

ah.  I'd had this problem too!  Didn't figure out why yet.  Could be
some more imake fallout.