Thread: Solaris SPARC - Sun compiler 5.5 - 64 bit

Solaris SPARC - Sun compiler 5.5 - 64 bit

From
"Clark, Andrew"
Date:
Hi all,

I've been trying to compile a 64bit version of PostgreSQL on Solaris
sparc using Sun compiler 5.5, unfortunately I keep getting errors when
compiling.  I can compile PostgreSQL as 32bit without any problems, but
not 64bit.

So I am hoping someone on this list will be able to help.  I'm getting
frustrated!

I think I'm using configure wrong.  Below are the details on my
environment, and how I try to compile PostgreSQL.

Machine:
SunOS dev 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Fire-V440

Compiler:
cc: Sun C 5.5 2003/03/12

Environment:

PATH=/devtools/WS8.0/SUNWspro/bin/sparcv9:/devtools/WS8.0/SUNWspro/bin:/
usr/bin/sparcv9:/usr/bin:/usr/ccs/bin/sparcv9:/usr/ccs/bin:/usr1/clarka/
bin

LD_LIBRARY_PATH=
LD_LIBRARY_PATH_32=/lib:/devtools/WS8.0/SUNWspro/lib:/devtools/oracle/8.
1.7_64/lib:/devtools/sybase-12_0/OCS-12_0/lib:/usr1/clarka/lib
LD_LIBRARY_PATH_64=/lib/64:/lib/sparcv9:/devtools/WS8.0/SUNWspro/lib/v9:
/devtools/oracle/8.1.7_64/lib64:/devtools/sybase-12_0/OCS-12_5/lib:/devt
ools/sybase-12_0/OCS-12_5/lib3p64:/usr1/clarka/lib

Compiling commands:

./configure CFLAGS="-xtarget=ultra2 -xarch=v9a -xchip=ultra2"
--without-readline --without-zlib --prefix=$HOME/UAT/postgres
--enable-thread-safety --enable-integer-datetimes
make
make install



Thanks,
Andrew


Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
Peter Eisentraut
Date:
Am Dienstag, 26. Juli 2005 16:06 schrieb Clark, Andrew:
> I've been trying to compile a 64bit version of PostgreSQL on Solaris
> sparc using Sun compiler 5.5, unfortunately I keep getting errors when
> compiling.

Which errors?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
"Clark, Andrew"
Date:
Hi Peter,

This is the error I receive:

gmake[5]: Entering directory
`/usr1/clarka/src/postgresql-8.0.2/src/backend/storage/lmgr'
cc -Xa -xtarget=ultra2 -xarch=v9a -xchip=ultra2
-I../../../../src/include   -c -o lmgr.o lmgr.c
cc -Xa -xtarget=ultra2 -xarch=v9a -xchip=ultra2
-I../../../../src/include   -c -o lock.o lock.c
cc -Xa -xtarget=ultra2 -xarch=v9a -xchip=ultra2
-I../../../../src/include   -c -o proc.o proc.c
cc -Xa -xtarget=ultra2 -xarch=v9a -xchip=ultra2
-I../../../../src/include   -c -o deadlock.o deadlock.c
cc -Xa -xtarget=ultra2 -xarch=v9a -xchip=ultra2
-I../../../../src/include   -c -o lwlock.o lwlock.c
cc -Xa -xtarget=ultra2 -xarch=v9a -xchip=ultra2
-I../../../../src/include   -c -o spin.o spin.c
cc -Xa -xtarget=ultra2 -xarch=v9a -xchip=ultra2
-I../../../../src/include   -c -o s_lock.o s_lock.c
/devtools/WS8.0/SUNWspro/prod/bin/fbe: "/tmp/yabeAAAKgainV", line 206:
error: can't compute difference between symbols in different segments
Failure in /devtools/WS8.0/SUNWspro/prod/bin/fbe, status = 0x100
Fatal Error exec'ing /devtools/WS8.0/SUNWspro/prod/bin/fbe
cc: acomp failed for s_lock.c
gmake[5]: *** [s_lock.o] Error 2
gmake[5]: Leaving directory
`/usr1/clarka/src/postgresql-8.0.2/src/backend/storage/lmgr'


Thanks,
Andrew


-----Original Message-----
From: Peter Eisentraut [mailto:peter_e@gmx.net]
Sent: July 29, 2005 5:51 AM
To: Clark, Andrew
Cc: pgsql-ports@postgresql.org
Subject: Re: [PORTS] Solaris SPARC - Sun compiler 5.5 - 64 bit

Am Dienstag, 26. Juli 2005 16:06 schrieb Clark, Andrew:
> I've been trying to compile a 64bit version of PostgreSQL on Solaris
> sparc using Sun compiler 5.5, unfortunately I keep getting errors when

> compiling.

Which errors?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
Tom Lane
Date:
"Clark, Andrew" <Andrew.Clark@fnf.com> writes:
> -I../../../../src/include   -c -o s_lock.o s_lock.c
> /devtools/WS8.0/SUNWspro/prod/bin/fbe: "/tmp/yabeAAAKgainV", line 206:
> error: can't compute difference between symbols in different segments
> Failure in /devtools/WS8.0/SUNWspro/prod/bin/fbe, status = 0x100
> Fatal Error exec'ing /devtools/WS8.0/SUNWspro/prod/bin/fbe
> cc: acomp failed for s_lock.c

You really should mention which Postgres version you're using
... but if it's pre-8.0, possibly the problem is the lack of this patch:

2004-12-29 18:47  tgl

    * src/: backend/storage/lmgr/s_lock.c, template/sunos4: Support
    Sun's compiler on SunOS4 (a/k/a Solaris 9).  Per ayan@ayan.net

            regards, tom lane

Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
"Clark, Andrew"
Date:
Hi Tom,

I'm using PostgreSQL 8.0.2 on Solaris 8.

Thanks,
Andrew

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: July 29, 2005 10:18 AM
To: Clark, Andrew
Cc: Peter Eisentraut; pgsql-ports@postgresql.org
Subject: Re: [PORTS] Solaris SPARC - Sun compiler 5.5 - 64 bit

"Clark, Andrew" <Andrew.Clark@fnf.com> writes:
> -I../../../../src/include   -c -o s_lock.o s_lock.c
> /devtools/WS8.0/SUNWspro/prod/bin/fbe: "/tmp/yabeAAAKgainV", line 206:
> error: can't compute difference between symbols in different segments
> Failure in /devtools/WS8.0/SUNWspro/prod/bin/fbe, status = 0x100 Fatal

> Error exec'ing /devtools/WS8.0/SUNWspro/prod/bin/fbe
> cc: acomp failed for s_lock.c

You really should mention which Postgres version you're using ... but if
it's pre-8.0, possibly the problem is the lack of this patch:

2004-12-29 18:47  tgl

    * src/: backend/storage/lmgr/s_lock.c, template/sunos4: Support
    Sun's compiler on SunOS4 (a/k/a Solaris 9).  Per ayan@ayan.net

            regards, tom lane



Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
Tom Lane
Date:
"Clark, Andrew" <Andrew.Clark@fnf.com> writes:
> I'm using PostgreSQL 8.0.2 on Solaris 8.

Is configure using the solaris template, or the sunos4 one?
If the former, does changing
  CFLAGS="-v"            # -v is like gcc -Wall
to
  CFLAGS="-v -DSUNOS4_CC"    # -v is like gcc -Wall
fix it?  (Note you need to re-configure to make template changes
have any effect.)

            regards, tom lane

Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
"Clark, Andrew"
Date:
Tom,

Well that definitely did something, but now I get a different error:

----------------

/usr1/clarka/bin/gmake -C backend/utils/mb/conversion_procs all
gmake[3]: Entering directory
`/usr1/clarka/src/postgresql-8.0.2/src/backend/utils/mb/conversion_procs
'
gmake[4]: Entering directory
`/usr1/clarka/src/postgresql-8.0.2/src/backend/utils/mb/conversion_procs
/ascii_and_mic'
cc -Xa -v -xtarget=ultra2 -xarch=v9a -xchip=ultra2 -DSUNOS4_CC -KPIC
-I../../../../../../src/include   -c -o ascii_and_mic.o ascii_and_mic.c
"ascii_and_mic.c", line 38: warning: assignment type mismatch:
        pointer to unsigned char "=" pointer to char
"ascii_and_mic.c", line 39: warning: assignment type mismatch:
        pointer to unsigned char "=" pointer to char
"ascii_and_mic.c", line 54: warning: assignment type mismatch:
        pointer to unsigned char "=" pointer to char
"ascii_and_mic.c", line 55: warning: assignment type mismatch:
        pointer to unsigned char "=" pointer to char
cc -Xa -G -h libascii_and_mic.so.0  ascii_and_mic.o
-L../../../../../../src/port   -o libascii_and_mic.so.0.0
ld: fatal: file ascii_and_mic.o: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to
libascii_and_mic.so.0.0
gmake[4]: *** [libascii_and_mic.so.0.0] Error 1
gmake[4]: Leaving directory
`/usr1/clarka/src/postgresql-8.0.2/src/backend/utils/mb/conversion_procs
/ascii_and_mic'

----------------

The command that's failing doesn't have the -x flags, so I tried the
following command manually:

cc -Xa -v -xtarget=ultra2 -xarch=v9a -xchip=ultra2 -G -h
libascii_and_mic.so.0  ascii_and_mic.o -L../../../../../../src/port   -o
libascii_and_mic.so.0.0

And it worked...

So, I specified the -x flags in LDFLAG in my configure command. But I
still get the above error and I the LDFLAG isn't being used.

Here is my configure command:

./configure \
CFLAGS="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2 -DSUNOS4_CC" \
LDFLAGS="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2" \
--without-readline \
--without-zlib \
--prefix=$HOME/UAT/postgres \
--enable-thread-safety \
--enable-integer-datetimes


Thanks,
Andrew


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: July 29, 2005 10:37 AM
To: Clark, Andrew
Cc: Peter Eisentraut; pgsql-ports@postgresql.org
Subject: Re: [PORTS] Solaris SPARC - Sun compiler 5.5 - 64 bit

"Clark, Andrew" <Andrew.Clark@fnf.com> writes:
> I'm using PostgreSQL 8.0.2 on Solaris 8.

Is configure using the solaris template, or the sunos4 one?
If the former, does changing
  CFLAGS="-v"            # -v is like gcc -Wall
to
  CFLAGS="-v -DSUNOS4_CC"    # -v is like gcc -Wall
fix it?  (Note you need to re-configure to make template changes have
any effect.)

            regards, tom lane



Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
Tom Lane
Date:
"Clark, Andrew" <Andrew.Clark@fnf.com> writes:
> Well that definitely did something, but now I get a different error:

OK, thanks for the confirmation.  There was some discussion recently
of whether we shouldn't add -DSUNOS4_CC to the solaris template,
but we didn't have proof.

> Here is my configure command:

> ./configure \
> CFLAGS="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2 -DSUNOS4_CC" \
> LDFLAGS="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2" \
> --without-readline \
> --without-zlib \
> --prefix=$HOME/UAT/postgres \
> --enable-thread-safety \
> --enable-integer-datetimes

AFAIK you have to specify both LDFLAGS and LDFLAGS_SL if you want
manual configuration of link options.  LDFLAGS is used for building
regular executables, LDFLAGS_SL for shared libraries.

            regards, tom lane

Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
"Clark, Andrew"
Date:
Tom,

I added LDFLAGS_SL and everything compiled and all regression tests
passed.

Thanks!
Andrew

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: July 29, 2005 11:26 AM
To: Clark, Andrew
Cc: Peter Eisentraut; pgsql-ports@postgresql.org
Subject: Re: [PORTS] Solaris SPARC - Sun compiler 5.5 - 64 bit

"Clark, Andrew" <Andrew.Clark@fnf.com> writes:
> Well that definitely did something, but now I get a different error:

OK, thanks for the confirmation.  There was some discussion recently of
whether we shouldn't add -DSUNOS4_CC to the solaris template, but we
didn't have proof.

> Here is my configure command:

> ./configure \
> CFLAGS="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2 -DSUNOS4_CC" \
> LDFLAGS="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2" \
> --without-readline \ --without-zlib \ --prefix=$HOME/UAT/postgres \
> --enable-thread-safety \ --enable-integer-datetimes

AFAIK you have to specify both LDFLAGS and LDFLAGS_SL if you want manual
configuration of link options.  LDFLAGS is used for building regular
executables, LDFLAGS_SL for shared libraries.

            regards, tom lane



Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
Tom Lane
Date:
I wrote:
> "Clark, Andrew" <Andrew.Clark@fnf.com> writes:
>> Well that definitely did something, but now I get a different error:

> OK, thanks for the confirmation.  There was some discussion recently
> of whether we shouldn't add -DSUNOS4_CC to the solaris template,
> but we didn't have proof.

Actually, this doesn't prove anything one way or the other.  Because you
were manually specifying CFLAGS, and thereby overriding the template,
the lack of -DSUNOS4_CC in the manual CFLAGS caused the s_lock.c
failure.

So: which template did configure pick on your machine, anyway?
(This is reported in the first few lines of configure output)

            regards, tom lane

Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
"Clark, Andrew"
Date:
Quick Summary:

1.

With the follow config:

./configure \
--without-readline \
--without-zlib \
--prefix=$HOME/UAT/postgres \
--enable-thread-safety \
--enable-integer-datetimes \

I have the following config:

configure:1298: checking build system type
configure:1316: result: sparc-sun-solaris2.8
configure:1324: checking host system type
configure:1338: result: sparc-sun-solaris2.8
configure:1348: checking which template to use
configure:1449: result: solaris

2.

With the following config:

./configure \
CFLAGS="-v -DSUNOS4_CC" \
--without-readline \
--without-zlib \
--prefix=$HOME/UAT/postgres \
--enable-thread-safety \
--enable-integer-datetimes

I have the following config:

configure:1298: checking build system type
configure:1316: result: sparc-sun-solaris2.8
configure:1324: checking host system type
configure:1338: result: sparc-sun-solaris2.8
configure:1348: checking which template to use
configure:1449: result: solaris

3.

With the following config:

./configure \
CFLAGS="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2 -DSUNOS4_CC" \
LDFLAGS="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2" \
LDFLAGS_SL="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2" \
--without-readline \
--without-zlib \
--prefix=$HOME/UAT/postgres \
--enable-thread-safety \
--enable-integer-datetimes

I have the following config:

configure:1298: checking build system type
configure:1316: result: sparc-sun-solaris2.8
configure:1324: checking host system type
configure:1338: result: sparc-sun-solaris2.8
configure:1348: checking which template to use
configure:1449: result: solaris

4.

./configure \
CFLAGS="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2" \
LDFLAGS="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2" \
LDFLAGS_SL="-v -xtarget=ultra2 -xarch=v9a -xchip=ultra2" \
--without-readline \
--without-zlib \
--prefix=$HOME/UAT/postgres \
--enable-thread-safety \
--enable-integer-datetimes

I have the following config:

configure:1298: checking build system type
configure:1316: result: sparc-sun-solaris2.8
configure:1324: checking host system type
configure:1338: result: sparc-sun-solaris2.8
configure:1348: checking which template to use
configure:1449: result: solaris


NOTES:

1 and 2 can compile and they both produce 32bit bins and libs.
3 can compile and it produces 64bit bins and libs.
4 can't compile (fbe fails)


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: July 29, 2005 12:18 PM
To: Clark, Andrew
Cc: Peter Eisentraut; pgsql-ports@postgresql.org
Subject: Re: [PORTS] Solaris SPARC - Sun compiler 5.5 - 64 bit

I wrote:
> "Clark, Andrew" <Andrew.Clark@fnf.com> writes:
>> Well that definitely did something, but now I get a different error:

> OK, thanks for the confirmation.  There was some discussion recently
> of whether we shouldn't add -DSUNOS4_CC to the solaris template, but
> we didn't have proof.

Actually, this doesn't prove anything one way or the other.  Because you
were manually specifying CFLAGS, and thereby overriding the template,
the lack of -DSUNOS4_CC in the manual CFLAGS caused the s_lock.c
failure.

So: which template did configure pick on your machine, anyway?
(This is reported in the first few lines of configure output)

            regards, tom lane



Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
Tom Lane
Date:
"Clark, Andrew" <Andrew.Clark@fnf.com> writes:
> I have the following config:

> configure:1298: checking build system type
> configure:1316: result: sparc-sun-solaris2.8
> configure:1324: checking host system type
> configure:1338: result: sparc-sun-solaris2.8
> configure:1348: checking which template to use
> configure:1449: result: solaris

OK, so we do need to fix the solaris template too.

I have a feeling that there may need to be some sort of test on the
compiler version specifically, but without some more data it's hard
to say what.  For the moment I'll just put it into template/solaris
unconditionally.

            regards, tom lane

Re: Solaris SPARC - Sun compiler 5.5 - 64 bit

From
"Clark, Andrew"
Date:
Let me know if you want to test something...


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: July 29, 2005 12:58 PM
To: Clark, Andrew
Cc: Peter Eisentraut; pgsql-ports@postgresql.org
Subject: Re: [PORTS] Solaris SPARC - Sun compiler 5.5 - 64 bit

"Clark, Andrew" <Andrew.Clark@fnf.com> writes:
> I have the following config:

> configure:1298: checking build system type
> configure:1316: result: sparc-sun-solaris2.8
> configure:1324: checking host system type
> configure:1338: result: sparc-sun-solaris2.8
> configure:1348: checking which template to use
> configure:1449: result: solaris

OK, so we do need to fix the solaris template too.

I have a feeling that there may need to be some sort of test on the
compiler version specifically, but without some more data it's hard to
say what.  For the moment I'll just put it into template/solaris
unconditionally.

            regards, tom lane