linux 64 bit编译32 bit 程序
在64位linux上加-m32编译32位程序时,可能会出现链接错误:
$ gcc -m32 test.c /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s /usr/bin/ld: cannot find -lgcc_s collect2: error: ld returned 1 exit status
解决方法:
sudo apt-get install gcc-multilib g++-multilib