configure: error: C compiler cannot create executables

michaelsanford

Translator, Web Developer
I have just tried to compile MRTG-2 from source and have received this message configure: error: C compiler cannot create executables.

Code:
krishna:~/Desktop/mrtg-2.14.7 $ ./configure --prefix=/usr/local/mrtg-2
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.

Naturally, we do what we're asked, but it's at the end.

Code:
krishna:~/Desktop/mrtg-2.14.7 $ gcc -v
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5250.obj~12/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 --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5250)

I've got XCodeCore 660.0 (aka XCode Tools 2.2.1) installed on 10.4.7 with all updates, as well as Fink 0.23.10.

Here's config.log; any help is appreciated because this has happened with another application as well (but I assumed it was the program itself that was broken--it looked like it was trying to create an EXE).

Code:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  $ ./configure --prefix=/usr/local/mrtg-2

## --------- ##
## Platform. ##
## --------- ##

hostname = XXXX
uname -m = Power Macintosh
uname -r = 8.7.0
uname -s = Darwin
uname -v = Darwin Kernel Version 8.7.0: Fri May 26 15:20:53 PDT 2006; root:xnu-792.6.76.obj~1/RELEASE_PPC

/usr/bin/uname -p = powerpc
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
hostinfo               = Mach kernel version:
     Darwin Kernel Version 8.7.0: Fri May 26 15:20:53 PDT 2006; root:xnu-792.6.76.obj~1/RELEASE_PPC
Kernel configured for a single processor only.
1 processor is physically available.
Processor type: ppc7450 (PowerPC 7450)
Processor active: 0
Primary memory available: 1.00 gigabytes
Default processor set: 97 tasks, 361 threads, 1 processors
Load average: 2.46, Mach factor: 0.42
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /sw/bin
PATH: /sw/sbin
PATH: /bin
PATH: /sbin
PATH: /usr/bin
PATH: /usr/sbin
PATH: /usr/local/mysql/bin
PATH: /usr/local/bin
PATH: /usr/X11R6/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:1348: checking for gcc
configure:1374: result: gcc
configure:1618: checking for C compiler version
configure:1621: gcc --version </dev/null >&5
powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5250)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:1624: $? = 0
configure:1626: gcc -v </dev/null >&5
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5250.obj~12/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 --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5250)
configure:1629: $? = 0
configure:1631: gcc -V </dev/null >&5
gcc: argument to `-V' is missing
configure:1634: $? = 1
configure:1657: checking for C compiler default output file name
configure:1660: gcc    conftest.c  >&5
/usr/bin/ld: can't locate file for: -lcrt1.o
collect2: ld returned 1 exit status
configure:1663: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:1702: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_env_CC_set=set
ac_cv_env_CC_value=gcc
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_prog_ac_ct_CC=gcc

## ----------------- ##
## Output variables. ##
## ----------------- ##

CC='gcc'
CFLAGS=''
CPP=''
CPPFLAGS=''
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
GDFORM_EXT=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
LDFLAGS=''
LD_RUN_PATH=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
NROFF=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PERL=''
RRD_PERL=''
SET_MAKE=''
SHELL='/bin/sh'
ac_ct_CC='gcc'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${prefix}/share'
exec_prefix='NONE'
host_alias=''
includedir='${prefix}/include'
infodir='${prefix}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='${prefix}/man'
oldincludedir='/usr/include'
prefix='/usr/local/mrtg-2'
program_transform_name='s,x,x,'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""

configure: exit 77

:)
 
I'd suggest moving your Fink installation out of the way temporarily to see if that's causing a problem. Just do:

mv /sw /sw.SAVE

and then try your 'configure' command again, and post back here what you get.
 
Here is the reason your configure script failed:

Code:
configure:1657: checking for C compiler default output file name 
configure:1660: gcc conftest.c >&5 
/usr/bin/ld: can't locate file for: -lcrt1.o 
collect2: ld returned 1 exit status
The problem is crt1.o can't be located so gcc can't link programs that will actually run. On my Linux system, crt1.o is in /usr/lib. I don't know where it will be on OS X.

Good luck!

Peace...
 
crt1.o is in /usr/lib on OS X, too.

I don't think this is necessarily causing the error, but the configure script appears to be using
gcc -V
to get the version of gcc. At least on OS X, this has to be
gcc -v
The former is used not to establish the version, but to specify a version if, say, there are multiple versions of gcc installed this can override the default.

I would be suspicious of the "-lcrt.o" since crt.o is not a library, is it? I'm not sure how this works, though. Normally for library X, say, you'd have X.dylib in /usr/lib or wherever, and you'd pass "-lX". I'm not sure, but OS X is very fussy about libraries - increasingly so, unfortunately.

You could also poke around in the conftest.c to try to figure it out. If other OS X users have the same problem, you might try searching the applications mailing list archives or bug reports or, failing that, post one yourself.

One question would be: can you compile some applications OK or are you having problems with all compilations? If the latter, it obviously isn't a bug in the application but presumably some quirk in your setup. I'm guessing the former, though, but I'm not sure.

- cfr
 
Back
Top