Solaris 10 x64 Compiling issues with Sun Studio 12

Hello, I’m having problems compiling Ruby 1.8.5 on a 64-bit Intel
machine running Solaris 10 U3.

I’m using Sun Studio 12 for building an optimized package for our
company. We’re not interested in coolstack (from Sun used with GCC).
Any help below would be appreciated:

root@host # uname -an
SunOS host 5.10 Generic_125101-08 i86pc i386 i86pc Solaris

root@host # isainfo -v
64-bit amd64 applications
cx16 mon sse3 pause sse2 sse fxsr mmx cmov amd_sysc cx8 tsc
fpu
32-bit i386 applications
cx16 mon sse3 pause sse2 sse fxsr mmx cmov sep cx8 tsc fpu

root@host # env
MANPATH=/opt/sfw/man:/usr/man:/usr/sfw/man
TERM=vt100
SHELL=/bin/bash
SSH_CLIENT=10.45.200.89 17993 22
OLDPWD=/root
SSH_TTY=/dev/pts/1
USER=root
MAIL=/usr/mail/root
PATH=/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/opt/sfw/bin:/opt/sfw/
sbin:/usr/sfw/bin:/usr/sfw/sbin:/usr/bin:/usr/sbin:/sbin
PWD=/root/ruby-1.8.6
EDITOR=/usr/bin/vi
LANG=POSIX
FCEDIT=/usr/bin/vi
TZ=US/Pacific
SHLVL=1
HOME=/root
LOGNAME=root
SSH_CONNECTION=10.45.200.89 17993 192.168.241.217 22
_=/opt/sfw/bin/env
root@host #

I’ve tried the various compiling options below (and various CFLAGS
with no luck)

Library Link Flags

#LIBS="-lfasttime"
#LD_PRELOAD_64=/usr/lib/amd64/libmtmalloc.so
LDFLAGS="-L/opt/yp/lib -R/opt/yp/lib -L/usr/sfw/lib/64 -R/usr/sfw/lib/
64 -L/usr/
sfw/lib -R/usr/sfw/lib -L/usr/lib/64 -R/usr/lib/64 -L/usr/lib -R/usr/
lib"

Compiler Flags

#CFLAGS="-m64 -xarch=sse2 -fns -fsimple=2 -fsingle -nofstore -
xalias_level=basic
-xbuiltin=%all -xdepend -xlibmil -xlibmopt -xO5 -xregs=frameptr -mt -
lpthread"

CXX=CC

#CXXFLAGS="-m64 -xarch=sse2 -fns -fsimple=2 -fsingle -nofstore -
xalias_level=bas
ic -xbuiltin=%all -xdepend -xlibmil -xlibmopt -xO5 -xregs=frameptr -mt
-lpthread
"

#CFLAGS="-fast -xarch=amd64"

#CXXFLAGS="-fast -xarch=amd64"

CFLAGS="-xtarget=opteron -xarch=amd64 -mt -fsimple=1 -ftrap=%none -
nofstore -xbuiltin=%all -xlibmil -xlibmopt -xregs=no%frameptr -KPIC"

Include Flags

CPPFLAGS="-I/opt/yp/include -I/opt/sfw/include -I/usr/sfw/include"

Export VARS

export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS

./configure --prefix=/opt/rb --bindir=/opt/yp/bin/64 --sbindir=/opt/yp/
sbin/64 -
-libexecdir=/opt/yp/libexec/64 --libdir=/opt/yp/lib/64 --enable-
pthread --withou
t-gcc

root@host # ./blah64.sh
checking build system type… i386-pc-solaris2.10
checking host system type… i386-pc-solaris2.10
checking target system type… i386-pc-solaris2.10
checking for gcc… cc
checking for C compiler default output file name…
configure: error: C compiler cannot create executables
See `config.log’ for more details.
root@host #

config.log shows the following

ld: fatal: dlopen() of support library (libldstab.so.1) failed with
error: ld.so
.1: ld: fatal: libldstab.so.1: open failed: No such file or directory
configure:2593: $? = 1
configure:2631: result:
configure: failed program was:
| /* confdefs.h. */

Thanks!