Subject: Re: sunpro and -xarch=v9 on Solaris 10
To: None <segv@netctl.net>
From: Steven Gurr <Steven.Gurr@Sun.COM>
List: tech-pkg
Date: 12/04/2005 20:03:49
On 4 Dec 2005, at 6:56 pm, segv@netctl.net wrote:

> On Sun, 04 Dec 2005 18:48:29 +0000
> Steven Gurr <Steven.Gurr@Sun.COM> wrote:
>
>> I've recently installed the Sun Studio 11 packages from Sun, and
>> tried to start building packages with it. In my mk.conf I have this:
>>
>> PKGSRC_COMPILER=sunpro
>> CFLAGS+=-xarch=v9
>> LDFLAGS+=-xarch=v9
>> CC=/opt/SUNWspro/bin/cc
>> CXX=/opt/SUNWspro/bin/CC
>>
>>
>> Most things seem to have worked, but some packages don't build
>> properly as it makes all the .o files with the -xarch=v9, but then
>> tries to link them without the -xarch=v9 flag. This ends up giving an
>> error. Below is an example of it, taken from databases/db4.
>
> I think that's because you didn't set C++ flags
> Below is what it should look like in mk.conf (add your -xarch=v9 to
> PKGSRC_CFLAGS and PKGSRC_CXXFLAGS)
>
> # -- Begin compiler and optimisation flags --
> #
> # Set these when building packages with gcc
> #USE_PKGSRC_GCC=YES
> #GCC_REQD=4.0.2
> #PKGSRC_CFLAGS=-O2 -mcpu=ultrasparc -mvis -mv8plus -pipe
> #PKGSRC_CXXFLAGS=-O2 -mcpu=ultrasparc -mvis -mv8plus -pipe
>
> # Set these when building packages with sunpro
> PKGSRC_COMPILER=sunpro
> CC=/opt/SUNWspro/bin/cc
> CXX=/opt/SUNWspro/bin/CC
> PKGSRC_CFLAGS=-xO3 -xtarget=native
> PKGSRC_CXXFLAGS=-xO3 -xtarget=native -features=%all
>
> # Set optimisation flags
> COPTS+=${PKGSRC_CFLAGS}
> CFLAGS+=${PKGSRC_CFLAGS}
> CXXFLAGS+=${PKGSRC_CXXFLAGS}
> #
> # -- End compiler and optimisation flags --
>

Thanks for the quick reply. Unfortunately, I'm still getting the same  
error. My updated mk.conf is included below:

PKGSRC_COMPILER=sunpro
CC=/opt/SUNWspro/bin/cc
CXX=/opt/SUNWspro/bin/CC

PKGSRC_CFLAGS+=-xO3 -xarch=v9
PKGSRC_CXXFLAFS+=-xO3 -xarch=v9
COPTS+=${PKGSRC_CFLAGS}
CFLAGS+=${PKGSRC_CFLAGS}
CXXFLAGS+=${PKGSRC_CXXFLAGS}

Does that look alright? I did a bmake clean before rebuilding this  
package, to be sure that there wouldn't be any problems.

Thanks