Thread: Compile with Solaris 10 AMD 64bit Sun CC

Compile with Solaris 10 AMD 64bit Sun CC

From
Martijn de Munnik
Date:
Hi

I'm trying to compile PostgreSQL 8.0.3 on a Sun Solaris 10 box, dual
opteron and using the sun studio cc compiler. I get the following error;

cc -Xa -fast -xarch=amd64 -I../../../../src/include -fast -
xarch=amd64   -c -o clog.o clog.c
cc -Xa -fast -xarch=amd64 -I../../../../src/include -fast -
xarch=amd64   -c -o transam.o transam.c
cc -Xa -fast -xarch=amd64 -I../../../../src/include -fast -
xarch=amd64   -c -o varsup.o varsup.c
cc -Xa -fast -xarch=amd64 -I../../../../src/include -fast -
xarch=amd64   -c -o xact.o xact.c
cc -Xa -fast -xarch=amd64 -I../../../../src/include -fast -
xarch=amd64   -c -o xlog.o xlog.c
"../../../../src/include/storage/s_lock.h", line 701: #error:
PostgreSQL does not have native spinlock support on this platform.
To continue the compilation, rerun configure using --disable-
spinlocks.  However, performance will be poor.  Please report this to
pgsql-bugs@postgresql.org.
cc: acomp failed for xlog.c
gmake[4]: *** [xlog.o] Error 2
gmake[4]: Leaving directory `/export/home/users/munnik/software/
postgresql-8.0.3/src/backend/access/transam'
gmake[3]: *** [transam-recursive] Error 2
gmake[3]: Leaving directory `/export/home/users/munnik/software/
postgresql-8.0.3/src/backend/access'
gmake[2]: *** [access-recursive] Error 2
gmake[2]: Leaving directory `/export/home/users/munnik/software/
postgresql-8.0.3/src/backend'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/export/home/users/munnik/software/
postgresql-8.0.3/src'
gmake: *** [all] Error 2

then I add --disable-spinlocks to the configuration and I get the
following error;

gmake[3]: Entering directory `/export/home/users/munnik/software/
postgresql-8.0.3/src/backend/port'
cc -Xa -fast -xarch=amd64 -I../../../src/include -fast -xarch=amd64
-c -o dynloader.o dynloader.c
"dynloader.c", line 4: warning: empty translation unit
cc -Xa -fast -xarch=amd64 -I../../../src/include -fast -xarch=amd64
-c -o pg_sema.o pg_sema.c
cc -Xa -fast -xarch=amd64 -I../../../src/include -fast -xarch=amd64
-c -o pg_shmem.o pg_shmem.c
cc -Xa -fast -xarch=amd64 -c tas.s
Assembler: tas.s
         "tas.s", line 12 : Illegal mnemonic
         "tas.s", line 14 : Illegal mnemonic
         "tas.s", line 15 : Syntax error
         "tas.s", line 17 : Syntax error
         "tas.s", line 26 : Illegal mnemonic
         "tas.s", line 28 : Illegal mnemonic
cc: assembler failed for tas.s
gmake[3]: *** [tas.o] Error 2
gmake[3]: Leaving directory `/export/home/users/munnik/software/
postgresql-8.0.3/src/backend/port'
gmake[2]: *** [port-recursive] Error 2
gmake[2]: Leaving directory `/export/home/users/munnik/software/
postgresql-8.0.3/src/backend'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/export/home/users/munnik/software/
postgresql-8.0.3/src'
gmake: *** [all] Error 2

CFLAGS=-fast -xarch=amd64
CPPFLAGS=-fast -xarch=amd64

cc: Sun C 5.7 2005/01/07
SunOS chet 5.10 Generic i86pc i386 i86pc

1st attempt
./configure --prefix=/opt/postgresql --without-readline
2nd attempt
./configure --prefix=/opt/postgresql --without-readline --disable-
spinlocks

any ideas?

Martijn

Re: Compile with Solaris 10 AMD 64bit Sun CC

From
Michael Crozier
Date:
Hello,

Recently I had a seemingly related problem, but using GCC on Solaris
10/Opteron.  I attempted to post to this list, but the message was never
posted (due to moderation?).

Eventually, I ended up manually re-symlinking tas.s to dummy.s, with the
intent to determine the problem before this machine went into production.

tas.s was previously linked to src/backend/port/tas/solaris_i386.s

GCC's error message was:

      gcc -m64 -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
         -Wmissing-declarations -c tas.s
       tas.s: Assembler messages:
       tas.s:12: Error: suffix or operands invalid for `push'
       tas.s:14: Error: suffix or operands invalid for `push'
       tas.s:15: Error: `8(%ebp)' is not a valid 64 bit base/index expression
       tas.s:17: Error: `(%ebx)' is not a valid 64 bit base/index expression
       tas.s:26: Error: suffix or operands invalid for `pop'
       tas.s:28: Error: suffix or operands invalid for `pop'
      gmake: *** [tas.o] Error 1

My configure command and environment was:

   export LD_LIBRARY_PATH=/usr/sfw/lib/amd64
   export LIBS="-lpthread -lssl -lcrypto -lgcc_s_amd64"
   export LIBPATHS="-L/usr/sfw/lib/amd64 -R/usr/sfw/lib/amd64 -L/usr/lib/64  \
     -R/usr/lib/64 -L/usr/lib -R/usr/lib \
     -L/opt/python/lib -R/opt/python/lib -L/opt/readline/lib \
     -R/opt/readline/lib -L/opt/openssl/lib \
     -R/opt/postgresql-POSTGRESQL_VERSION"
  export INCPATHS="-I/opt/readline/include -I/opt/python/include/python2.3"
  export CC="/usr/sfw/bin/gcc -m64 -O2"
  export CFLAGS="$LIBPATHS $INCPATHS"
  export CXXFLAGS="$CFLAGS"
  export LDFLAGS="$LIBPATHS $LIBS"
  export SHLIB_LINK="$LDFLAGS"
  export BE_DLLLIBS=$SHLIB_LINK
  ./configure --prefix=/opt/postgresql-POSTGRESQL_VERSION --with-python
--with-libraries=/opt/readline/lib:/opt/python/lib:/opt/python/lib/python2.3/config
--with-java --with-maxbackends=128
--with-includes=/opt/python/include/python2.3:/opt/readline/include
--with-gnu-ld --enable-thread-safety


> Hi
>
> I'm trying to compile PostgreSQL 8.0.3 on a Sun Solaris 10 box, dual
> opteron and using the sun studio cc compiler. I get the following error;
>
> cc -Xa -fast -xarch=amd64 -I../../../../src/include -fast -
> xarch=amd64   -c -o clog.o clog.c
> cc -Xa -fast -xarch=amd64 -I../../../../src/include -fast -
> xarch=amd64   -c -o transam.o transam.c
> cc -Xa -fast -xarch=amd64 -I../../../../src/include -fast -
> xarch=amd64   -c -o varsup.o varsup.c
> cc -Xa -fast -xarch=amd64 -I../../../../src/include -fast -
> xarch=amd64   -c -o xact.o xact.c
> cc -Xa -fast -xarch=amd64 -I../../../../src/include -fast -
> xarch=amd64   -c -o xlog.o xlog.c
> "../../../../src/include/storage/s_lock.h", line 701: #error:
> PostgreSQL does not have native spinlock support on this platform.
> To continue the compilation, rerun configure using --disable-
> spinlocks.  However, performance will be poor.  Please report this to
> pgsql-bugs@postgresql.org.
> cc: acomp failed for xlog.c
> gmake[4]: *** [xlog.o] Error 2
> gmake[4]: Leaving directory `/export/home/users/munnik/software/
> postgresql-8.0.3/src/backend/access/transam'
> gmake[3]: *** [transam-recursive] Error 2
> gmake[3]: Leaving directory `/export/home/users/munnik/software/
> postgresql-8.0.3/src/backend/access'
> gmake[2]: *** [access-recursive] Error 2
> gmake[2]: Leaving directory `/export/home/users/munnik/software/
> postgresql-8.0.3/src/backend'
> gmake[1]: *** [all] Error 2
> gmake[1]: Leaving directory `/export/home/users/munnik/software/
> postgresql-8.0.3/src'
> gmake: *** [all] Error 2
>
> then I add --disable-spinlocks to the configuration and I get the
> following error;
>
> gmake[3]: Entering directory `/export/home/users/munnik/software/
> postgresql-8.0.3/src/backend/port'
> cc -Xa -fast -xarch=amd64 -I../../../src/include -fast -xarch=amd64
> -c -o dynloader.o dynloader.c
> "dynloader.c", line 4: warning: empty translation unit
> cc -Xa -fast -xarch=amd64 -I../../../src/include -fast -xarch=amd64
> -c -o pg_sema.o pg_sema.c
> cc -Xa -fast -xarch=amd64 -I../../../src/include -fast -xarch=amd64
> -c -o pg_shmem.o pg_shmem.c
> cc -Xa -fast -xarch=amd64 -c tas.s
> Assembler: tas.s
>          "tas.s", line 12 : Illegal mnemonic
>          "tas.s", line 14 : Illegal mnemonic
>          "tas.s", line 15 : Syntax error
>          "tas.s", line 17 : Syntax error
>          "tas.s", line 26 : Illegal mnemonic
>          "tas.s", line 28 : Illegal mnemonic
> cc: assembler failed for tas.s
> gmake[3]: *** [tas.o] Error 2
> gmake[3]: Leaving directory `/export/home/users/munnik/software/
> postgresql-8.0.3/src/backend/port'
> gmake[2]: *** [port-recursive] Error 2
> gmake[2]: Leaving directory `/export/home/users/munnik/software/
> postgresql-8.0.3/src/backend'
> gmake[1]: *** [all] Error 2
> gmake[1]: Leaving directory `/export/home/users/munnik/software/
> postgresql-8.0.3/src'
> gmake: *** [all] Error 2
>
> CFLAGS=-fast -xarch=amd64
> CPPFLAGS=-fast -xarch=amd64
>
> cc: Sun C 5.7 2005/01/07
> SunOS chet 5.10 Generic i86pc i386 i86pc
>
> 1st attempt
> ./configure --prefix=/opt/postgresql --without-readline
> 2nd attempt
> ./configure --prefix=/opt/postgresql --without-readline --disable-
> spinlocks
>
> any ideas?
>
> Martijn
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly

--

Conducive Technology Corporation
 Taking air cargo information
   to the next level

     http://www.conducivetech.com
      http://www.pathfinder-web.com

        Michael Crozier crozierm@conducivetech.com

          Voice: 503.445.4233
            Fax:   503.274.0939


Re: Compile with Solaris 10 AMD 64bit Sun CC

From
Tom Lane
Date:
Martijn de Munnik <martijndemunnik@gmail.com> writes:
> I'm trying to compile PostgreSQL 8.0.3 on a Sun Solaris 10 box, dual
> opteron and using the sun studio cc compiler. I get the following error;

It looks to me like we currently cover amd64 only for gcc.  Do you want
to roll up your sleeves and fix that, or is it easier just to use gcc?
If the former, look at:

src/include/storage/s_lock.h

    There's a chunk of code here that's
        #if defined(__sun) && defined(__i386)
    This probably needs to also allow whatever Sun's compiler
    defines as the CPU symbol for amd64.

src/backend/port/tas/solaris_i386.s

    It sounds like this contains code that is not quite
    syntactically right for amd64.  We manage to share code
    between i386 and amd64 for gcc, so maybe that's fixable;
    if not, you'll need to create a parallel file with the right
    assembler syntax for amd64.

src/template/solaris

    There's a "case $host" here that may need modification,
    especially if you decide you need a separate .s file.

It's worth your while to fix this, because the performance with
--disable-spinlocks will seriously suck.  If you do fix it,
please send in a patch.

            regards, tom lane