I'm trying to create a 64bit executable on Solaris, but I get the following:

cc: Warning: illegal option -xarch=v9ld: fatal: file /app/home/db2inst1/sqllib/lib/libdb2.so: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to get_sp_sql

It creates a 32bit .o, but fails when it tries to link with db2. Any ideas why this is occurring?

/app/home/db2inst1/scripts/c_program/tools> uname -a
SunOS njs75d-0004 5.8 Generic_117000-05 sun4u sparc SUNW,Netra-T12
/app/home/db2inst1/scripts/c_program/tools> db2level
DB21085I Instance "db2inst1" uses "64" bits and DB2 code release "SQL08022"
with level identifier "03030106".
Informational tokens are "DB2 v8.1.0.89", "special_15295", "U800790_15295", and
FixPak "9".
Product is installed at "/opt/IBM/db2/V8.1".