Compile a 32-bit application in a 64-bit environment

Source: Internet
Author: User
Compile a 32-bit application in a 64-bit environment-general Linux technology-Linux programming and kernel information. For more information, see the following. When PITA algorithm is used for target prediction, ViennaRNA package is used for structure folding. This package has been modified. The original package can be installed on our machine. However, the modified package compilation fails. It's a strange mistake. I don't know how to change it.

Fortunately, it has two versions, 64-bit and 32-bit. I got the mainframe to compile a 32-bit file. It was also an error, but it was a namespace problem. I changed the two header files to pass. Calculate again recently. The mainframe was recently removed. It can only be performed on the local machine.

So I had a hard time compiling a 32-bit program in a 64-bit system.

CPU: AMD Athlon (tm) 64X2 Dual Core Processor 3800 +
OS: Ubuntu 7.10/Linux 2.6.20-15-server #2 SMP Sun Apr 15 06:22:36 UTC 2007 x86_64 GNU/Linux
GCC: gcc (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4)

Install a 32-bit compatible Library

Apt-get install ia32-libs linux32 libc6-dev-i386

1. Use the linux32 command to change CHOST in configure and set the compiling environment.

$ Linux32./configure

# The system type will change to: i686-pc-linux-gnu
# Not x86_64-unknown-linux-gnu

2. Set GCC Parameters

Export CFLAGS = "-m32-04-march = i386-mtune = i386"

# The most important thing is-m32

-M32,-m64
Generate code for a 32-bit or 64-bit environment. the 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system. the 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code for AMD's x86-64 architecture.

3. Compile

Make

4. Installation

Sudo make install

The installation was successful. The PC has been running for many days.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.