Wednesday, 7 August 2013
Compile 32 Bit Binaries On 64 Bit Machine
Well I had this special need if you recall my previous blog post since my friend had 64 bit machine. Sometimes, there might be this necessity to compile 32 bit binaries on your 64 bit machine. This post describes how to do so.
First make sure the necessary x86 libraries are installed. We require 32-bit shared libraries for AMD64 to compile binaries in 32 bit format. The command below installs the i386 version of libc6-dev:
Now you can compile your code in 32 bit binary format using the -m32 flag where 32 represents the x86 processor (-m64 would mean x64 processor).
I hope this helps :)
First make sure the necessary x86 libraries are installed. We require 32-bit shared libraries for AMD64 to compile binaries in 32 bit format. The command below installs the i386 version of libc6-dev:
$ sudo apt-get install libc6-dev-i386
Now you can compile your code in 32 bit binary format using the -m32 flag where 32 represents the x86 processor (-m64 would mean x64 processor).
$ gcc -m32 -o test test.c
I hope this helps :)
Labels:
c,
C/C++,
linux,
programming,
ubuntu
Bookmark this post:blogger tutorials
Social Bookmarking Blogger Widget |
Compile 32 Bit Binaries On 64 Bit Machine
2013-08-07T16:13:00+05:45
Cool Samar
c|C/C++|linux|programming|ubuntu|
Subscribe to:
Post Comments (Atom)