building postgres issue on SUnStudio 12

Using SunStudio 12 on SLES9 on an opteron platform:

I run into a problem using spinlocks -see below. gsql-bugs responded : use gcc (see below). It does build fine under gcc, and will build under SS12 if I disable spinlocks as suggested. Is this an issue that the SunStudo development team can address? I am looking to see if rebuilding postgres using SS12 will improve DB performance.

Thanks.

from my request at pgsql-bugs:

"Len Zaifman" <leonardz@sickkids.ca> writes:

> The following error occuredbuilding Postgresql 8.2.4 on SLES 9 using SUN STUDIO 12 compilers

> sunstudio12/bin/cc -O -I../../../../src/include -D_GNU_SOURCE-c -o xlog.o xlog.c

> "../../../../src/include/storage/s_lock.h", line 810: #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.

By and large we don't try to support nonstandard compilers on Linux.

Use gcc.

[1092 byte] By [leonardz77a] at [2007-11-27 10:15:14]
# 1

s_lock.h file contains hardware-dependent implementation of spinlocks. It is done with help of inline assembler. As inline assembler differs among compilers, parts of the code in s_lock.h are under ifdef's for specific compilers. Sun Studio 12 supports GNU C inline asm syntax. So you can try to modify s_lock.h to enable using __GNUC__ parts of the code with Sun Studio compilers. For example, instead of

#if defined(__GNUC__) || defined(__ICC)

try

#if defined(__GNUC__) || defined(__ICC) || defined(__SUNPRO_C)

regards,

Dmitry

dmikha at 2007-7-28 15:38:17 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

gcc-style inline assembly is not fully implemented now, thus it may fail to compile.

I spot an #ifdef __sun branch in this header:

/* out-of-line assembler from src/backend/port/tas/foo.s */

#if defined(__sun) && defined(__i386)

/*

* Solaris/386 (we only get here for non-gcc case)

*/

#define HAS_TEST_AND_SET

Thus if you manage to tweak configuration to use that src/backend/port/tas/foo.s properly you can enable this branch by adding defined(__SUNPRO_C)

regards,

__Fedor.

SFVa at 2007-7-28 15:38:17 > top of Java-index,Development Tools,Solaris and Linux Development Tools...