Luckily, gcc man page directed me to the ‘-m32’ and ‘-m64’ options. These options generate code for 32-bit or 64-bit environments, respectively.
- 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.
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