[Expat-discuss] Solaris 64bit Compile

Josh Martin Josh.Martin@abq.sc.philips.com
Wed Jun 5 17:01:07 2002


My first thought is that you aren't using the 64-bit linker.  However the sparc 
linker is both 32-bit and 64-bit.  Since there is no option to specify which 
mode to use, the linker uses the mode of the first object listed, in which case 
you may want to try the linking command with xmltok.lo listed first.

My second thought is that gcc might not be generating 64-bit code.  Since the 
linker seems to think the object file is ELFCLASS64, this seems unlikely, 
however you may want to add the SPARC V9 specific gcc option -m64 to ensure that 
it is generating code for a 64-bit environment.

Unfortunately all of the sparcs I work on either aren't 64-bit machines, or they 
refuse to run in 64-bit mode (long story), I cannot claim that either of these 
thoughts may be helpful.  Let me know if you figure out a way to get this to 
work for you.  Also do yourself a favor and make sure that the information 
displayed by 'ld -V' is the information you think it should be; it wouldn't be 
the first time someone forgot to update the linker when a file system was 
migrated to a different machine.

 - Josh Martin
 

> Hi,
> 
> I'm new to this list and I'm having problems compiling expat on a
> 
> Ultrasparc2 (64bit) Solaris2.8 machine.
> 
> I tried compiling with gcc -mcpu=v9 -Wa,--xarch=v9a
> 
> (the -Wa option is needed to tell the assembler the architecture
> otherwise I get assembler errors)
> 
> There aren't any problems compiling .c files.
> 
> But I'm having errors with ld.
> 
>  
> 
> ...
> 
> ...
> 
> gcc -DHAVE_CONFIG_H -DPACKAGE=\"expat\" -DVERSION=\"expat_1.95.2\" -I.
> -I. -I.. -mcpu=v9 -Wa,--xarch=v9a -g -O2 -Wall -Wmissing-prototypes
> -Wstrict-prototypes -fexceptions -c xmltok.c  -fPIC -DPIC -o
> .libs/xmltok.lo
> 
> gcc -DHAVE_CONFIG_H -DPACKAGE=\"expat\" -DVERSION=\"expat_1.95.2\" -I.
> -I. -I.. -mcpu=v9 -Wa,--xarch=v9a -g -O2 -Wall -Wmissing-prototypes
> -Wstrict-prototypes -fexceptions -c xmltok.c -o xmltok.o >/dev/null 2>&1
> 
> mv -f .libs/xmltok.lo xmltok.lo
> 
> /bin/sh ../libtool --mode=link  gcc -version-info 1:0:1 -mcpu=v9
> -Wa,--xarch=v9a -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes
> -fexceptions  -o libexpat.la -rpath /usr/local/lib  xmlparse.lo
> xmltok.lo xmlrole.lo
> 
> rm -fr .libs/libexpat.la .libs/libexpat.* .libs/libexpat.*
> 
> /usr/ccs/bin/ld -G -h libexpat.so.0 -o .libs/libexpat.so.0.1.0
> xmlparse.lo xmltok.lo xmlrole.lo  -lc 
> 
> ld: fatal: file xmltok.lo: wrong ELF class: ELFCLASS64
> 
>  
> 
> Does anyone how I can solve this?
> 
>  
> 
> Thanks ahead~!
> 
>  
> 
> -Jh Lee
> 
>  
>