How to compile 32 bit application on 64 bit machine?

Discussion in 'C Programming' started by Vittal, Jul 11, 2003.

  1. Vittal

    Vittal Guest

    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
     
    Vittal, Jul 11, 2003
    #1
    1. Advertising

  2. On 10 Jul 2003 23:07:50 -0700,
    Vittal <> wrote:
    > 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
    --
    |
    Martien Verbruggen | We are born naked, wet and hungry. Then
    | things get worse.
    |
     
    Martien Verbruggen, Jul 11, 2003
    #2
    1. Advertising

  3. Vittal

    Zoran Cutura Guest

    Vittal <> wrote:
    > 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).


    --
    Z ()
    "LISP is worth learning for the profound enlightenment experience
    you will have when you finally get it; that experience will make you
    a better programmer for the rest of your days." -- Eric S. Raymond
     
    Zoran Cutura, Jul 11, 2003
    #3
  4. Vittal

    Fred Bloggs Guest

    (Vittal) wrote in message news:<>...
    > 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?
     
    Fred Bloggs, Jul 11, 2003
    #4
  5. Vittal

    Dan Pop Guest

    In <> (Vittal) writes:

    >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
    --
    Dan Pop
    DESY Zeuthen, RZ group
    Email:
     
    Dan Pop, Jul 11, 2003
    #5
  6. Vittal

    Vittal Guest

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

    Thanks
    -Vittal


    Martien Verbruggen <> wrote in message news:<>...
    > On 10 Jul 2003 23:07:50 -0700,
    > Vittal <> wrote:
    > > 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
     
    Vittal, Jul 11, 2003
    #6
  7. Vittal

    Vittal Guest

    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

    (Dan Pop) wrote in message news:<bem9qt$gii$>...
    > In <> (Vittal) writes:
    >
    > >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
     
    Vittal, Jul 14, 2003
    #7
  8. Vittal

    Tom St Denis Guest

    Vittal wrote:
    > 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
     
    Tom St Denis, Jul 14, 2003
    #8
  9. Vittal

    Randy Howard Guest

    In article <cOCQa.42287$>,
    says...
    > > 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?


    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
     
    Randy Howard, Jul 15, 2003
    #9
  10. Vittal

    Tom St Denis Guest

    Randy Howard wrote:
    > In article <cOCQa.42287$>,
    > says...
    >
    >>>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?

    >
    >
    > 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
     
    Tom St Denis, Jul 15, 2003
    #10
  11. Vittal

    Unix Calvin Guest

    > 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


    Mark McIntyre <> wrote in message news:<>...
    > On 14 Jul 2003 11:24:40 -0700, in comp.lang.c ,
    > (Vittal) wrote:
    >
    > >Sorry for not providing all details.

    >
    > Are you also sorry for
    > a) top posting
    > b) not READING Dan's quite correct response:
    >
    > " 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."
    >
    > >I am using Itanium Linux 64 bit machine and I have GCC 3.2.2 installed in it.

    >
    > we don't care, its not a C question. its an implementation question.
    >
    >
    > --
    > Mark McIntyre
    > CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    > CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
    >
    >
    > ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    > http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    > ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
     
    Unix Calvin, Jul 15, 2003
    #11
  12. On 15 Jul 2003 03:04:35 -0700, in comp.lang.c ,
    (Unix Calvin) wrote:

    (quoting me, and inexplicably also including my entire post lower
    down)

    >> 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...


    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.

    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>


    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
     
    Mark McIntyre, Jul 15, 2003
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,855
    Timothy Bendfelt
    Jan 19, 2007
  2. Replies:
    5
    Views:
    591
    red floyd
    Mar 16, 2006
  3. Nagaraj
    Replies:
    1
    Views:
    917
    Lionel B
    Mar 1, 2007
  4. harijay
    Replies:
    2
    Views:
    504
    Gabriel Genellina
    Feb 19, 2009
  5. Andy
    Replies:
    25
    Views:
    2,305
Loading...

Share This Page