This is the mail archive of the crossgcc@sourceware.org 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: [discuss] Problem building cross compiler for x86_64


On Fri, Jan 20, 2006 at 04:43:58PM +0530, Manish Katiyar wrote:
> Hello friends,
>       I successfully created a compiler using crosstool by Dan Kegel
> for a 64 bit machine. Using the new built compiler I am able to create
> binaries on 32 bit machine which run successfully on a 64 bit machine
> but not 32 bit.
> However when I copied my x86_64-unknown-linux-gnu-gcc to the 64 bit
> machine and tried to compile a simple hello world program I got errror
> as
> 
> SLESAMD64:/tmp # ./x86_64-unknown-linux-gnu-gcc -o manish temp.c
> x86_64-unknown-linux-gnu-gcc: installation problem, cannot exec `cc1':
> No such file or directory
> 
> Doing a strace on that binary file showed me that this is a 32 bit
> file :-( . Have I made mistake anywhere?. I wanted to build a compiler
> on 32 bit machine which can be copied/packaged on a 64 bit machine and
> compile successfully but it seems I have made a compiler which will
> run on a 32 bit machine and create binaries for 64 bit machine. Please
> help I dont understand what to do.

The point of a "cross compiler" is that the "host" and "build"
system are different.  In your case host seems to be a 32 bit
i386, and build is x86_64/amd64.  This means all your compiler
exectutables are 32 bit, but they generate 64 bit code.  So this
far everything seems to be as it should.

Now with x86_64 and i386 we have a special combination in that
the x86_64 kernel can also run i386 executables.  Why do you
generate a cross compiler for 64 bit mode on a 32 bit host system
if you want to run it on a 64 bit host anyway?

I also don't see why someone would still like to create a cross
compiler for this.

Also note that gcc can actually build a biarch compiler, one that
can generate both 32 and 64 bit code depending on the -m32 or
-m64 switch.

> SLESAMD64:/tmp # strace ./x86_64-unknown-linux-gnu-gcc
> execve("./x86_64-unknown-linux-gnu-gcc",
> ["./x86_64-unknown-linux-gnu-gcc"], [/* 51 vars */]) = 0
> [ Process PID=21560 runs in 32 bit mode. ]
> x86_64-unknown-linux-gnu-gcc: no input files

This strace doesn't tell much, since it just generates an error
message, it doesn't explain why it can't find cc1.

There can be various problems, such as it really can't find the
location of cc1.  That it's looking for cc1 with the wrong name,
like it's looking for something called
x86_64-unknown-linux-gnu-cc1 while it's really called
x86_64-unknown-gnu-cc1 or something, looking in a different path
than where it is, which you can work around with the -B switch,
and things like that.



Kurt


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


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