我遇到与c compiler cannot create executable on mac类似的问题。看起来该线程的最终建议是卸载gcc。没有卸载gcc有没有办法解决这个问题?我似乎记得安装gcc以使另一个软件正常工作,我担心卸载它可能会导致其他问题。
非常感谢任何建议!
以下是更多信息:
我正在运行OSX 10.7.5 Lion,我有GCC版本4.2.1,以及安装了命令行工具的XCode 4.4.1。
按照http://heasarc.gsfc.nasa.gov/fitsio/mac_universal_binary.html上的说明,我发生错误时尝试安装名为cfitsio的IRAF包:
解压缩cfitsio源代码tar文件 cd cfitsio setenv CFLAGS“-arch ppc -arch i386 -g -O2” 然后继续使用标准的cfitsio构建,即: 。/配置 使 make install
问题是我在./configure步骤中遇到错误,与gcc有关。这是config.log:
--------------Begin config.log----------------------
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.69. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
hostname = vpnls09.ctio.noao.edu
uname -m = x86_64
uname -r = 11.4.2
uname -s = Darwin
uname -v = Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = Mach kernel version:
Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64
Kernel configured for up to 8 processors.
4 processors are physically available.
8 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 8.00 gigabytes
Default processor set: 165 tasks, 1106 threads, 8 processors
Load average: 0.39, Mach factor: 7.60
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: .
PATH: /Users/kaleida/anaconda/bin
PATH: /Users/kaleida/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /sw/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2107: checking build system type
configure:2121: result: x86_64-apple-darwin11.4.2
configure:2141: checking host system type
configure:2154: result: x86_64-apple-darwin11.4.2
configure:2174: checking target system type
configure:2187: result: x86_64-apple-darwin11.4.2
configure:2348: checking for gcc
configure:2364: found /usr/bin/gcc
configure:2375: result: gcc
configure:2604: checking for C compiler version
configure:2613: gcc --version >&5
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 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:2624: $? = 0
configure:2613: gcc -v >&5
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~28/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~28/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
configure:2624: $? = 0
configure:2613: gcc -V >&5
llvm-gcc-4.2: argument to `-V' is missing
configure:2624: $? = 1
configure:2613: gcc -qversion >&5
i686-apple-darwin11-llvm-gcc-4.2: no input files
configure:2624: $? = 1
configure:2644: checking whether the C compiler works
configure:2666: gcc -arch ppc -arch i386 -g -O2 conftest.c >&5
llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/23/wqjyjh2s0fb4_kss3f9cr_zc0000gn/T//ccFUu7Aa.out
configure:2670: $? = 255
configure:2708: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2713: error: in `/Users/kaleida/src/cfitsio':
configure:2715: error: C compiler cannot create executables
See `config.log' for more details
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=x86_64-apple-darwin11.4.2
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-arch ppc -arch i386 -g -O2'
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_LIBS_set=
ac_cv_env_LIBS_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_host=x86_64-apple-darwin11.4.2
ac_cv_prog_ac_ct_CC=gcc
ac_cv_target=x86_64-apple-darwin11.4.2
## ----------------- ##
## Output variables. ##
## ----------------- ##
AR=''
ARCH=''
ARCHIVE=''
CC='gcc'
CFITSIO_MAJOR='3'
CFITSIO_MINOR='37'
CFITSIO_SHLIB=''
CFITSIO_SHLIB_SONAME=''
CFITSIO_SONAME='2'
CFLAGS='-arch ppc -arch i386 -g -O2'
CPP=''
CPPFLAGS=''
DEFS=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
EXEEXT=''
F77_WRAPPERS=''
FC=''
GCCVERSION=''
GREP=''
INSTALL_ROOT=''
LDFLAGS=''
LIBOBJS=''
LIBPRE=''
LIBS=''
LTLIBOBJS=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
SHELL='/bin/sh'
SHLIB_LD=''
SHLIB_SUFFIX=''
SSE_FLAGS=''
ac_ct_CC='gcc'
bindir='${exec_prefix}/bin'
build='x86_64-apple-darwin11.4.2'
build_alias=''
build_cpu='x86_64'
build_os='darwin11.4.2'
build_vendor='apple'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-apple-darwin11.4.2'
host_alias=''
host_cpu='x86_64'
host_os='darwin11.4.2'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
my_shmem=''
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target='x86_64-apple-darwin11.4.2'
target_alias=''
target_cpu='x86_64'
target_os='darwin11.4.2'
target_vendor='apple'
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
configure: exit 77
--------------End config.log----------------------
以下是有关我机器上gcc的更多信息:
[vpnls09:~] kaleida% which gcc
/usr/bin/gcc
[vpnls09:~] kaleida% gcc -version
i686-apple-darwin11-llvm-gcc-4.2: no input files
[vpnls09:~] kaleida% gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
我还用“Hello World”脚本测试了gcc:
[vpnls09:~/src] kaleida% more hello.c
/* hello.c - demo for os x */
#include<stdio.h>
int main(void){
printf("Hello world\n");
return 0;
}
[vpnls09:~/src] kaleida% gcc -o hello.o -c hello.c
[vpnls09:~/src] kaleida% make hello
cc hello.o -o hello
[vpnls09:~/src] kaleida% ./hello
Hello world
有关如何解决此问题的任何想法?
提前致谢!