This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem creating cross compiler on x86 linux for target sparc solaris


Heiko Nardmann <h.nardmann@secunet.de> wrote:

> I am trying to create a cross compiler on x86 Linux for a SPARC Solaris 8.
> 
> After successfully building and installing binutils I got the whole include 
> and the whole lib directory from the native machine and put them where gcc 
> looks for them when trying to create the cross compiler.

 In which order ?  64-bit as default, 32-bit optional and it's stuff
in some subdir ?  Or vice versa ?

 A quick look at the 'gcc/config/sparc' and the 'sol2-64.h' there :

----------------------- clip --------------------------------------
 /* Definitions of target machine for GNU compiler, for bi-arch SPARC
   running Solaris 2, defaulting to 64-bit code generation.  */

#undef TARGET_DEFAULT
#define TARGET_DEFAULT \
  (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ + \
   MASK_STACK_BIAS + MASK_FPU + MASK_LONG_DOUBLE_128)
----------------------- clip --------------------------------------

tells that the 64-bit sparcv9 code could be the default (sounds
logical when the target name is 'sparcv9-...', or how ?)

> Now when doing make I finally get the following error message:
> 
> /opt/GNU-sparc-solaris-cross/sparcv9-solaris2.8/bin/ld: skipping incompatible 
> /opt/GNU-sparc-solaris-cross/sparcv9-solaris2.8/lib/libc.so when searching 
> for -lc

 If the 'libc.so' is the 32-bit one and linker wants 64-bit, you must
change the library order...

 A simple check using 'objdump -p' to look inside the shared
library normally tells what it is, a 32-bit or a 64-bit one:

----------------------- clip --------------------------------------
H:\usr\local\sparc-solaris2.7\lib>..\bin\objdump -p libc.so

libc.so:     file format elf32-sparc

Program Header:
----------------------- clip --------------------------------------

 My 2.7-version 'libc.so' definitely was a 32-bit library...

 So I think you simply "have mixed the apples and oranges" ;)
and the '/opt/GNU-sparc-solaris-cross/sparcv9-solaris2.8/lib/libc.so'
is a 32-bit library when it should be the 64-bit one...

> When searching the web for this error message I only found
> references to using '--disable-multilib' which I already tried as
> you can see from the configure call.

 If you do this, then you don't want to produce any 32-bit stuff...

 Is this what you really want ?  Or do you want to produce either
64-bit or 32-bit executables ?

 If you want 32-bit stuff as default, then using the target name
'sparc-solaris2.8' will provide this... Producing the alternative
32- or 64-bit stuff with the options:

----------------------- clip --------------------------------------
-m32
-m64 Generate code for a 32-bit or 64-bit environment. The 32-bit
     environment sets int, long and pointer to 32 bits. The 64-bit
     environment sets int to 32 bits and long and pointer to 64 bits.
----------------------- clip --------------------------------------

depending on the default should succeed... Ok, looking at the 't-sol2-
64' tells:

 MULTILIB_OPTIONS = m32/m64
 MULTILIB_DIRNAMES = sparcv7 sparcv9

the subdir name being 'sparcv7' in the 'sparcv9-solaris2.8' case and
'sparcv9' in the 'sparc-solaris2.8' case, ie. the 'alternative' 32-
bit or 64-bit libraries must be there.

 In your current case the default 64-bit stuff should be in:
  /opt/GNU-sparc-solaris-cross/sparcv9-solaris2.8/lib
and the alternative 32-bit stuff in:
  /opt/GNU-sparc-solaris-cross/sparcv9-solaris2.8/lib/sparcv7

 If using the target name 'sparc-solaris2.8', the '.../lib' should 
then have the 32-bit stuff and the '.../lib/sparcv9' the 64-bit 
stuff...

Cheers, Kai


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]