FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 09-27-2010, 05:53 PM
 
Default How to compile for less bits :)

Hi,

I asking in beforehand, to prevent the search for spurious
unexplainable errors which may be hardly to detect.

For my microcontroller board (ATMEL AT81RM920, linux based) I want
to crosscompile kernels and applications on my 64bit Gentoo linux.
The source of a gcc (prepared on a 32bit system I fear) for the
purpose of crosscompiling from a 32bit system-- target is the above
mentioned processor -- is available.

Is it possible to compile this gcc as a 32bit-application on my 64bit
system to ensure the same behaviour as it would if ot was built on a
"original 32bit Gentoo Linux"?

(And in this context: The audio application "chuck" is only as 32bit
application available currently. How is it possible to compile this
on a 64bit system?)

Thank you very much in advance for any help!

Best regards
mcc
 
Old 09-27-2010, 06:52 PM
Grant Edwards
 
Default How to compile for less bits :)

On 2010-09-27, meino.cramer@gmx.de <meino.cramer@gmx.de> wrote:

> For my microcontroller board (ATMEL AT81RM920, linux based)

Do you mean AT91RM9200?

> I want to crosscompile kernels and applications on my 64bit Gentoo
> linux.

That's easy enough.

> The source of a gcc (prepared on a 32bit system I fear) for
> the purpose of crosscompiling from a 32bit system-- target is the
> above mentioned processor -- is available.
>
> Is it possible to compile this gcc as a 32bit-application on my 64bit
> system to ensure the same behaviour as it would if to was built on a
> "original 32bit Gentoo Linux"?

You want to compile gcc on an AMD64 machine and end up with a
cross-compiler that runs as an IA32 app and generates code for an ARM9
target?

That's called a "Canadian Cross", and is rather tricky, since it
involves three different architectures: building a compiler on
architecture A (AMD64) to be run on architecture B (IA32) and generate
code for architecture C (ARM9).

Can you explain why you want that rather than a normal cross compiler?

IOW, why do you want to build a gcc cross compiler that runs as a
32-bit application? It's _way_ simpler to build a "normal" cross
compiler: building a compiler one architecture (AMD64) to be run on
that same architecture (AMD64) and generate code for a second
architecture (ARM9).

> (And in this context: The audio application "chuck" is only as 32bit
> application available currently. How is it possible to compile this
> on a 64bit system?)

You use a compiler that generates code for a the desired 32-bit
architecture. The "width" of the host is immaterial.

The easiest way to build such a compiler is using crosstool-ng

http://ymorin.is-a-geek.org/projects/crosstool

Crosstool-NG does have some support for doing a Canadian-cross, but I
don't see why you would want to do that.

--
Grant Edwards grant.b.edwards Yow! Gibble, Gobble, we
at ACCEPT YOU ...
gmail.com
 
Old 09-29-2010, 05:19 PM
 
Default How to compile for less bits :)

Grant Edwards <grant.b.edwards@gmail.com> [10-09-27 21:16]:
> On 2010-09-27, meino.cramer@gmx.de <meino.cramer@gmx.de> wrote:
>
> > For my microcontroller board (ATMEL AT81RM920, linux based)
>
> Do you mean AT91RM9200?
>
> > I want to crosscompile kernels and applications on my 64bit Gentoo
> > linux.
>
> That's easy enough.
>
> > The source of a gcc (prepared on a 32bit system I fear) for
> > the purpose of crosscompiling from a 32bit system-- target is the
> > above mentioned processor -- is available.
> >
> > Is it possible to compile this gcc as a 32bit-application on my 64bit
> > system to ensure the same behaviour as it would if to was built on a
> > "original 32bit Gentoo Linux"?
>
> You want to compile gcc on an AMD64 machine and end up with a
> cross-compiler that runs as an IA32 app and generates code for an ARM9
> target?
>
> That's called a "Canadian Cross", and is rather tricky, since it
> involves three different architectures: building a compiler on
> architecture A (AMD64) to be run on architecture B (IA32) and generate
> code for architecture C (ARM9).
>
> Can you explain why you want that rather than a normal cross compiler?
>
> IOW, why do you want to build a gcc cross compiler that runs as a
> 32-bit application? It's _way_ simpler to build a "normal" cross
> compiler: building a compiler one architecture (AMD64) to be run on
> that same architecture (AMD64) and generate code for a second
> architecture (ARM9).
>
> > (And in this context: The audio application "chuck" is only as 32bit
> > application available currently. How is it possible to compile this
> > on a 64bit system?)
>
> You use a compiler that generates code for a the desired 32-bit
> architecture. The "width" of the host is immaterial.
>
> The easiest way to build such a compiler is using crosstool-ng
>
> http://ymorin.is-a-geek.org/projects/crosstool
>
> Crosstool-NG does have some support for doing a Canadian-cross, but I
> don't see why you would want to do that.
>
> --
> Grant Edwards grant.b.edwards Yow! Gibble, Gobble, we
> at ACCEPT YOU ...
> gmail.com
>
>

Hi Grant,

Thank you very much for your offered help!

Sorry, sorry I think my English confused a lot of infos...

I'll try it again.

Setup BEFORE I switched to 64bit Gentoo Linux.
* a "normal" system gcc as installed by emerge usually on many (all?) gentoo
systems...
* a "crosscompiling" gcc in source form. Compiled with the "normal"
gcc to an executable which runs on the 32bit Gentoo system and
produces executables/kernel to run on the ATMEL AT91RM9200 (yes,
you're right - this typo was mine ) .
* Additional "chuck" audio application only available for 32bit
Linux, also compiled with the "normal" gcc

Wanted setup on my shiny new 64bit Gentoo Linux:
* a "normal" system gcc as installed by emerge usually on many (all?) gentoo
systems... (==> already there and living quite well)
* a "crosscompiling" gcc in source form. To be Compiled with the "normal"
gcc to an executable which runs on the 64bit Gentoo system and
produces executables/kernel to run on the ATMEL AT91RM9200 (yes,
you're right - this typo was mine ) .
OR: compiled to be an 32bit gcc-executable which generate executable
binaries for my ATMEL cookie.
As long a 64bit-executable of gcc can do the job I would prefer that
solution of course.
* Additional "chuck" audio application only available for 32bit
Linux, to be compiled with the "normal" gcc to be a 32 bit
executable since not 64bit-ready.

I hope not to have made too much knots into that above...

Best regards
mcc
 
Old 09-29-2010, 07:48 PM
Grant Edwards
 
Default How to compile for less bits :)

On 2010-09-29, meino.cramer@gmx.de <meino.cramer@gmx.de> wrote:

>> > (And in this context: The audio application "chuck" is only as 32bit
>> > application available currently. How is it possible to compile this
>> > on a 64bit system?)
>>
>> You use a compiler that generates code for a the desired 32-bit
>> architecture. The "width" of the host is immaterial.

> Thank you very much for your offered help!
>
> Sorry, sorry I think my English confused a lot of infos...

Cross-building stuff is just plain confusing.

> I'll try it again.
>
> Setup BEFORE I switched to 64bit Gentoo Linux.
> * a "normal" system gcc as installed by emerge usually on many (all?) gentoo
> systems...
> * a "crosscompiling" gcc in source form. Compiled with the "normal"
> gcc to an executable which runs on the 32bit Gentoo system and
> produces executables/kernel to run on the ATMEL AT91RM9200 (yes,
> you're right - this typo was mine ).
> * Additional "chuck" audio application only available for 32bit
> Linux, also compiled with the "normal" gcc
>
> Wanted setup on my shiny new 64bit Gentoo Linux:
> * a "normal" system gcc as installed by emerge usually on many (all?) gentoo
> systems... (==> already there and living quite well)
> * a "crosscompiling" gcc in source form. To be Compiled with the "normal"
> gcc to an executable which runs on the 64bit Gentoo system and
> produces executables/kernel to run on the ATMEL AT91RM9200 (yes,
> you're right - this typo was mine ) .

All you need to do is build a cross compiler for the ARM9 target the
same way you did before. The width of the host where you're building
things doesn't matter (if it does, that's a bug in gcc or binutils).

I've had excellent results using the crosstool-ng makefile:

http://ymorin.is-a-geek.org/projects/crosstool

Crosstool is used by a lot of embedded developers. If there were
problems building an ARM comiler on an AMD64 host, Yann Morin et al.
are your best bet for a solution. You may want to take a look at the
crossgcc mailing list:

http://news.gmane.org/gmane.comp.gcc.cross-compiling
http://sourceware.org/ml/crossgcc/

From a brief search of the mailing list, it appears that building an
ARM compiler on an AMD64 machines works just fine.

or,

It's quite likely that you can install IA32 libraries on your AMD64
host OS and then use the exact same compiler executable you used
before.

> OR: compiled to be an 32bit gcc-executable which generate
> executable binaries for my ATMEL cookie. As long a 64bit-executable
> of gcc can do the job I would prefer that solution of course.

You really don't want to do that. It's rather tricky, and it
shouldn't be required.

> * Additional "chuck" audio application only available for 32bit
> Linux, to be compiled with the "normal" gcc to be a 32 bit
> executable since not 64bit-ready.

Just use the arm-linux-gcc compiler and you should be fine regardless
of the width of the host on which you built the arm-linux-gcc
compiler.

--
Grant Edwards grant.b.edwards Yow! It's the RINSE CYCLE!!
at They've ALL IGNORED the
gmail.com RINSE CYCLE!!
 
Old 09-29-2010, 11:00 PM
 
Default How to compile for less bits :)

Grant Edwards <grant.b.edwards@gmail.com> [10-09-30 00:32]:
> On 2010-09-29, meino.cramer@gmx.de <meino.cramer@gmx.de> wrote:
>
> >> > (And in this context: The audio application "chuck" is only as 32bit
> >> > application available currently. How is it possible to compile this
> >> > on a 64bit system?)
> >>
> >> You use a compiler that generates code for a the desired 32-bit
> >> architecture. The "width" of the host is immaterial.
>
> > Thank you very much for your offered help!
> >
> > Sorry, sorry I think my English confused a lot of infos...
>
> Cross-building stuff is just plain confusing.
>
> > I'll try it again.
> >
> > Setup BEFORE I switched to 64bit Gentoo Linux.
> > * a "normal" system gcc as installed by emerge usually on many (all?) gentoo
> > systems...
> > * a "crosscompiling" gcc in source form. Compiled with the "normal"
> > gcc to an executable which runs on the 32bit Gentoo system and
> > produces executables/kernel to run on the ATMEL AT91RM9200 (yes,
> > you're right - this typo was mine ).
> > * Additional "chuck" audio application only available for 32bit
> > Linux, also compiled with the "normal" gcc
> >
> > Wanted setup on my shiny new 64bit Gentoo Linux:
> > * a "normal" system gcc as installed by emerge usually on many (all?) gentoo
> > systems... (==> already there and living quite well)
> > * a "crosscompiling" gcc in source form. To be Compiled with the "normal"
> > gcc to an executable which runs on the 64bit Gentoo system and
> > produces executables/kernel to run on the ATMEL AT91RM9200 (yes,
> > you're right - this typo was mine ) .
>
> All you need to do is build a cross compiler for the ARM9 target the
> same way you did before. The width of the host where you're building
> things doesn't matter (if it does, that's a bug in gcc or binutils).
>
> I've had excellent results using the crosstool-ng makefile:
>
> http://ymorin.is-a-geek.org/projects/crosstool
>
> Crosstool is used by a lot of embedded developers. If there were
> problems building an ARM comiler on an AMD64 host, Yann Morin et al.
> are your best bet for a solution. You may want to take a look at the
> crossgcc mailing list:
>
> http://news.gmane.org/gmane.comp.gcc.cross-compiling
> http://sourceware.org/ml/crossgcc/
>
> From a brief search of the mailing list, it appears that building an
> ARM compiler on an AMD64 machines works just fine.
>
> or,
>
> It's quite likely that you can install IA32 libraries on your AMD64
> host OS and then use the exact same compiler executable you used
> before.
>
> > OR: compiled to be an 32bit gcc-executable which generate
> > executable binaries for my ATMEL cookie. As long a 64bit-executable
> > of gcc can do the job I would prefer that solution of course.
>
> You really don't want to do that. It's rather tricky, and it
> shouldn't be required.
>
> > * Additional "chuck" audio application only available for 32bit
> > Linux, to be compiled with the "normal" gcc to be a 32 bit
> > executable since not 64bit-ready.
>
> Just use the arm-linux-gcc compiler and you should be fine regardless
> of the width of the host on which you built the arm-linux-gcc
> compiler.
>
> --
> Grant Edwards grant.b.edwards Yow! It's the RINSE CYCLE!!
> at They've ALL IGNORED the
> gmail.com RINSE CYCLE!!
>
>

Hi Grant,

thank you very much for your help again !
Life on planet AMD64 becomes easier

One question remains open to me:
* How can I build 32bit applicationa to run on a 64bit Gentoo Linux
(I have both /lib32 and /lib64 and /usr/lib32 and /usr/lib64)
with the "normal" gcc (64 bit executable) on the 64bit Gentoo Linux.
Is this trick possible?
("Chuck" is not 64bit ready...)

Thank you very much for your help in advance!
Best regards,
mcc
 
Old 09-29-2010, 11:46 PM
Jacob Todd
 
Default How to compile for less bits :)

Cross compiling on unix is confusing because the compiler sucks.


On Sep 29, 2010 3:50 PM, "Grant Edwards" <grant.b.edwards@gmail.com> wrote:
On 2010-09-29, meino.cramer@gmx.de <meino.cramer@gmx.de> wrote:


>> > (And in this context: The aud...

> Thank you very much for your offered help!
>
> Sorry, sorry I think my English confused a lot of i...
Cross-building stuff is just plain confusing.




> I'll try it again.
>
> Setup BEFORE I switched to 64bit Gentoo Linux.
> * a "normal" system gcc a...
All you need to do is build a cross compiler for the ARM9 target the


same way you did before. *The width of the host where you're building

things doesn't matter (if it does, that's a bug in gcc or binutils).



I've had excellent results using the crosstool-ng makefile:



http://ymorin.is-a-geek.org/projects/crosstool

Crosstool is used by a lot of embedded developers. If there were


problems building an ARM comiler on an AMD64 host, Yann Morin et al.

are your best bet for a solution. *You may want to take a look at the

crossgcc mailing list:



* http://news.gmane.org/gmane.comp.gcc.cross-compiling

* http://sourceware.org/ml/crossgcc/



From a brief search of the mailing list, it appears that building an

ARM compiler on an AMD64 machines works just fine.



or,



It's quite likely that you can install IA32 libraries on your AMD64

host OS and then use the exact same compiler executable you used

before.



> OR: compiled to be an 32bit gcc-executable which generate
> executable binaries for my ATMEL ...
You really don't want to do that. *It's rather tricky, and it


shouldn't be required.



> * Additional "chuck" audio application only available for 32bit
> Linux, to be compiled with th...
Just use the arm-linux-gcc compiler and you should be fine regardless


of the width of the host on which you built the arm-linux-gcc

compiler.



--

Grant Edwards * * * * * * * grant.b.edwards * * * *Yow! It's the RINSE CYCLE!!

* * * * * * * * * * * * * * * * *at * * * * * * * They've ALL IGNORED the

* * * * * * * * * * * * * * *gmail.com * * * * * *RINSE CYCLE!!
 
Old 09-30-2010, 12:08 AM
Grant Edwards
 
Default How to compile for less bits :)

On 2010-09-29, meino.cramer@gmx.de <meino.cramer@gmx.de> wrote:

> One question remains open to me:
> * How can I build 32bit applicationa to run on a 64bit Gentoo Linux
> (I have both /lib32 and /lib64 and /usr/lib32 and /usr/lib64)
> with the "normal" gcc (64 bit executable) on the 64bit Gentoo Linux.
> Is this trick possible?
> ("Chuck" is not 64bit ready...)

That I don't know.

I thought you wanted to build chuck for the ARM target.

--
Grant
 
Old 09-30-2010, 12:10 AM
Grant Edwards
 
Default How to compile for less bits :)

On 2010-09-29, Jacob Todd <jaketodd422@gmail.com> wrote:

> Cross compiling on unix is confusing because the compiler sucks.

We're all looking forward to the better one that you're writing.

[I admine that gcc has its warts, but you evidently haven't dealt with
some of the compilers I have.]

--
Grant
 
Old 09-30-2010, 02:56 AM
Jacob Todd
 
Default How to compile for less bits :)

There's already great cross compilers on plan 9. No need to write a new one.


On Sep 29, 2010 8:15 PM, "Grant Edwards" <grant.b.edwards@gmail.com> wrote:> On 2010-09-29, Jacob Todd <jaketodd422@gmail.com> wrote:

>
>> Cross compiling on unix is confusing because the compiler sucks.
>
> We're all looking forward to the better one that you're writing.
>
> [I admine that gcc has its warts, but you evidently haven't dealt with

> some of the compilers I have.]
>
> --
> Grant
>
>
>
>
>
 
Old 09-30-2010, 02:01 PM
James
 
Default How to compile for less bits :)

Jacob Todd <jaketodd422 <at> gmail.com> writes:


> Cross compiling on unix is confusing because the compiler sucks.
(hmmm, nope you are wrong, and statements like that will get
you little help....imho

http://www.gentoo.org/proj/en/base/embedded/handbook/

Some wizards of cross_compiling hang out on gentoo-embedded....
Display excellent manners and you may get help, real help......

hth,
James
 

Thread Tools




All times are GMT. The time now is 12:12 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org