PDA

View Full Version : configure: error: C compiler cannot create executables


jxeon
05-03-2005, 10:38 PM
Sorry for yet another post but I seem to be running into losts of trouble.
I updated my xtools to 1.5 Running os x 10.3.9 1.33Mhz powerbook.
Some threads seem to suggest that the error in title was related to an older xtools, but the upgrade hasn't resolved this. I also have posted this at the garnome list as that's ultimately what I'm trying to get working. (They also recommended this forum)

[fetch] complete for libtool.
==> Running checksum on libtool-1.5.14.tar.gz
049bf67de9b0eb75cd943dafe3d749ec download/libtool-1.5.14.tar.gz
file libtool-1.5.14.tar.gz passes checksum test!
==> Running checksum on workaround-la-files.diff
10513fe2e66e7a4862af4e5df176d191 download/workaround-la-files.diff
file workaround-la-files.diff passes checksum test!
[checksum] complete for libtool.
install -d work/main.d
==> Extracting download/libtool-1.5.14.tar.gz
[extract] complete for libtool.
==> Applying patch download/workaround-la-files.diff
patching file ltmain.in
[patch] complete for libtool.
grep: invalid option -- o
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
grep: invalid option -- o
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
[fixup] complete for libtool.
==> Running configure in work/main.d/libtool-1.5.14
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for gcc... cc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
make: *** [configure-work/main.d/libtool-1.5.14/configure] Error 77

My gcc & ld versions:
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1671)
[Johns-Computer:~] johnsmac% ld -v
Apple Computer, Inc. version cctools-525.1.obj~8

I really am over my head on this so if there is a tome I should be reading..
Also I don't understand why bash doesn't recognize some commands like setenv yet if I do csh at the shell it works-what is wrong there?

anaxamander
05-04-2005, 01:21 AM
Well, I'll use another example. Open up the configure file, and search for a distinctive word in your error: executables. I'll use a small configure script from an entirely different program (but they are still just shell scripts - most are strikingly similar). And behold, I can see that same error. I see just before that exact error: "if test $ac_cv_prog_cc_works = no; then", so now I look for the variable: ac_cv_prog_cc_works

I come across a test where if it does... something, it becomes yes, and no when it fails:

if { (eval echo configure:911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
else
echo "configure: failed program was:" >&5
ac_cv_prog_cc_works=no
fi

so in this test there is some echoing, and then another variable (ac_link); another command to eval ac_link; and if successful (anything after they && means it gets executed if the stuff before it worked without error) then "test -s conftest${ac_exeext}"

and then we see that ac_link is:

ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'

which you can quickly translate as: "issue the gcc command, -o output to some conftest_thingy, with $CFLAGS and $CPPFLAGS and $LDFLAGS another conftest.thingy and $LIBS some_doohicky_thingy".

Boiling it down to the essence, test the compiler with some simple conftest.c file with the full complement of CompilerFLAGs, C_PreProcessorFLAGS, and Link_eDitorFLAGS, output to conftest.thingy_input and tack on LIBraries, and route the stuff to purgutory (1>&5). The files used in this test (conftest.c, .h, confdefs.h) get created inside the configure script (cat > conftest.var << EOF stuff EOF is where it happens), and that gets compiled as your test. If it doesn't complain with an error (like most things), then its fine.

If you don't have a compiler its the same as if you typed "dombaya" - you'll get some kind of error. The same thing happens if one of those flags riding along with the compile command have an error in them: something will come back. SILENCE is what is wanted; smooth compiling. For example:

gcc -fno-commet -o conftest conftest.c
cc1: error: unrecognized command line option "-fno-commet"

so an executable is NOT formed (one would have been had I spelled it right with -fno-common), and essentially it tells you what you see. Not that you don't HAVE a compiler, but that there is some(thing) (FLAG) standing in its way if you do have one ($CFLAGS $CPPFLAGS $LDFLAGS $LIBS).... or that you really don't have a compiler.
----------------------
And to wind up the last part of initial if-then statement: test -s conftest${ac_exeext}

we can see (by "man test") that the last part that can fail is "True if conftest (ac_exeext is blank) exists and is size greater than zero". Well, if there was an error along the way, that small worthless executable (created during the ac_link part) would not exist. THEN ac_cv_prog_cc_works becomes "no" and then you see the error you see, and then it exits.

Check your flags! - brought to you by the Better Gcc Bureau (the BGB)

------------------
setenv is a csh/tcsh command; export is how it is done in bash:

export LDFLAGS=-L/opt/local/lib && export

you can also change which shell Terminal.app uses as a default, or when the need arises, just type "tcsh" and you'll be in that shell - setenv all you want. type "exit, back to bash".

dmacks
05-04-2005, 03:06 AM
A good starting point is often doing exactly what an error says: See `config.log' for more details. That file, in the same directory as "configure", contains the actual command that was issued (after variable substitution, so you don't have to hunt through the configure script, then figure out what variables gave what flags that might be causing trouble) and the actual error message or other result of that command.

sao
05-05-2005, 09:17 AM
configure: error: C compiler cannot create executables
I would run the run the -Dev Tools- Installer again making sure to install the DevSDK package using a Custom Install.

.

jxeon
05-06-2005, 09:42 AM
I would run the run the -Dev Tools- Installer again making sure to install the DevSDK package using a Custom Install.

.

For anyone else experiancing compiler problems I found this link http://www.mail-archive.com/fink-users@lists.sourceforge.net/msg18076.html -it seems that sometimes an install of xcode or an upgrade goes awry and a inappropriate version of cctools gets installed.

Added 5-6-05 4:35PM EST: I'm confused about the xtools install and upgrade.
I got the xtools 1.5 release and the Nov update which is suppose to fix some problems with gcc. However Apples About GCC Updater.pdf states:
After applying the update, the compiler and linker versions should be: $ gcc -v Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs Thread model: posix gcc version 3.3 20030304 (Apple Computer, Inc. build 1671) $ ld -v Apple Computer, Inc. version cctools-525.1.obj~1
But my ld -v results are different (see below)
$ ld -v
Apple Computer, Inc. version cctools-525.1.obj~8
I did use a custom install when I re-installed xtools 1.5 ( the updated has no custom option) What does this difference in ld mean and how do I correct it?
Thanks again

sao
05-07-2005, 12:38 AM
jxeon wrote:
...-it seems that sometimes an install of xcode or an upgrade goes awry
In Panther it was quite common to observe the "lazy installer syndrome", namely that the Apple Installer sometimes forgot to install some files, and then it was necessary to install the same package twice, sometimes three times.

Please, read the following threads:
http://forums.macosxhints.com/showthread.php?t=21924
http://forums.macosxhints.com/showthread.php?t=22352

In Fink beginners mailing list:
"C compiler cannot create executables":
http://thread.gmane.org/gmane.os.apple.fink.beginners/9914

.

jxeon
05-07-2005, 08:26 AM
I looked in my /Users/johnsmac/darwinports/base/config.log
and found these lines the first being a different version of gcc than what gcc -v
reports. The threads in the preceeding post suggest replacing xcode or dev tools with an older version is that what I have to do to fix this? Also the system is capable of compiling some pkgs.
I am unsure how to proceed.

gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)

conftest.c:2: error: parse error before "me"
configure:2267: $? = 1
configure: failed program was:
| #ifndef __cplusplus
| choke me

conftest.c:10:28: ac_nonexistent.h: No such file or directory
configure:3056: $? = 1
configure: failed program was:
| /* confdefs.h. */

sao
05-07-2005, 11:11 AM
conftest.c:2: error: parse error before "me"
configure:2267: $? = 1
configure: failed program was:
| #ifndef __cplusplus
| choke me
This is an expected failure.

conftest.c:10:28: ac_nonexistent.h: No such file or directory
configure:3056: $? = 1
configure: failed program was:
| /* confdefs.h. */
This also looks like an expected failure.

The real error must be somewhere else. It must be the last message in the config.log file, just before the list of variables that often is there, too. Please, look in configure-work/main.d/libtool-1.5.14/config.log

.

kps
05-07-2005, 11:53 AM
I don't have Tiger yet (no DVD) but putting two and two together, I don't get 4.0:

Some threads seem to suggest that the error in title was related to an older xtoolsgcc version 3.3 20030304 (Apple Computer, Inc. build 1671)That's older than the one on my Panther system.


Also I don't understand why bash doesn't recognize some commands like setenv yet if I do csh at the shell it works-what is wrong there?Nothing: setenv is a csh command; bash is a different shell with different syntax.

jxeon
05-08-2005, 02:18 PM
This is an expected failure.


This also looks like an expected failure.

The real error must be somewhere else. It must be the last message in the config.log file, just before the list of variables that often is there, too. Please, look in configure-work/main.d/libtool-1.5.14/config.log

.

The libtool config.log eluded me util I realized it was in garnome/bootstrap (locate doesn't find it there) I found this:

configure:2349: $? = 0
configure:2351: cc -v </dev/null >&5
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1671)
configure:2354: $? = 0
configure:2356: cc -V </dev/null >&5
cc: `-V' option must have argument
configure:2359: $? = 1
configure:2382: checking for C compiler default output file name
configure:2385: cc -I/Users/johnsmac/garnome/include -L/Users/johnsmac/garnome/l
ib -O2 -pipe -I/Users/johnsmac/garnome/include -Wl,--export-dynamic -L/Users/joh
nsmac/garnome/lib conftest.c >&5
ld: warning -L: directory name (/Users/johnsmac/garnome/lib) does not exist
ld: warning -L: directory name (/Users/johnsmac/garnome/lib) does not exist
ld: unknown flag: --export-dynamic
configure:2388: $? = 1
configure: failed program was:
| /* confdefs.h. */


|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2427: error: C compiler cannot create executables
See `config.log' for more details.

The really strange part of all this, for me, is that I can enter into the libtool-1.5.14 directory and do ./configure make and sudo make install and the shell shows everthing building-no errors. Then going back to the libtool directory in bootstrap , which is where the garnome readme says to do make install from, I still get the C compiler error. It's a mess-not even sure if it has anything to do with my system at this point.

Where do I go from here?

cwittenb
05-03-2007, 05:14 AM
although this thread is quite old, I wanted to post my totally different solution here, as I ran about this error message today.
On Tiger V. 10.4.9 Xcode seems to have set gcc v. 3.22 as default, which is what produces this error. The only thing to do here was to set it to version 4.0, by $ sudo gcc_select 4.0.

APPLE INTERNAL
05-03-2007, 04:16 PM
configure: error: C compiler cannot create executables

is your main error that should addressed before moving on... when you see that coming from not have the correct GCC SDKs on your platform

yes old old thread /// hope you finally got that resolved a year later

should be at 10.4.9 Xcode 2.4.1 Fink 0.8.1 (PowerPC) or
Fink 0.8.1 (Intel) GCC 3.3 & GCC 4.4

check you install...gcc --v
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5367.obj~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5367)