
All of our systems are 64-bit, but today I needed to compile a simple executable for a 32-bit system. Fortunately gcc makes that easy; just add the "-m32" switch to the command line. Unfortunately, it didn't work!
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.2.4/libgcc.a when searching for -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.2.4/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status
I've got the various "lib32" files installed so I can run 32-bit apps on my 64-bit system, but it turns out you need a couple more to actually compile 32-bit apps.
Here's what you need to do on Ubuntu Hardy. (It's probably the same package names on most recent debian or debian-based systems)
sudo apt-get install gcc-multilib libc6-i386
That will pull in the necessary files and the "-m32" switch works. Voila!
Navigation
Search
Recent blog posts
- Windows 7 64-bit (pro) update problems
- Perl, magic open, and gzip
- Virtual Box Ubuntu Network eth0 becomes eth1
- Missing host CD drive in VirtualBox
- Custom OpenVPN Installer
- Running the kernal upgrades on VServer pair
- Couriersite - A Web Administration Program for the Courier Email Suite
- Compiling 32-bit executables on a 64-bit system
- How to rearrange the order of calendar in Sunbird or Lightning
- Cleaning My Keyboard - A Voyage of Self-Discovery
