You need to install the gcc-mutlilib package. Then:
$ gcc -o hello -m32 hello.c
the -m32 flag tells the compiler to target the 32-bit architecture instead of the 64-bit architecture
Also, you may need to take a look at this looooooong discussion:
http://ubuntuforums.org/showthread.php?t=24575
For kernel compiling, you will need to explicitly specify the architecture:
$ make ARCH=i386 menuconfig
$ make ARCH=i386 bzImage
Happy compiling :)
*** Returning to this issue with Makefiles
just run:
$make CFLAGS=-m32 LDFLAGS=-m32
this adds the -m32 option to both the compiler flags and the linker flags
Popular Posts
-
You need to install the gcc-mutlilib package. Then: $ gcc -o hello -m32 hello.c the -m32 flag tells the compiler to target the 32-bit archi...
-
From the gcc man page: -dCHARS CHARS is a sequence of one or more of the following characters, and must not be preceded by a spac...
-
It took me some long time to comprehend the issues involved in using unions, structs, and bit fields in C and C++. First, for the definition...
-
Ever needed to compile over exported NFS system in Linux. I needed it to compile some programs on my PC using a compiler in a virtual box ;-...
-
Biomedical Engineering make extensive use of software. Signal processing algorithms and other aspects of the biomedical engineering needs ex...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment