HowTo Compile a 32-bit Application Using gcc On the 64-bit Linux Version

had to compile a 32-bit application using GNU gcc on the 64-bit version of Linux.

Luckily, gcc man page directed me to the ‘-m32’ and ‘-m64’ options. These options generate code for 32-bit or 64-bit environments, respectively.
  1. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system.
  2. 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.


Step 1:

This error message shows up on the 64 bit systems where GCC multilib feature is enabled, and it indicates that 32 bit version of libc is not installed. To fix this problem, on a CentOS/RHEL 5.x type the followingyum command:
# yum -y install glibc-devel.i386 libstdc++-devel.i386
To fix this problem, on a CentOS/RHEL 6.x type the following yum command:
# yum -y install glibc-devel.i686 glibc-devel ibstdc++-devel.i686
To fix this problem on a Debian or Ubuntu Linux type the following apt-get command:
$ sudo apt-get install g++-multilib libc6-dev-i386
To fix this problem on a Suse (SLES) / OpenSUSE Linux type the following zypper command:
# zypper in glibc-devel-32bit


Step 2:
sudo apt-get install zlib1g

As pointed by @E-rich, it may be required to add a :i386 suffix to the package name for the package manager correctly identify it:

sudo apt-get install zlib1g:i386






http://www.cyberciti.biz/tips/compile-32bit-application-using-gcc-64-bit-linux.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值