This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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: Building a Solaris cross compiler


> -----Original Message-----
> From: gcc-owner On Behalf Of Mark Cuss
> Sent: 27 May 2004 23:23

> I'm working on building a Solaris cross compiler on my Linux 
> machine.  

> 2)  Build gcc
> First, I do this to add the newly compiled binutils to my path:
> export PATH=$prefix/sparc-sun-solaris2.9:$PATH

  That's not quite right.  What you want is

export PATH=$prefix/bin:$PATH

  When you build binutils you get two versions of each application: one with
the target prefixed to it ($prefix/bin/sparc-sun-solaris2.9-as, for example)
and one without the target in the name, but located in a specialized
subdirectory ($prefix/sparc-sun-solaris2.9/bin/as in this case).

  You want the prefixed version to be in your $PATH so that the cross
compiler can find it.  You don't want the unprefixed versions in your $PATH
because then there's no way to specify which target-version of as gets
called.

> /tmp/ccQ2EJ2k.s: Assembler messages:
> /tmp/ccQ2EJ2k.s:8: Error: Unknown opcode: `pushl'
> /tmp/ccQ2EJ2k.s:9: Error: Illegal operands
> /tmp/ccQ2EJ2k.s:10: Error: Unknown opcode: `subl'
> /tmp/ccQ2EJ2k.s:11: Error: Unknown opcode: `andl'
> /tmp/ccQ2EJ2k.s:12: Error: Unknown opcode: `xorl'
> /tmp/ccQ2EJ2k.s:13: Error: Unknown opcode: `leave'
> *** The command '/usr/bin/gcc -o conftest -O2   conftest.c' failed.
> *** You must set the environment variable CC to a working compiler.

> root.  The
> permissions errors vanished, byt the unknown opcodes are still there.

> Any ideas?  As far as I know the gcc on the system is 
> fine....  

  Those are x86 opcodes.  The local compiler is being called to make the
cross compiler, it's generating assembly files, but then because you put the
(unprefixed) sparc assembler earlier in your $PATH than the x86 ones, the
sparc assembler tried to assemble the files for the x86->sparc cross
compiler.  Re-set your $PATH and try again and you should get there.

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


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