Optimized math library on Linux AMD64

I have a problem linking with the optimized math library using Sun Studio 12 on Linux with an AMD64 processor. It complains that the pow() function depends on a missing symbol, which I believe comes from the C runtime.

This problem does not occur if I am using the regular math library, or the 32-bit optimized math library.

Any suggestions for further troubleshooting or incantations needed to remedy will be appreciated.

To reproduce the problem:

$ cat missing.f

program PowIsMissing

double precision a,b

read*,a

b=a**a

print*,b

end

$ f90 missing.f# fine

$ linux32 f90 -xlibmopt missing.f# fine, too

$ f90 -xlibmopt missing.f# native AMD64

/opt/sun/sunstudio12/prod/lib/amd64/libmopt.a(f_pow.o): In function `pow':

f_pow.c:(.text+0x7aa): undefined reference to `__xpg6'

f_pow.c:(.text+0x8e6): undefined reference to `__xpg6'

[933 byte] By [Roland_Kaufmanna] at [2007-11-27 11:41:50]
# 1

Yes, this is a bug. I've filed BugId 6585333 which you should soon be able to see

at bugs.sun.com

Sorry, I don't think there is a work-around.

-Jeremy

jeremyweeka at 2007-7-29 17:40:35 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

Actually, by browsing some of the OpenSolaris libc code (go open source!) at:

http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen /xpg6.c

I was able to work around the problem by adding the following to my make file:

[code]

xpg6.c:

echo unsigned int __xpg6 = 0xFFFF0000\; > $@

xpg6.o: xpg6.c

suncc -c $< -o $@

[/code]

And then linking with this module:

f90 -xlibmopt missing.f xpg6.o # no error

Roland_Kaufmanna at 2007-7-29 17:40:35 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

Yep, thats the way to fix that.

Btw, as per http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/inc/xpg6 .h:

#define_C99SUSv3_mode_OFF0xFFFF0000

This setting for __xpg6 turns C99/SUSv3 compatibility mode off. Which might be expected for Solaris (which is SUSv2 compatible by default), but not for your given Linux. Not that we can do anything in this regard.

regards,

__Fedor.

SFVa at 2007-7-29 17:40:35 > top of Java-index,Development Tools,Solaris and Linux Development Tools...