os: ubuntu 12.04.3 x86_64
# apt-get install ia32-libs //
安装32 bit的库
# apt-get install libc6-dev-i386
build 32位程序
# gcc -m32 -I/usr/include/x86_64-linux-gnu test.c
# file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x1ceed675e06d77500ccc33dba9ea4f7f146bd0d5, not stripped
# ldd a.out
linux-gate.so.1 => (0xf77cc000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7601000)
/lib/ld-linux.so.2 (0xf77cd000)
build 64位程序
# gcc test.c
# file a.out
a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x2907eb1bce7fdf0b08e3158cc4b601af6cc2429c, not stripped
# ldd a.out
linux-vdso.so.1 => (0x00007fff051fc000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe7dad68000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe7db149000)
参考:
%E7%B3%BB%E7%BB%9F%E5%AE%89%E8%A3%85%E5%8A%9E%E6%B3%95
https://developer.mozilla.org/en-US/docs/Compiling_32-bit_Firefox_on_a_Linux_64-bit_OS
阅读(1850) | 评论(0) | 转发(0) |