[nflug] Building 32-bit bins under 64-bit Linux
Ken Smith
kensmith at cse.Buffalo.EDU
Thu Apr 12 09:55:50 EDT 2007
On Thu, 2007-04-12 at 05:52 -0400, Robert Wolfe wrote:
> Hi all! I was wondering if it were possible to build 32-bit binaries on
> an x86_64 version of Linux so that the binaries generated can be run on
> 32-bit Linux? And if so, HOW?
Include "-m32" on the command line when running the compiler.
Demonstration set of commands on a machine named nickelback:
nickelback 78 % cat hello.c
#include <stdio.h>
int
main(int argc, char *argv[])
{
printf("Hello World!\n");
}
nickelback 79 % uname -p
x86_64
nickelback 80 % cc -O hello.c -o hello
nickelback 81 % file hello
hello: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), not stripped
nickelback 82 % cc -m32 -O hello.c -o hello
nickelback 83 % file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
nickelback 84 %
--
Ken Smith
- From there to here, from here to | kensmith at cse.buffalo.edu
there, funny things are everywhere. |
- Theodore Geisel |
_______________________________________________
nflug mailing list
nflug at nflug.org
http://www.nflug.org/mailman/listinfo/nflug
More information about the nflug
mailing list