環境:linux
問題:ip
64bit系統編譯32bit程序,遇到問題it
# gcc test.c -m32 -o test編譯
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory test
安裝32位的glibc庫和頭文件gcc
#yum install glibc-devel.i686file
# gcc test.c -m32 -o testgc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s程序
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_sim
/usr/bin/ld: cannot find -lgcc_s
安裝gcc的庫
#yum install libgcc.i686
# gcc test.c -m32 -o test
#
ok!