macos 配置:错误:C 编译器无法在 mac os 终端中创建可执行文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6134745/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:05:12  来源:igfitidea点击:

configure: error: C compiler cannot create executables in mac os terminal

cmacoscompiler-constructionterminalios-4.2

提问by R. Dewi

i'm trying to Building libCURL in iOS 4.2, i do some steps in the terminal. The steps are :

我正在尝试在 iOS 4.2 中构建 libCURL,我在终端中执行了一些步骤。步骤是:

  1. cd curl-7.21.2
  2. export CC=/Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1
  3. export CFLAGS="-isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"
  4. export LDFLAGS="-isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"
  5. export CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp
  6. ./configure --disable-shared --without-ssl --without-libssh2 --without-ca-bundle --without-ldap --disable-ldap --host=arm-apple-darwin10
  1. cd curl-7.21.2
  2. export CC=/Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1
  3. export CFLAGS="-isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"
  4. export LDFLAGS="-isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"
  5. export CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp
  6. ./configure --disable-shared --without-ssl --without-libssh2 --without-ca-bundle --without-ldap --disable-ldap --host=arm-apple-darwin10

but after tap enter the terminal show me these warnings and errors :

但在点击进入终端后,向我显示这些警告和错误:

configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether to enable debug build options... no
checking whether to enable compiler optimizer... (assumed) yes
checking whether to enable strict compiler warnings... no
checking whether to enable compiler warnings as errors... no
checking whether to enable curl debug memory tracking... no
checking whether to enable c-ares for DNS lookups... no
checking for sed... /usr/bin/sed
checking for grep... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for arm-apple-darwin10-ar... no
checking for ar... /usr/bin/ar
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 arm-apple-darwin10-strip... no
checking for strip... strip
checking curl version... 7.21.6
checking build system type... i386-apple-darwin10.6.0
checking host system type... arm-apple-darwin10
checking for style of include used by make... GNU
checking for arm-apple-darwin10-gcc... /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1
checking whether the C compiler works... no
configure: error: in `/Users/sikmac2/desktop/curl-7.21.6':
configure: error: C compiler cannot create executables
See `config.log' for more details

this is the config.log :

这是 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 curl configure -, which was
generated by GNU Autoconf 2.68.  Invocation command line was

  $ ./configure --disable-shared --without-ssl --without-libssh2 --without-ca-bundle --without-ldap --disable-ldap --host=arm-apple-darwin10

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

hostname = sikmac2s-MacBook.local
uname -m = i386
uname -r = 10.6.0
uname -s = Darwin
uname -v = Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386

/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 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386
Kernel configured for up to 2 processors.
2 processors are physically available.
2 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1
Primary memory available: 2.00 gigabytes
Default processor set: 84 tasks, 416 threads, 2 processors
Load average: 0.49, Mach factor: 1.65
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/bin
PATH: /usr/X11/bin


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

configure:2693: checking whether to enable maintainer-specific portions of Makefiles
configure:2702: result: no
configure:2719: checking whether to enable debug build options
configure:2738: result: no
configure:2742: checking whether to enable compiler optimizer
configure:2763: result: (assumed) yes
configure:2775: checking whether to enable strict compiler warnings
configure:2794: result: no
configure:2798: checking whether to enable compiler warnings as errors
configure:2817: result: no
configure:2821: checking whether to enable curl debug memory tracking
configure:2840: result: no
configure:2854: checking whether to enable c-ares for DNS lookups
configure:2876: result: no
configure:2898: checking for sed
configure:2917: found /usr/bin/sed
configure:2930: result: /usr/bin/sed
configure:2947: checking for grep
configure:2966: found /usr/bin/grep
configure:2979: result: /usr/bin/grep
configure:2995: checking for egrep
configure:2998: result: /usr/bin/grep -E
configure:3054: checking for arm-apple-darwin10-ar
configure:3088: result: no
configure:3098: checking for ar
configure:3117: found /usr/bin/ar
configure:3129: result: /usr/bin/ar
configure:3208: checking for a BSD-compatible install
configure:3276: result: /usr/bin/install -c
configure:3287: checking whether build environment is sane
configure:3324: result: yes
configure:3386: checking for gawk
configure:3416: result: no
configure:3386: checking for mawk
configure:3416: result: no
configure:3386: checking for nawk
configure:3416: result: no
configure:3386: checking for awk
configure:3402: found /usr/bin/awk
configure:3413: result: awk
configure:3424: checking whether make sets $(MAKE)
configure:3446: result: yes
configure:3520: checking for arm-apple-darwin10-strip
configure:3550: result: no
configure:3560: checking for strip
configure:3576: found /usr/bin/strip
configure:3587: result: strip
configure:3624: checking curl version
configure:3626: result: 7.21.6
configure:3667: checking build system type
configure:3681: result: i386-apple-darwin10.6.0
configure:3701: checking host system type
configure:3714: result: arm-apple-darwin10
configure:3752: checking for style of include used by make
configure:3780: result: GNU
configure:3816: checking for arm-apple-darwin10-gcc
configure:3843: result: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1
configure:4112: checking for C compiler version
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 --version >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -v >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -V >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -qversion >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4151: checking whether the C compiler works
configure:4173: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk  -isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk conftest.c  >&5
./configure: line 4175: /Developer: is a directory
configure:4177: $? = 126
configure:4215: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "curl"
| #define PACKAGE_TARNAME "curl"
| #define PACKAGE_VERSION "-"
| #define PACKAGE_STRING "curl -"
| #define PACKAGE_BUGREPORT "a suitable curl mailing list: http://curl.haxx.se/mail/"
| #define PACKAGE_URL ""
| #define PACKAGE "curl"
| #define VERSION "-"
| #define OS "arm-apple-darwin10"
| /* end confdefs.h.  */
| 
| int main (void)
| {
| 
|  ;
|  return 0;
| }
configure:4220: error: in `/Users/sikmac2/desktop/curl-7.21.6':
configure:4222: error: C compiler cannot create executables
See `config.log' for more details

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

ac_cv_build=i386-apple-darwin10.6.0
ac_cv_env_CC_set=set
ac_cv_env_CC_value='/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1'
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk'
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=set
ac_cv_env_CPP_value='/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp'
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk'
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=set
ac_cv_env_host_alias_value=arm-apple-darwin10
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=arm-apple-darwin10
ac_cv_path_GREP=/usr/bin/grep
ac_cv_path_SED=/usr/bin/sed
ac_cv_path_ac_pt_AR=/usr/bin/ar
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=awk
ac_cv_prog_CC='/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1'
ac_cv_prog_ac_ct_STRIP=strip
ac_cv_prog_make_make_set=yes
curl_cv_PATH_SEPARATOR=:

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

ACLOCAL='${SHELL} "/Users/sikmac2/desktop/curl-7.21.6/missing" --run aclocal-1.9'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='${SHELL} "/Users/sikmac2/desktop/curl-7.21.6/missing" --run tar'
AR='/usr/bin/ar'
AS=''
AUTOCONF='${SHELL} "/Users/sikmac2/desktop/curl-7.21.6/missing" --run autoconf'
AUTOHEADER='${SHELL} "/Users/sikmac2/desktop/curl-7.21.6/missing" --run autoheader'
AUTOMAKE='${SHELL} "/Users/sikmac2/desktop/curl-7.21.6/missing" --run automake-1.9'
AWK='awk'
BUILD_LIBHOSTNAME_FALSE=''
BUILD_LIBHOSTNAME_TRUE=''
CC='/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1'
CCDEPMODE=''
CFLAGS='-isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk'
CONFIGURE_OPTIONS='" '\''--disable-shared'\'' '\''--without-ssl'\'' '\''--without-libssh2'\'' '\''--without-ca-bundle'\'' '\''--without-ldap'\'' '\''--disable-ldap'\'' '\''--host=arm-apple-darwin10'\'' '\''host_alias=arm-apple-darwin10'\'' '\''CC=/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1'\'' '\''CFLAGS=-isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk'\'' '\''LDFLAGS=-isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk'\'' '\''CPP=/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp'\''"'
CPP='/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp'
CPPFLAGS=''
CROSSCOMPILING_FALSE=''
CROSSCOMPILING_TRUE=''
CURLDEBUG_FALSE=''
CURLDEBUG_TRUE=''
CURLVERSION='7.21.6'
CURL_CA_BUNDLE=''
CURL_CFLAG_EXTRAS=''
CURL_DISABLE_DICT=''
CURL_DISABLE_FILE=''
CURL_DISABLE_FTP=''
CURL_DISABLE_GOPHER=''
CURL_DISABLE_HTTP=''
CURL_DISABLE_IMAP=''
CURL_DISABLE_LDAP=''
CURL_DISABLE_LDAPS=''
CURL_DISABLE_POP3=''
CURL_DISABLE_PROXY=''
CURL_DISABLE_RTSP=''
CURL_DISABLE_SMTP=''
CURL_DISABLE_TELNET=''
CURL_DISABLE_TFTP=''
CURL_LIBS=''
CURL_NETWORK_LIBS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP='/usr/bin/grep -E'
ENABLE_SHARED=''
EXEEXT=''
FGREP=''
GREP='/usr/bin/grep'
HAVE_GNUTLS_SRP=''
HAVE_LDAP_SSL=''
HAVE_LIBZ=''
HAVE_LIBZ_FALSE=''
HAVE_LIBZ_TRUE=''
HAVE_PK11_CREATEGENERICOBJECT=''
HAVE_SSLEAY_SRP=''
IDN_ENABLED=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s'
IPV6_ENABLED=''
KRB4_ENABLED=''
LD=''
LDFLAGS='-isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk'
LIBCURL_LIBS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
MAINT='#'
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE='#'
MAKEINFO='${SHELL} "/Users/sikmac2/desktop/curl-7.21.6/missing" --run makeinfo'
MANIFEST_TOOL=''
MANOPT=''
MIMPURE_FALSE=''
MIMPURE_TRUE=''
NM=''
NMEDIT=''
NO_UNDEFINED_FALSE=''
NO_UNDEFINED_TRUE=''
NROFF=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='curl'
PACKAGE_BUGREPORT='a suitable curl mailing list: http://curl.haxx.se/mail/'
PACKAGE_NAME='curl'
PACKAGE_STRING='curl -'
PACKAGE_TARNAME='curl'
PACKAGE_URL=''
PACKAGE_VERSION='-'
PATH='/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin'
PATH_SEPARATOR=':'
PERL=''
PKGADD_NAME='cURL - a client that groks URLs'
PKGADD_PKG='HAXXcurl'
PKGADD_VENDOR='curl.haxx.se'
PKGCONFIG=''
RANDOM_FILE=''
RANLIB=''
REQUIRE_LIB_DEPS=''
SED='/usr/bin/sed'
SET_MAKE=''
SHELL='/bin/sh'
SONAME_BUMP_FALSE=''
SONAME_BUMP_TRUE=''
SSL_ENABLED=''
STATICLIB_FALSE=''
STATICLIB_TRUE=''
STRIP='strip'
SUPPORT_FEATURES=''
SUPPORT_PROTOCOLS=''
TEST_SERVER_LIBS=''
USE_ARES=''
USE_AXTLS=''
USE_CYASSL=''
USE_EMBEDDED_ARES_FALSE=''
USE_EMBEDDED_ARES_TRUE=''
USE_GNUTLS=''
USE_LIBRTMP=''
USE_LIBSSH2=''
USE_MANUAL_FALSE=''
USE_MANUAL_TRUE=''
USE_NSS=''
USE_OPENLDAP=''
USE_POLARSSL=''
USE_SSLEAY=''
USE_WINDOWS_SSPI=''
VERSION='-'
VERSIONNUM='071506'
ac_ct_AR=''
ac_ct_CC=''
ac_ct_DUMPBIN=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include='include'
am__leading_dot='.'
am__quote=''
am__tar='${AMTAR} chof - "$$tardir"'
am__untar='${AMTAR} xf -'
bindir='${exec_prefix}/bin'
build='i386-apple-darwin10.6.0'
build_alias=''
build_cpu='i386'
build_os='darwin10.6.0'
build_vendor='apple'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='arm-apple-darwin10'
host_alias='arm-apple-darwin10'
host_cpu='arm'
host_os='darwin10'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='/Users/sikmac2/desktop/curl-7.21.6/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
libext=''
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(mkinstalldirs)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
subdirs=''
sysconfdir='${prefix}/etc'
target_alias=''

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

/* confdefs.h */
#define PACKAGE_NAME "curl"
#define PACKAGE_TARNAME "curl"
#define PACKAGE_VERSION "-"
#define PACKAGE_STRING "curl -"
#define PACKAGE_BUGREPORT "a suitable curl mailing list: http://curl.haxx.se/mail/"
#define PACKAGE_URL ""
#define PACKAGE "curl"
#define VERSION "-"
#define OS "arm-apple-darwin10"

configure: exit 77

base on Bavarious comments, i've change all the command in every step, these are the update :

基于巴伐利亚评论,我在每一步都更改了所有命令,这些是更新:

  1. export CC='\"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1\">
  2. export CFLAGS="-isysroot \"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk\""
  3. export LDFLAGS="-isysroot \"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot \"/Developer 4.2/Platforms/icleaPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"""
  4. export CPP='\"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp">
  5. ./configure --disable-shared --without-ssl --without-libssh2 --without-ca-bundle --without-ldap --disable-ldap --host=arm-apple-darwin10
  1. export CC='\"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1\">
  2. export CFLAGS="-isysroot \"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk\""
  3. export LDFLAGS="-isysroot \"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot \"/Developer 4.2/Platforms/icleaPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"""
  4. export CPP='\"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp">
  5. ./configure --disable-shared --without-ssl --without-libssh2 --without-ca-bundle --without-ldap --disable-ldap --host=arm-apple-darwin10

but it make the terminal did not execute the command.

但它使终端没有执行命令。

i dont understand what it is, can somebody tell me?

我不明白它是什么,有人可以告诉我吗?

Thank you

谢谢

回答by JZ.

If you are on Lion try installing with the tag: --with-gcc=clang

如果您使用 Lion,请尝试使用以下标签进行安装: --with-gcc=clang

Running rvm requirementsexplains this in more detail:

跑步rvm requirements更详细地解释了这一点:

Xcode 4.2:
 * is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
 * it breaks gems with native extensions, especially DB drivers.

Xcode 4.2 users - please be warned - 
in case of any compilation issues 
 * downgrade to Xcode 4.1
 * or install osx-gcc-installer
and reinstall your rubies.

回答by Jonathan Leffler

The problem is the spaces in the pathnames. What's more, there isn't an easy fix until you remove them.

问题是路径名中的空格。更重要的是,在您删除它们之前,没有简单的修复方法。

The trouble is in the log file - it just appears near the middle of it...

问题出在日志文件中——它只是出现在它的中间附近......

configure:4112: checking for C compiler version
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 --version >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -v >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -V >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -qversion >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4151: checking whether the C compiler works
configure:4173: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk  -isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk conftest.c  >&5
./configure: line 4175: /Developer: is a directory
configure:4177: $? = 126
configure:4215: result: no

To get the paths with the spaces to work, you'd have to be able to ensure that whenever CCis used, the path is enclosed in double quotes. You'd also have to fettle your CFLAGSvalue so that the path is not split but the -isysrootis separate from the path leading to -isysroot.

要使带有空格的路径起作用,您必须能够确保无论何时CC使用,路径都用双引号括起来。您还必须调整您的CFLAGS价值,以便路径不会被拆分,但与-isysroot通向-isysroot.

If you want to get adventurous, you can try using:

如果您想冒险,可以尝试使用:

export CC="\"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1\""
export CFLAGS="-isysroot \"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk\""

There's an outside chance it will work, but I'd not want to rely on it. Basically, it adds double quotes at judiciously selected points in the values of the environment variables, in the hope that the shell will manage to keep them in the right places. I don't think it will work, but it might be worth a try.

它有一个外部的机会它会起作用,但我不想依赖它。基本上,它在环境变量值中明智选择的点添加双引号,希望 shell 能够设法将它们保留在正确的位置。我不认为它会起作用,但它可能值得一试。

I recommend renaming the path where you have the software installed without the space, maybe as:

我建议在没有空格的情况下重命名安装软件的路径,可能是:

/Developer-4.2/Platforms/...

(I had a directory $HOME/External Source Repositoriesbriefly, with areas for gitand svnand hg(Mercurial) copies of external source repositories, including the VCS's mentioned. The VCS were OK with the spaces in the names, but the build processes for the downloaded repositories (including the VCS own build systems) were not (gitincluded, IIRC). The directory is now called $HOME/External-Source-Repositoriesinstead.)

(我有一个目录$HOME/External Source Repositories简单地说,与地区gitsvnhg外源存储库(水银)的副本,其中包括VCS的提及。该VCS是名称中带有空格确定,但已下载资源库的构建过程(包括VCS自己构建系统)不是(git包括,IIRC)。现在$HOME/External-Source-Repositories改为调用该目录。)