Problem compiling and running clang in sunos 5.10

Hi,
I am trying to compile clang on sunos 5.10 with gcc 4.5.1
I configure with

CC=gcc CXX=g++ LDFLAGS=" -lrt" …/configure --prefix=/project/scratch/packages2 --enable-optimized

the configuration runs fine and then I start make which stops with the error:

make[2]: Entering directory /project/scratch/tmp/llvm-3.2.src/build/tools/opt' llvm[2]: Linking Release+Asserts executable opt (without symbols) g++ -I/project/scratch/tmp/llvm-3.2.src/build/include -I/project/scratch/tmp/llvm-3.2.src/build/tools/opt -I/project/scratch/tmp/llvm-3.2.src/include -I/project/scratch/tmp/llvm-3.2.src/tools/opt -D_DEBUG -include llvm/Support/Solaris.h -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fomit-frame-pointer -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual -O3 -Wl,-R -Wl,'$ORIGIN/../lib' -Wl,-R -Wl,/project/scratch/tmp/llvm-3.2.src/build/Release+Asserts/bin -L/project/scratch/tmp/llvm-3.2.src/build/Release+Asserts/lib -L/project/scratch/tmp/llvm-3.2.src/build/Release+Asserts/lib -lrt -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -o /project/scratch/tmp/llvm-3.2.src/build/Release+Asserts/bin/opt /project/scratch/tmp/llvm-3.2.src/build/tools/opt/Release+Asserts/AnalysisWrappers.o /project/scratch/tmp/llvm-3.2.src/build/tools/opt/Release+Asserts/GraphPrinters.o /project/scratch/tmp/llvm-3.2.src/build/tools/opt/Release+Asserts/PrintSCC.o /project/scratch/tmp/llvm-3.2.src/build/tools/opt/Release+Asserts/opt.o \ -lLLVMHexagonCodeGen -lLLVMHexagonDesc -lLLVMHexagonAsmPrinter -lLLVMHexagonInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMBlazeCodeGen -lLLVMMBlazeAsmParser -lLLVMMBlazeDisassembler -lLLVMMBlazeDesc -lLLVMMBlazeAsmPrinter -lLLVMMBlazeInfo -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430AsmPrinter -lLLVMMSP430Info -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMCellSPUCodeGen -lLLVMCellSPUDesc -lLLVMCellSPUInfo -lLLVMMipsAsmParser -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsDesc -lLLVMMipsAsmPrinter -lLLVMMipsInfo -lLLVMARMAsmParser -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMX86AsmParser -lLLVMX86Disassembler -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMipo -lLLVMVectorize -lLLVMScalarOpts -lLLVMInstCombine -lLLVMInstrumentation -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMAsmParser -lLLVMBitWriter -lLLVMBitReader -lLLVMCore -lLLVMSupport -lpthread -lmalloc -lm ld: elf error: file /project/scratch/tmp/llvm-3.2.src/build/Release+Asserts/lib/libLLVMNVPTXAsmPrinter.a: elf_getarsym ld: elf error: file /project/scratch/tmp/llvm-3.2.src/build/Release+Asserts/lib/libLLVMNVPTXAsmPrinter.a: elf_getarsym ld: fatal: File processing errors. No output written to /project/scratch/tmp/llvm-3.2.src/build/Release+Asserts/bin/opt collect2: ld returned 1 exit status make[2]: *** [/project/scratch/tmp/llvm-3.2.src/build/Release+Asserts/bin/opt] Error 1 make[2]: Leaving directory /project/scratch/tmp/llvm-3.2.src/build/tools/opt’
make[1]: *** [opt/.makeall] Error 2
make[1]: Leaving directory `/project/scratch/tmp/llvm-3.2.src/build/tools’
make: *** [all] Error 1

then I created a dummy.c file:

int dummy(void)
{
return 0;
}

and used gcc -c dummy.c. After that I used the command

ar cr /project/scratch/tmp/llvm-3.2.src/build/Release+Asserts/lib/libLLVMNVPTXAsmPrinter.a NVPTXInstPrinter.o dummy.o

then I can finish the compilation but when trying to install I get the error:

if test -d “/project/scratch/tmp/llvm-3.2.src/tools/clang/include/clang-c” ; then
cd /project/scratch/tmp/llvm-3.2.src/tools/clang/include/clang-c/… &&
for hdr in `find clang-c -type f ‘!’ ‘(’ -name ‘~’
-o -name '.#
’ -o -name ‘.in’ -o -name '.txt’
-o -name ‘Makefile’ -o -name ‘*.td’ ‘)’ -print \

grep -v CVS | grep -v .svn | grep -v .dir ; do \ instdir=dirname "/project/scratch/packages2/include/$hdr"; \ if test \! -d "$instdir" ; then \ echo llvm[4]: Making install directory $instdir ; \ /project/scratch/tmp/llvm-3.2.src/autoconf/mkinstalldirs $instdir ;\ fi ; \ /project/aircrews/packages/sun/5.10/x86/gnu/bin/install -c -m 0644 $hdr /project/scratch/packages2/include/$hdr ; \ done ; \ fi if test -d "/project/scratch/tmp/llvm-3.2.src/build/tools/clang/include/clang-c" ; then \ cd /project/scratch/tmp/llvm-3.2.src/build/tools/clang/include && \ for hdr infind clang-c -type f ‘!’ ‘(’ -name ‘Makefile’ ‘)’ -print
grep -v CVS | grep -v .tmp | grep -v .dir ; do \ instdir=dirname “/project/scratch/packages2/include/$hdr”; \ if test \! -d "$instdir" ; then \ echo llvm[4]: Making install directory $instdir ; \ /project/scratch/tmp/llvm-3.2.src/autoconf/mkinstalldirs $instdir ;\ fi ; \ /project/aircrews/packages/sun/5.10/x86/gnu/bin/install -c -m 0644 $hdr /project/scratch/packages2/include/$hdr ; \ done ; \ fi make[4]: *** [install-local] Error 1 make[4]: Leaving directory/project/scratch/tmp/llvm-3.2.src/build/tools/clang/include/clang-c’
make[3]: *** [install] Error 1
make[3]: Leaving directory /project/scratch/tmp/llvm-3.2.src/build/tools/clang/include' make[2]: *** [install] Error 1 make[2]: Leaving directory /project/scratch/tmp/llvm-3.2.src/build/tools/clang’
make[1]: *** [clang/.makeinstall] Error 2
make[1]: Leaving directory `/project/scratch/tmp/llvm-3.2.src/build/tools’
make: *** [install] Error 1

the binaries get copied to the install location but trying to run clang on simple hello world x.c gives:
clang x.c
/project/scratch/packages2/bin/ld: unrecognized option ‘-C’
/project/scratch/packages2/bin/ld: use the --help option for usage information
clang: error: linker command failed with exit code 1 (use -v to see invocation)

with -v gives

clang -v x.c
clang version 3.2 (tags/RELEASE_32/final)
Target: i386-pc-solaris2.10
Thread model: posix
“/project/scratch/packages2/bin/clang” -cc1 -triple i386-pc-solaris2.10 -emit-obj -mrelax-all -disable-free -main-file-name x.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -target-linker-version 2.22 -momit-leaf-frame-pointer -v -resource-dir /project/scratch/packages2/bin/…/lib/clang/3.2 -fmodule-cache-path /var/tmp/clang-module-cache -fdebug-compilation-dir /project/scratch/tmp/llvm-3.2.src/build -ferror-limit 19 -fmessage-length 141 -mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/x-DFaGiy.o -x c x.c
clang -cc1 version 3.2 based upon LLVM 3.2svn default target i386-pc-solaris2.10
ignoring nonexistent directory “/usr/local/include”
#include “…” search starts here:
#include <…> search starts here:
/project/scratch/packages2/bin/…/lib/clang/3.2/include
/usr/include
End of search list.
“/project/scratch/packages2/bin/ld” -C -e _start -Bdynamic --dynamic-linker /usr/lib/ld.so.1 -o a.out /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/values-Xa.o /usr/gcc/4.5/lib/gcc/i386-pc-solaris2.10/4.5.2/crtbegin.o -L/usr/gcc/4.5/lib/gcc/i386-pc-solaris2.10/4.5.2/ /tmp/x-DFaGiy.o -lgcc_s -lgcc -lc -lm /usr/gcc/4.5/lib/gcc/i386-pc-solaris2.10/4.5.2/crtend.o /usr/lib/crtn.o
/project/scratch/packages2/bin/ld: unrecognized option ‘-C’
/project/scratch/packages2/bin/ld: use the --help option for usage information
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Initially the system had ld 2.22 and I even compiled ld 2.23

ld --version

GNU ld (GNU Binutils) 2.23

but it still complains about the -C option not being recognized.

Any idea what I can do to make it work?

Thanks!