"cannot run C compiled programs" error
Anna Ceguerra
anna.ceguerra@sydney.edu.au
Mon Apr 18 15:37:00 GMT 2011
Hi Kevin & Jonathan,
>>>>>> configure:3166: checking whether the C compiler works
>>>>>> configure:3175: ./a.out
>>>>>> ../../../../gcc-4.6-20110408/libgcc/configure: line 3177: ./a.out: Bad
>>>>>> CPU
>>>>>> type in executable
>>>>>
>>> Some type of PowerPC vs x86 thing? Can you use the file command to
>>> make sure that the architecture matches what you are running on?
>>>
>> I can't seem to find the file a.out anywhere...
>>
> It is something that configure creates. Try looking in the config.log
> in the libgcc directory of your obj dir. It is in the top level under
> the <machine type> dir.
>
It's trying to generate from conftest.c, which I can't find either. Here is
the relevant section of the configure file:
# Check that the compiler produces executables we can run. If not, either#
the compiler is broken, or we cross compile.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler
works" >&5
$as_echo_n "checking whether the C compiler works... " >&6; }
# If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then
if { ac_try='./$ac_file'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':"
>&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." "$LINENO" 5; }
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
> Try to assemble this:
>
> ./xgcc -B. -v simple.s
>
> If that works, try:
>
> file simple.o
I had to do file a.out, and the result is:
a.out: Mach-O executable i386
>
> One of your other posts, which I missed somehow, you state that your
> system is 32-bit? I thought all of the x86 macs were 64-bit capable?
> (You and me have a WILDLY different idea of what "really old machine"
> means. DEMON is ... an old machine. He is a PowerMac 8600. My 386 is a
> really old machine.)
>
This machine was purchased in March 2006, shortly after the switch was made
from PowerPC to Intel processors for MacBook Pros. This laptop has Intel
Core Duo (not Core 2 Duo, which I believe is a 64-bit processor).
Thanks and regards,
Anna.
More information about the Gcc-help
mailing list