How to compile 32 bit application on 64 bit machine?

V

Vittal

Hello All,

I have a Linux 64 bit machine and I have installed GCC 3.2.2 on it.
Now I want to a compile a small .c file for 32 bit. I tried to use
-m32 option for compiling the file as 32 bit. But my compiler failed
to recognise that option.
Can somebody tell me how I can compile a .c file for 32 bit on a 64
bit machine.

Thanks in advance
-Vittal
 
M

Martien Verbruggen

Hello All,

I have a Linux 64 bit machine and I have installed GCC 3.2.2 on it.
Now I want to a compile a small .c file for 32 bit. I tried to use
-m32 option for compiling the file as 32 bit. But my compiler failed
to recognise that option.

The newsgroup comp.lang.c is for the discussion of the C language; not
for discussion of compiler options. You should probably ask your
question on gnu.gcc.help, where people discuss gcc.

Martien
 
Z

Zoran Cutura

Vittal said:
Hello All,

I have a Linux 64 bit machine and I have installed GCC 3.2.2 on it.
Now I want to a compile a small .c file for 32 bit. I tried to use
-m32 option for compiling the file as 32 bit. But my compiler failed
to recognise that option.
Can somebody tell me how I can compile a .c file for 32 bit on a 64
bit machine.

Wrong newsgroup! Post in a group that discusses programming on your
platform/system or even the GNU compiler collection (gnu.gcc).
 
F

Fred Bloggs

Hello All,

I have a Linux 64 bit machine and I have installed GCC 3.2.2 on it.
Now I want to a compile a small .c file for 32 bit. I tried to use
-m32 option for compiling the file as 32 bit. But my compiler failed
to recognise that option.
Can somebody tell me how I can compile a .c file for 32 bit on a 64
bit machine.

Off topic. Probably some compiler option - a switch or a pragma or
something. What does your documentation say?
 
D

Dan Pop

In said:
I have a Linux 64 bit machine and I have installed GCC 3.2.2 on it.
Now I want to a compile a small .c file for 32 bit. I tried to use
-m32 option for compiling the file as 32 bit. But my compiler failed
to recognise that option.
Can somebody tell me how I can compile a .c file for 32 bit on a 64
bit machine.

Without knowing what 64-bit Linux machine you have (Alpha, SPARC, Itanium,
whatever) there is no meaningful way of answering your question. On some
platforms, it's simply a matter of choosing the sizes of certain C types
and using the appropriate libraries, on others, a second gcc installation
is needed, because a completely different instruction set must be used
in the generated code (e.g. on Itanium).

Go to a newsgroup dedicated to Linux on your hardware platform: it is the
only place on Usenet that can provide the information you're looking for.

Dan
 
V

Vittal

Sorry for dragging you all to a off topic and thanks for redirecting
me to a correct group.

Thanks
-Vittal
 
V

Vittal

Sorry for not providing all details.

I am using Itanium Linux 64 bit machine and I have GCC 3.2.2 installed in it.

$ uname -a
Linux titanin 2.4.9-18smp #1 SMP Tue Dec 11 12:59:00 EST 2001 ia64 unknown

Any further help on this issue is greatly appreciated.

Thanks
-Vittal
 
T

Tom St Denis

Vittal said:
Sorry for not providing all details.

I am using Itanium Linux 64 bit machine and I have GCC 3.2.2 installed in it.

$ uname -a
Linux titanin 2.4.9-18smp #1 SMP Tue Dec 11 12:59:00 EST 2001 ia64 unknown

Any further help on this issue is greatly appreciated.

Hmm? ia64 is a superset of ia32 is it not? So to compile ia32 just use
"-march=i386" when you build. E.g.

gcc -march=i386 foo.c -o foo

Not having access to a ia64 port of GCC I can't say if this will work
but if it truly is a superset than logically GCC for ia64 should be able
to limit itself to ia32 [via -march].

Failing that you could always build a cross-compiler [see the gcc folks
for info on doing that].

Tom
 
R

Randy Howard

Hmm? ia64 is a superset of ia32 is it not?

Not even close. Opteron is a much closer match to your description than
Itanium ever hoped to be. This is a prime example of why answering
OT questions is a bad idea. This and everything downstream is bogus.

--
Randy Howard
(remove the obvious bits from my address to reply.)
"Most of the drivers nowadays are a bit like Eddie Irvine, who if
he was half as fast as he thought he was, would be moderate."
-- Sir Stirling Moss
 
T

Tom St Denis

Randy said:
Not even close. Opteron is a much closer match to your description than
Itanium ever hoped to be. This is a prime example of why answering
OT questions is a bad idea. This and everything downstream is bogus.

My last suggestion was valid. A cross-compiler would natively target
the ia32.

And in the meantime AMD r0x0rz

Lameass second-hand 64-bit processors.... I'll stick with my thermal
nuclear XP 2400+ thank ya :)

Tom
 
U

Unix Calvin

we don't care, its not a C question. its an implementation question.
Than guiding correctly some guys are very much showing how much genious they are...
May be its not C question.If not interested just don't answer, just ignore...!!

'Words' reflect your attitude.

-Calvin
 
M

Mark McIntyre

On 15 Jul 2003 03:04:35 -0700, in comp.lang.c ,
(e-mail address removed) (Unix Calvin) wrote:

(quoting me, and inexplicably also including my entire post lower
down)
Than guiding correctly some guys are very much showing how much genious they are...

Not sure what you're trying to say here, but in my post I pointed out
that you had already been redirected to the right place, and that
you'd ignored that redirection. Thats rude
May be its not C question.If not interested just don't answer, just ignore...!!

Whether I'm interested or not is irrelevant. The point is, you posted
in the wrong place, I advised you of that, which I believe is the
correct thing to do. Otherwise you'd just keep asking and asking.
'Words' reflect your attitude.

Perhaps you should consider that you posted 'words' yourself, even
after twice being advised you were in the wrong place.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top