[nflug] Building 32-bit bins under 64-bit Linux

Robert Wolfe rwolfe at shatterit.com
Thu Apr 12 23:55:38 EDT 2007


Ken, is there a way that I can specify that on the configure command line?

Ken Smith wrote:
> 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 % 
>
>   


-- 
Robert Wolfe (MCP/Linux+) <rwolfe at shatterit.com>
Shatter I.T. Global Services, Buffalo, NY
http://www.shatterit.com

_______________________________________________
nflug mailing list
nflug at nflug.org
http://www.nflug.org/mailman/listinfo/nflug



More information about the nflug mailing list