C compiler cannot create executables

Garrett Cooper youshi10 at u.washington.edu
Tue Nov 6 18:51:24 PST 2007


Josh Carroll wrote:
>> configure: error: C compiler cannot create executables
>>
>> I googled for awhile and found the suggestion to reinstall libtool, but
>> that also fails with the same error.
>>     
>
> Can you paste the config.log from the port's work source directory
> (where configure is located)?
>
> Can you try the following and see if it compiles?
>
> echo '#include <stdio.h>\nint main(void){ printf("hello world!\\n");
> return 0;}\n' > t.c ; gcc t.c -o t; ./t; rm t.c
>
> You should either see:
>
> hello world!
>
> Or some compiler errors/warnings/etc.
>
> Josh
>   
Just do...

# Exit.
echo 'int main() { return 1; } ' >src.c;
# Try to compile prog.
gcc -O0 src.c && ./a.out && echo $?;
# Toss executable, if it exists.
[ -e './a.out' ] && rm ./a.out

Either you'll get a compiler error, or it should print out 1.

-Garrett


More information about the freebsd-questions mailing list