public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] 32bit-Executables on a AMD64 system...
@ 2010-11-09 17:25 meino.cramer
  2010-11-09 17:31 ` Jarry
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: meino.cramer @ 2010-11-09 17:25 UTC (permalink / raw
  To: Gentoo

Hi,

it is possible to run a 32-bit binary executable on a 64-bit system
(AMD64).


But: Is it possible to compile source code on a 64-bit system and get
an 32-bit executable a the result ??? And if 'yes'...how???

Thank you very much for any help in advance!

Best regards,
mcc




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-09 17:25 [gentoo-user] 32bit-Executables on a AMD64 system meino.cramer
@ 2010-11-09 17:31 ` Jarry
  2010-11-09 17:39   ` meino.cramer
  2010-11-09 17:37 ` Maciej Grela
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 15+ messages in thread
From: Jarry @ 2010-11-09 17:31 UTC (permalink / raw
  To: gentoo-user

On 9. 11. 2010 18:25, meino.cramer@gmx.de wrote:

> But: Is it possible to compile source code on a 64-bit system and get
> an 32-bit executable a the result ??? And if 'yes'...how???

I think that is what "cross-compilation" is good for...

Jarry

-- 
_______________________________________________________________
This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-09 17:25 [gentoo-user] 32bit-Executables on a AMD64 system meino.cramer
  2010-11-09 17:31 ` Jarry
@ 2010-11-09 17:37 ` Maciej Grela
  2010-11-09 17:45   ` meino.cramer
  2010-11-09 17:48   ` meino.cramer
  2010-11-10  6:59 ` Coert Waagmeester
  2010-11-12 19:50 ` Volker Armin Hemmann
  3 siblings, 2 replies; 15+ messages in thread
From: Maciej Grela @ 2010-11-09 17:37 UTC (permalink / raw
  To: gentoo-user

2010/11/9  <meino.cramer@gmx.de>:
> Hi,
>
> it is possible to run a 32-bit binary executable on a 64-bit system
> (AMD64).
>
>
> But: Is it possible to compile source code on a 64-bit system and get
> an 32-bit executable a the result ??? And if 'yes'...how???
>

grela@kraken ~ $ cat test.c
void main() {}
grela@kraken ~ $ gcc -o a.out.64 test.c
grela@kraken ~ $ gcc -m32 -o a.out.32 test.c
grela@kraken ~ $ file a.out.*
a.out.32: ELF 32-bit LSB executable, Intel 80386, version 1
(GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux
2.6.9, not stripped
a.out.64: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux),
dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not
stripped
grela@kraken ~ $

Br,
Maciej Grela



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-09 17:31 ` Jarry
@ 2010-11-09 17:39   ` meino.cramer
  2010-11-09 17:55     ` Jacob Todd
  2010-11-10 21:55     ` Enrico Weigelt
  0 siblings, 2 replies; 15+ messages in thread
From: meino.cramer @ 2010-11-09 17:39 UTC (permalink / raw
  To: gentoo-user

Jarry <mr.jarry@gmail.com> [10-11-09 18:36]:
> On 9. 11. 2010 18:25, meino.cramer@gmx.de wrote:
> 
> >But: Is it possible to compile source code on a 64-bit system and get
> >an 32-bit executable a the result ??? And if 'yes'...how???
> 
> I think that is what "cross-compilation" is good for...
> 
> Jarry
> 
> -- 
> _______________________________________________________________
> This mailbox accepts e-mails only from selected mailing-lists!
> Everything else is considered to be spam and therefore deleted.
> 

Is there a toolchain already setup for cross-compiling 32-bit
executables on a AMD64 system, or do I have to do all that cross-
compiling magic by myself ?

Best regards,
mcc




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-09 17:37 ` Maciej Grela
@ 2010-11-09 17:45   ` meino.cramer
  2010-11-10 21:57     ` Enrico Weigelt
  2010-11-09 17:48   ` meino.cramer
  1 sibling, 1 reply; 15+ messages in thread
From: meino.cramer @ 2010-11-09 17:45 UTC (permalink / raw
  To: gentoo-user

Maciej Grela <maciej.grela@gmail.com> [10-11-09 18:40]:
> 2010/11/9  <meino.cramer@gmx.de>:
> > Hi,
> >
> > it is possible to run a 32-bit binary executable on a 64-bit system
> > (AMD64).
> >
> >
> > But: Is it possible to compile source code on a 64-bit system and get
> > an 32-bit executable a the result ??? And if 'yes'...how???
> >
> 
> grela@kraken ~ $ cat test.c
> void main() {}
> grela@kraken ~ $ gcc -o a.out.64 test.c
> grela@kraken ~ $ gcc -m32 -o a.out.32 test.c
> grela@kraken ~ $ file a.out.*
> a.out.32: ELF 32-bit LSB executable, Intel 80386, version 1
> (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux
> 2.6.9, not stripped
> a.out.64: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux),
> dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not
> stripped
> grela@kraken ~ $
> 
> Br,
> Maciej Grela
> 

Oh YEAH! That's a definition of "straight forward I do like very much!
Thanks a lot, Maciej! You saved me a lot of half defunct bits ! ;)

Best regards,
mcc




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-09 17:37 ` Maciej Grela
  2010-11-09 17:45   ` meino.cramer
@ 2010-11-09 17:48   ` meino.cramer
  1 sibling, 0 replies; 15+ messages in thread
From: meino.cramer @ 2010-11-09 17:48 UTC (permalink / raw
  To: gentoo-user

Maciej Grela <maciej.grela@gmail.com> [10-11-09 18:40]:
> 2010/11/9  <meino.cramer@gmx.de>:
> > Hi,
> >
> > it is possible to run a 32-bit binary executable on a 64-bit system
> > (AMD64).
> >
> >
> > But: Is it possible to compile source code on a 64-bit system and get
> > an 32-bit executable a the result ??? And if 'yes'...how???
> >
> 
> grela@kraken ~ $ cat test.c
> void main() {}
> grela@kraken ~ $ gcc -o a.out.64 test.c
> grela@kraken ~ $ gcc -m32 -o a.out.32 test.c
> grela@kraken ~ $ file a.out.*
> a.out.32: ELF 32-bit LSB executable, Intel 80386, version 1
> (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux
> 2.6.9, not stripped
> a.out.64: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux),
> dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not
> stripped
> grela@kraken ~ $
> 
> Br,
> Maciej Grela
> 

Sorry a little offtopic, but: There is kinda nonsense-humor of 
gcc in you lines. To call a program, which only consists of "void main() {}",
to be "non stripped" is - at least - "british understatement" (no
punt intended!) :) ;) X-}

Best regards,
mcc





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-09 17:39   ` meino.cramer
@ 2010-11-09 17:55     ` Jacob Todd
  2010-11-10 21:55     ` Enrico Weigelt
  1 sibling, 0 replies; 15+ messages in thread
From: Jacob Todd @ 2010-11-09 17:55 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 783 bytes --]

Crosstools
On Nov 9, 2010 12:39 PM, <meino.cramer@gmx.de> wrote:
> Jarry <mr.jarry@gmail.com> [10-11-09 18:36]:
>> On 9. 11. 2010 18:25, meino.cramer@gmx.de wrote:
>>
>> >But: Is it possible to compile source code on a 64-bit system and get
>> >an 32-bit executable a the result ??? And if 'yes'...how???
>>
>> I think that is what "cross-compilation" is good for...
>>
>> Jarry
>>
>> --
>> _______________________________________________________________
>> This mailbox accepts e-mails only from selected mailing-lists!
>> Everything else is considered to be spam and therefore deleted.
>>
>
> Is there a toolchain already setup for cross-compiling 32-bit
> executables on a AMD64 system, or do I have to do all that cross-
> compiling magic by myself ?
>
> Best regards,
> mcc
>
>

[-- Attachment #2: Type: text/html, Size: 1209 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-09 17:25 [gentoo-user] 32bit-Executables on a AMD64 system meino.cramer
  2010-11-09 17:31 ` Jarry
  2010-11-09 17:37 ` Maciej Grela
@ 2010-11-10  6:59 ` Coert Waagmeester
  2010-11-10 19:25   ` meino.cramer
  2010-11-10 21:59   ` Enrico Weigelt
  2010-11-12 19:50 ` Volker Armin Hemmann
  3 siblings, 2 replies; 15+ messages in thread
From: Coert Waagmeester @ 2010-11-10  6:59 UTC (permalink / raw
  To: gentoo-user

meino.cramer@gmx.de wrote:
> Hi,
> 
> it is possible to run a 32-bit binary executable on a 64-bit system
> (AMD64).
> 
> 
> But: Is it possible to compile source code on a 64-bit system and get
> an 32-bit executable a the result ??? And if 'yes'...how???
> 
> Thank you very much for any help in advance!
> 
> Best regards,
> mcc
> 
> 
> 

Hello Meino,

My setup is one 32bit pc with gentoo and another 64bit pc with gentoo

I managed to get this going on the 64bit with a 32-bit chroot, distcc, 
and crosstools

Just make sure you compiled your kernel with IA32 binary support (should 
be default)

Here are some links:
http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=2
http://www.gentoo.org/doc/en/cross-compiling-distcc.xml
http://www.gentoo.org/doc/en/distcc.xml
http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=1&chap=2

Regards,
Coert Waagmeester



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-10  6:59 ` Coert Waagmeester
@ 2010-11-10 19:25   ` meino.cramer
  2010-11-10 21:59   ` Enrico Weigelt
  1 sibling, 0 replies; 15+ messages in thread
From: meino.cramer @ 2010-11-10 19:25 UTC (permalink / raw
  To: gentoo-user

Coert Waagmeester <lgroups@waagmeester.co.za> [10-11-10 18:40]:
> meino.cramer@gmx.de wrote:
> >Hi,
> >it is possible to run a 32-bit binary executable on a 64-bit system
> >(AMD64).
> >But: Is it possible to compile source code on a 64-bit system and get
> >an 32-bit executable a the result ??? And if 'yes'...how???
> >Thank you very much for any help in advance!
> >Best regards,
> >mcc
> 
> Hello Meino,
> 
> My setup is one 32bit pc with gentoo and another 64bit pc with gentoo
> 
> I managed to get this going on the 64bit with a 32-bit chroot, distcc, 
> and crosstools
> 
> Just make sure you compiled your kernel with IA32 binary support 
> (should be default)
> 
> Here are some links:
> http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=2
> http://www.gentoo.org/doc/en/cross-compiling-distcc.xml
> http://www.gentoo.org/doc/en/distcc.xml
> http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=1&chap=2
> 
> Regards,
> Coert Waagmeester
> 

Hi Coert,

thanks a lot for your informations and the links! :)

I will see, how I will proceed...

Best regards
mcc





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-09 17:39   ` meino.cramer
  2010-11-09 17:55     ` Jacob Todd
@ 2010-11-10 21:55     ` Enrico Weigelt
  1 sibling, 0 replies; 15+ messages in thread
From: Enrico Weigelt @ 2010-11-10 21:55 UTC (permalink / raw
  To: gentoo-user

* meino.cramer@gmx.de <meino.cramer@gmx.de> wrote:

> Is there a toolchain already setup for cross-compiling 32-bit
> executables on a AMD64 system, or do I have to do all that cross-
> compiling magic by myself ?

crosstool-ng

If you want a build system for crosscompiling, you might like
to look at Briegel.


cu
-- 
----------------------------------------------------------------------
 Enrico Weigelt, metux IT service -- http://www.metux.de/

 phone:  +49 36207 519931  email: weigelt@metux.de
 mobile: +49 151 27565287  icq:   210169427         skype: nekrad666
----------------------------------------------------------------------
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-09 17:45   ` meino.cramer
@ 2010-11-10 21:57     ` Enrico Weigelt
  0 siblings, 0 replies; 15+ messages in thread
From: Enrico Weigelt @ 2010-11-10 21:57 UTC (permalink / raw
  To: gentoo-user

* meino.cramer@gmx.de <meino.cramer@gmx.de> wrote:

> > grela@kraken ~ $ gcc -o a.out.64 test.c
> > grela@kraken ~ $ gcc -m32 -o a.out.32 test.c
> > grela@kraken ~ $ file a.out.*
> > a.out.32: ELF 32-bit LSB executable, Intel 80386, version 1
> > (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux
> > 2.6.9, not stripped
> > a.out.64: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux),
> > dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not
> > stripped
> > grela@kraken ~ $
> > 
> > Br,
> > Maciej Grela
> > 
> 
> Oh YEAH! That's a definition of "straight forward I do like very much!
> Thanks a lot, Maciej! You saved me a lot of half defunct bits ! ;)

Only for the specific case that your target system has the same
system libraries (and you have a *full* multilib installation)
as the building system.

If you want to crosscompile, you *most likely* want sysroot too.


cu
-- 
----------------------------------------------------------------------
 Enrico Weigelt, metux IT service -- http://www.metux.de/

 phone:  +49 36207 519931  email: weigelt@metux.de
 mobile: +49 151 27565287  icq:   210169427         skype: nekrad666
----------------------------------------------------------------------
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-10  6:59 ` Coert Waagmeester
  2010-11-10 19:25   ` meino.cramer
@ 2010-11-10 21:59   ` Enrico Weigelt
  2010-11-11 11:12     ` Coert Waagmeester
  1 sibling, 1 reply; 15+ messages in thread
From: Enrico Weigelt @ 2010-11-10 21:59 UTC (permalink / raw
  To: gentoo-user

* Coert Waagmeester <lgroups@waagmeester.co.za> wrote:

> My setup is one 32bit pc with gentoo and another 64bit pc with gentoo
> 
> I managed to get this going on the 64bit with a 32-bit chroot, distcc, 
> and crosstools

Why do you need an 32bit chroot if you're going to use an
crosscompiler anyways ?

> Just make sure you compiled your kernel with IA32 binary support (should 
> be default)

The _target_ kernel has to support the IA32 ABI. The host (building)
might be better off w/o it (better detection of build errors).


cu
-- 
----------------------------------------------------------------------
 Enrico Weigelt, metux IT service -- http://www.metux.de/

 phone:  +49 36207 519931  email: weigelt@metux.de
 mobile: +49 151 27565287  icq:   210169427         skype: nekrad666
----------------------------------------------------------------------
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-10 21:59   ` Enrico Weigelt
@ 2010-11-11 11:12     ` Coert Waagmeester
  2010-12-30  7:52       ` Enrico Weigelt
  0 siblings, 1 reply; 15+ messages in thread
From: Coert Waagmeester @ 2010-11-11 11:12 UTC (permalink / raw
  To: gentoo-user

Enrico Weigelt wrote:
> * Coert Waagmeester <lgroups@waagmeester.co.za> wrote:
> 
>> My setup is one 32bit pc with gentoo and another 64bit pc with gentoo
>>
>> I managed to get this going on the 64bit with a 32-bit chroot, distcc, 
>> and crosstools
> 
> Why do you need an 32bit chroot if you're going to use an
> crosscompiler anyways ?
> 
You are right, I only have distcc in the 32bit chroot, it ofcourse 
already has the 32bit gcc et al.

I have a 64bit crossdev setup on my 32 bit machine. that is where the 
confusion came in.
>> Just make sure you compiled your kernel with IA32 binary support (should 
>> be default)
> 
> The _target_ kernel has to support the IA32 ABI. The host (building)
> might be better off w/o it (better detection of build errors).
How would this work exactly?
64 bit only installation with a 32 bit crossdev installation?
> 
> 
> cu




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-09 17:25 [gentoo-user] 32bit-Executables on a AMD64 system meino.cramer
                   ` (2 preceding siblings ...)
  2010-11-10  6:59 ` Coert Waagmeester
@ 2010-11-12 19:50 ` Volker Armin Hemmann
  3 siblings, 0 replies; 15+ messages in thread
From: Volker Armin Hemmann @ 2010-11-12 19:50 UTC (permalink / raw
  To: gentoo-user

On Tuesday 09 November 2010, meino.cramer@gmx.de wrote:
> Hi,
> 
> it is possible to run a 32-bit binary executable on a 64-bit system
> (AMD64).

yes, if you use the multilib profile.



> But: Is it possible to compile source code on a 64-bit system and get
> an 32-bit executable a the result ??? And if 'yes'...how???

cross compiling



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] 32bit-Executables on a AMD64 system...
  2010-11-11 11:12     ` Coert Waagmeester
@ 2010-12-30  7:52       ` Enrico Weigelt
  0 siblings, 0 replies; 15+ messages in thread
From: Enrico Weigelt @ 2010-12-30  7:52 UTC (permalink / raw
  To: gentoo-user

* Coert Waagmeester <lgroups@waagmeester.co.za> wrote:
> >The _target_ kernel has to support the IA32 ABI. The host (building)
> >might be better off w/o it (better detection of build errors).
>
> How would this work exactly?
> 64 bit only installation with a 32 bit crossdev installation?

Not sure on how gentoo builds the crosscompilers, but with an
crosstool-ng generated toolchain it will do.


cu
-- 
----------------------------------------------------------------------
 Enrico Weigelt, metux IT service -- http://www.metux.de/

 phone:  +49 36207 519931  email: weigelt@metux.de
 mobile: +49 151 27565287  icq:   210169427         skype: nekrad666
----------------------------------------------------------------------
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-12-30  8:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-09 17:25 [gentoo-user] 32bit-Executables on a AMD64 system meino.cramer
2010-11-09 17:31 ` Jarry
2010-11-09 17:39   ` meino.cramer
2010-11-09 17:55     ` Jacob Todd
2010-11-10 21:55     ` Enrico Weigelt
2010-11-09 17:37 ` Maciej Grela
2010-11-09 17:45   ` meino.cramer
2010-11-10 21:57     ` Enrico Weigelt
2010-11-09 17:48   ` meino.cramer
2010-11-10  6:59 ` Coert Waagmeester
2010-11-10 19:25   ` meino.cramer
2010-11-10 21:59   ` Enrico Weigelt
2010-11-11 11:12     ` Coert Waagmeester
2010-12-30  7:52       ` Enrico Weigelt
2010-11-12 19:50 ` Volker Armin Hemmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox