最近搞壞了ubuntu,大半夜裝好公司的電腦-limint系統,第二天早晨編譯 ./configure出錯configure: error: C compiler cannot create executables
很是無語呀,找了很多解決辦法:
1,
Having a compiler (like gcc) is not enough to compile C programs, you also need a C library. If it is missing, you will experience the (somewhat obscure) error message:
configure: error: C compiler cannot create executables
You may fix this by installing libc6-dev and linux-libc-dev packages. After you install them, simply rerun ./configure.
沒有效果!
2,
You can test this by compiling a small C example with the -m32 flag.
// Minimal C example
#include <stdio.h>
int main()
{
printf("This works\n");
return 0;
}
Compiling:
gcc -m32 -o m32test m32test.c
確實也沒有通過!
3,
Logs don't lie! configure.log is what i need to get to the root of the problem. The issue is this:
gcc checking whether the C compiler works... no
The simple answer to this is just
sudo apt-get install clang && rvm install 1.9.3 --with-gcc=clang
這是解釋:ask:it would be interesting to know why GCC didn't work
answer:GCC doesn't work for me either. Clang works though.
這個方法好使!
另外還有一個方法沒有試試:
ln -s /usr/bin/gcc /usr/bin/gcc-apple-4.2
