Results 1 to 6 of 6

Thread: Ubuntu 64 bit compiling question

  1. #1
    Join Date
    Apr 2008
    Location
    Colombia
    Beans
    28
    Distro
    Ubuntu

    Question Ubuntu 64 bit compiling question

    Greetings respected comunity.

    I'm new to 64 bit computing, I just installed ubuntu 10.04 64 bit edition, I was wondering how to compile with gcc or g++ 32 bit apps in ubuntu 64 bit, which package do I need for this? which libraries? If you have time, please, also tell me, the packages that appear at the universe using apt-get in the terminal, all of them are configured or compiled for 64 bit architecture? thank you.

  2. #2
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,294
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Ubuntu 64 bit compiling question

    You need at least gcc-multilib, plus 32-bit versions of the libraries your program uses, if any. gcc-multilib installs some, you will also find a lot of them in ia32-libs (but if you use an "exotic" library, you might have to install a 32-bit version of it manually).

    How to compile depends on the build system your program uses. For simple programs, using the -m32 flag should be sufficient.

    Code:
    gcc -m32 -o foo foo.c

  3. #3
    Join Date
    Jan 2010
    Location
    Manhattan
    Beans
    200
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Ubuntu 64 bit compiling question

    Embarrassing as it is, I had assumed the standard gcc handles 64 bits, sort of by default flipping on the most modern system architecture. Do you happen to have a link that discusses this? It's not in the old gcc book, for all I know.

  4. #4
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,294
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Ubuntu 64 bit compiling question

    Quote Originally Posted by gnometorule View Post
    Embarrassing as it is, I had assumed the standard gcc handles 64 bits, sort of by default flipping on the most modern system architecture. Do you happen to have a link that discusses this? It's not in the old gcc book, for all I know.
    Excuse me? On a 64-bit system, gcc does compile 64-bit code by default, that's why you have to pass the -m32 flag if you want 32-bit code...

  5. #5
    Join Date
    Jan 2010
    Location
    Manhattan
    Beans
    200
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Ubuntu 64 bit compiling question

    Could you instead add a link how to learn to read carefully and properly?

  6. #6
    Join Date
    Oct 2011
    Location
    Chicago, IL
    Beans
    419
    Distro
    Xubuntu 10.04 Lucid Lynx

    Re: Ubuntu 64 bit compiling question


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •