"cannot run C compiled programs" error
Anna Ceguerra
anna.ceguerra@sydney.edu.au
Sat Apr 16 23:21:00 GMT 2011
Hi Ian,
Thanks for your reply.
You're right I haven't built the required libraries using --disable-shared,
but I did attempt to build gcc by passing the library location as arguments.
A search for the word error in config.log finds the following:
configure:3028: /Users/anna/Documents/programs/GCC/GCC/build/./gcc/xgcc
-B/Users/anna/Documents/programs/GCC/GCC/build/./gcc/
-B/Users/anna/Documents/programs/GCC/GCC/install/i386-apple-darwin10.7.0/bin
/
-B/Users/anna/Documents/programs/GCC/GCC/install/i386-apple-darwin10.7.0/lib
/ -isystem
/Users/anna/Documents/programs/GCC/GCC/install/i386-apple-darwin10.7.0/inclu
de -isystem
/Users/anna/Documents/programs/GCC/GCC/install/i386-apple-darwin10.7.0/sys-i
nclude -m64 -V >&5
xgcc: error: unrecognized option '-V'
xgcc: fatal error: no input files
compilation terminated.
...
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
configure:3179: $? = 126
configure:3186: error: in
`/Users/anna/Documents/programs/GCC/GCC/build/i386-apple-darwin10.7.0/x86_64
/libgcc':
configure:3190: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
Regards,
Anna.
On 17/04/11 17/04/11 3:12 AM, "Ian Lance Taylor" <iant@google.com> wrote:
> Anna Ceguerra <anna.ceguerra@sydney.edu.au> writes:
>
>> I am trying to compile gcc-4.6-2010408, and I get the following error:
>>
>> checking whether the C compiler works... configure: error: in
>> `/Users/anna/Documents/programs/GCC/GCC/build/i386-apple-darwin10.7.0/x86_64
>> /libgcc':
>> configure: error: cannot run C compiled programs.
>>
>>
>> I am on Mac OS X 10.6.7, Intel Core Duo (NOT core 2 duo), and I have
>> successfully built gmp-5.0.1, mpc-0.8.2 and mpfr-3.0.1. I used the following
>> configure command:
>>
>> export GCC_LIBS_DIR=/Users/anna/Documents/programs/GCC/GCC/libs/install
>> ../gcc-4.6-20110408/configure --prefix=$(cd ../install/ && pwd)
>> --with-gmp=$GCC_LIBS_DIR --with-mpfr=$GCC_LIBS_DIR --with-mpc=$GCC_LIBS_DIR
>> --disable-checking --enable-werror --enable-languages=c
>> --disable-libquadmath
>>
>> If you need further details please let me know.
>
> You need to look at i386-apple-darwin10.7.0/x86_64/libgcc/config.log.
> That should show the reason why you got that error. There's usually a
> lot of information in there; look for the above error message. It
> should show the program that it tried to compile and the error message
> it got when it failed.
>
> A pretty common cause for this is that you built gmp, mpc, and mpfr
> without using --disable-shared, and you haven't told the dynamic linker
> where to find the shared libraries.
>
> Ian
More information about the Gcc-help
mailing list