2012-11-14 209 views
7

我試着重新安裝ruby,xcode和其他一些東西,因爲我不斷收到這些奇怪的C編譯器錯誤。在某些時候,我所有的紅寶石卸載於是我開始回到了開始......rvm install 1.9.3失敗

rvm get head && rvm reload 
rvm install 1.9.3 

我得到以下錯誤:

No binary rubies available for: downloads/ruby-1.9.3-p327. 
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies. 
Installing Ruby from source to: /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p327, this may take a while depending on your cpu(s)... 
ruby-1.9.3-p327 - #downloading ruby-1.9.3-p327, this may take a while depending on your connection... 
ruby-1.9.3-p327 - #extracted to /Users/mgriffel/.rvm/src/ruby-1.9.3-p327 (already extracted) 
ruby-1.9.3-p327 - #configuring 
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p327 --with-opt-dir=/Users/mgriffel/.rvm/usr', please read /Users/mgriffel/.rvm/log/ruby-1.9.3-p327/configure.log 
There has been an error while running configure. Halting the installation. 

configure.log我看到:

[2012-11-14 13:21:54] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p327 --with-opt-dir=/Users/mgriffel/.rvm/usr 
checking build system type... x86_64-apple-darwin12.2.0 
checking host system type... x86_64-apple-darwin12.2.0 
checking target system type... x86_64-apple-darwin12.2.0 
checking whether the C compiler works... no 
configure: error: in `/Users/mgriffel/.rvm/src/ruby-1.9.3-p327': 
configure: error: C compiler cannot create executables 
See `config.log' for more details 

而且在的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.68. Invocation command line was 

    $ ./configure --enable-shared --disable-install-doc --prefix=/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p327 --with-opt-dir=/Users/mgriffel/.rvm/usr 

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

hostname = Mattans-MacBook-Air.local 
uname -m = x86_64 
uname -r = 12.2.0 
uname -s = Darwin 
uname -v = Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~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 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 
Kernel configured for up to 4 processors. 
2 processors are physically available. 
4 processors are logically available. 
Processor type: i486 (Intel 80486) 
Processors active: 0 1 2 3 
Primary memory available: 4.00 gigabytes 
Default processor set: 144 tasks, 704 threads, 4 processors 
Load average: 2.79, Mach factor: 1.19 
/bin/machine   = unknown 
/usr/bin/oslevel  = unknown 
/bin/universe   = unknown 

PATH: /Users/mgriffel/.rvm/usr/bin 
PATH: /Users/mgriffel/.rvm/gems/[email protected]/bin 
PATH: /Users/mgriffel/.rvm/gems/[email protected]/bin 
PATH: /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/bin 
PATH: /Users/mgriffel/.rvm/bin 
PATH: /opt/local/bin 
PATH: /opt/local/sbin 
PATH: /usr/local/bin 
PATH: /usr/local/sbin 
PATH: /usr/local/mysql/bin 
PATH: /usr/bin 
PATH: /bin 
PATH: /usr/sbin 
PATH: /sbin 
PATH: /opt/sm/bin 
PATH: /opt/sm/pkg/active/bin 
PATH: /opt/sm/pkg/active/sbin 


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

configure:2769: checking build system type 
configure:2783: result: x86_64-apple-darwin12.2.0 
configure:2851: checking host system type 
configure:2864: result: x86_64-apple-darwin12.2.0 
configure:2884: checking target system type 
configure:2897: result: x86_64-apple-darwin12.2.0 
configure:3378: checking for C compiler version 
configure:3387: /opt/local/bin/gcc-apple-4.2 --version >&5 
i686-apple-darwin12-gcc-apple-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) (MacPorts apple-gcc42 5666.3_9) 
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:3398: $? = 0 
configure:3387: /opt/local/bin/gcc-apple-4.2 -v >&5 
Using built-in specs. 
Target: i686-apple-darwin12 
Configured with: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_apple-gcc42/apple-gcc42/work/objroot/src/configure --disable-checking --prefix=/opt/local --mandir=/opt/local/share/man --enable-languages=c,c++,objc,obj-c++ --libexecdir=/opt/local/libexec/apple-gcc42 --libdir=/opt/local/lib/apple-gcc42 --includedir=/opt/local/include/apple-gcc42 --program-suffix=-apple-4.2 --with-system-zlib --disable-nls --with-slibdir=/usr/lib --build=x86_64-apple-darwin12 --enable-werror-always --program-prefix=i686-apple-darwin12- --host=x86_64-apple-darwin12 --target=i686-apple-darwin12 --with-gxx-include-dir=/usr/include/c++/4.2.1 
Thread model: posix 
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3) (MacPorts apple-gcc42 5666.3_9) 
configure:3398: $? = 0 
configure:3387: /opt/local/bin/gcc-apple-4.2 -V >&5 
gcc-apple-4.2: argument to `-V' is missing 
configure:3398: $? = 1 
configure:3387: /opt/local/bin/gcc-apple-4.2 -qversion >&5 
i686-apple-darwin12-gcc-apple-4.2.1: no input files 
configure:3398: $? = 1 
configure:3418: checking whether the C compiler works 
configure:3440: /opt/local/bin/gcc-apple-4.2 -L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include conftest.c >&5 
i686-apple-darwin12-gcc-apple-4.2.1: CFLAGS=-I/opt/sm/pkg/active/include: No such file or directory 
i686-apple-darwin12-gcc-apple-4.2.1: CPATH=/opt/sm/pkg/active/include: No such file or directory 
configure:3444: $? = 1 
configure:3482: 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 "" 
| #define CANONICALIZATION_FOR_MATHN 1 
| /* end confdefs.h. */ 
| 
| int 
| main() 
| { 
| 
| ; 
| return 0; 
| } 
configure:3487: error: in `/Users/mgriffel/.rvm/src/ruby-1.9.3-p327': 
configure:3489: error: C compiler cannot create executables 
See `config.log' for more details 

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

ac_cv_build=x86_64-apple-darwin12.2.0 
ac_cv_env_CCC_set= 
ac_cv_env_CCC_value= 
ac_cv_env_CC_set=set 
ac_cv_env_CC_value=/opt/local/bin/gcc-apple-4.2 
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_CXXFLAGS_set= 
ac_cv_env_CXXFLAGS_value= 
ac_cv_env_CXX_set= 
ac_cv_env_CXX_value= 
ac_cv_env_LDFLAGS_set=set 
ac_cv_env_LDFLAGS_value='-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include' 
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-darwin12.2.0 
ac_cv_prog_CC=/opt/local/bin/gcc-apple-4.2 
ac_cv_target=x86_64-apple-darwin12.2.0 

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

ALLOCA='' 
AR='' 
ARCHFILE='' 
ARCH_FLAG='' 
AS='' 
ASFLAGS='' 
BASERUBY='echo executable host ruby is required. use --with-baseruby option.; false' 
BUILTIN_ENCOBJS='' 
BUILTIN_TRANSOBJS='' 
BUILTIN_TRANSSRCS='' 
CAPITARGET='' 
CC='/opt/local/bin/gcc-apple-4.2' 
CCDLFLAGS='' 
CFLAGS='' 
CHDIR='' 
COMMON_HEADERS='' 
COMMON_LIBS='' 
COMMON_MACROS='' 
COUTFLAG='' 
CP='' 
CPP='' 
CPPFLAGS='' 
CPPOUTFILE='' 
CXX='' 
CXXFLAGS='' 
DEFS='' 
DLDFLAGS='' 
DLDLIBS='' 
DLEXT2='' 
DLEXT='' 
DLLWRAP='' 
DOT='' 
DOXYGEN='' 
ECHO_C='\c' 
ECHO_N='' 
ECHO_T='' 
EGREP='' 
ENABLE_SHARED='' 
EXECUTABLE_EXTS='' 
EXEEXT='' 
EXPORT_PREFIX='' 
EXTOUT='' 
EXTSTATIC='' 
GCC='' 
GNU_LD='' 
GREP='' 
INSTALLDOC='' 
INSTALL_DATA='' 
INSTALL_PROGRAM='' 
INSTALL_SCRIPT='' 
LDFLAGS='-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include' 
LDSHARED='' 
LDSHAREDXX='' 
LIBEXT='' 
LIBOBJS='' 
LIBPATHENV='' 
LIBPATHFLAG='' 
LIBRUBY='' 
LIBRUBYARG='' 
LIBRUBYARG_SHARED='' 
LIBRUBYARG_STATIC='' 
LIBRUBY_A='' 
LIBRUBY_ALIASES='' 
LIBRUBY_DLDFLAGS='' 
LIBRUBY_LDSHARED='' 
LIBRUBY_RELATIVE='' 
LIBRUBY_SO='' 
LIBS='' 
LINK_SO='' 
LN_S='' 
LTLIBOBJS='' 
MAINLIBS='' 
MAJOR='1' 
MAKEDIRS='' 
MAKEFILES='' 
MANTYPE='' 
MINIOBJS='' 
MINIRUBY='' 
MINOR='9' 
MKDIR_P='' 
NM='' 
NROFF='' 
NULLCMD='' 
OBJCOPY='' 
OBJDUMP='' 
OBJEXT='' 
OUTFLAG='' 
PACKAGE='' 
PACKAGE_BUGREPORT='' 
PACKAGE_NAME='' 
PACKAGE_STRING='' 
PACKAGE_TARNAME='' 
PACKAGE_URL='' 
PACKAGE_VERSION='' 
PATH_SEPARATOR=':' 
PKG_CONFIG='' 
PLATFORM_DIR='' 
PREP='' 
RANLIB='' 
RDOCTARGET='' 
RI_BASE_NAME='' 
RM='' 
RMALL='' 
RMDIR='' 
RMDIRS='' 
RPATHFLAG='' 
RUBYW_BASE_NAME='rubyw' 
RUBYW_INSTALL_NAME='' 
RUBY_BASE_NAME='ruby' 
RUBY_INSTALL_NAME='' 
RUBY_PROGRAM_VERSION='1.9.3' 
RUBY_RELEASE_DATE='2012-11-10' 
RUBY_SO_NAME='' 
RUNRUBY='' 
SET_MAKE='' 
SHELL='/bin/sh' 
SOLIBS='' 
STATIC='' 
STRIP='' 
SYMBOL_PREFIX='' 
TEENY='1' 
TEST_RUNNABLE='' 
THREAD_MODEL='' 
TRY_LINK='' 
UNIVERSAL_ARCHNAMES='' 
UNIVERSAL_INTS='' 
USE_RUBYGEMS='' 
WERRORFLAG='' 
WINDRES='' 
XCFLAGS='' 
XLDFLAGS='' 
XRUBY='' 
XRUBY_LIBDIR='' 
XRUBY_RUBYHDRDIR='' 
XRUBY_RUBYLIBDIR='' 
ac_ct_CC='' 
ac_ct_CXX='' 
ac_ct_OBJCOPY='' 
ac_ct_OBJDUMP='' 
arch='' 
bindir='${exec_prefix}/bin' 
build='x86_64-apple-darwin12.2.0' 
build_alias='' 
build_cpu='x86_64' 
build_os='darwin12.2.0' 
build_vendor='apple' 
cflags=' ${optflags} ${debugflags} ${warnflags}' 
configure_args='' 
cppflags='' 
cxxflags=' ${optflags} ${debugflags} ${warnflags}' 
datadir='${datarootdir}' 
datarootdir='${prefix}/share' 
debugflags='' 
docdir='${datarootdir}/doc/${PACKAGE}' 
dvidir='${docdir}' 
exec='' 
exec_prefix='NONE' 
host='x86_64-apple-darwin12.2.0' 
host_alias='' 
host_cpu='x86_64' 
host_os='darwin12.2.0' 
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' 
oldincludedir='/usr/include' 
optflags='' 
pdfdir='${docdir}' 
prefix='/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p327' 
program_transform_name='s&^&&' 
psdir='${docdir}' 
ridir='' 
ruby_pc='' 
ruby_version='' 
rubyhdrdir='' 
rubylibprefix='' 
rubyw_install_name='' 
sbindir='${exec_prefix}/sbin' 
setup='' 
sharedstatedir='${prefix}/com' 
sitearch='' 
sitedir='' 
sitehdrdir='' 
sysconfdir='${prefix}/etc' 
target='x86_64-apple-darwin12.2.0' 
target_alias='' 
target_cpu='x86_64' 
target_os='darwin12.2.0' 
target_vendor='apple' 
try_header='' 
vendordir='' 
vendorhdrdir='' 
warnflags='' 

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

/* confdefs.h */ 
#define PACKAGE_NAME "" 
#define PACKAGE_TARNAME "" 
#define PACKAGE_VERSION "" 
#define PACKAGE_STRING "" 
#define PACKAGE_BUGREPORT "" 
#define PACKAGE_URL "" 
#define CANONICALIZATION_FOR_MATHN 1 

configure: exit 77 

我不能爲我的生活找出什麼是錯的,我一直在這裏呆了幾天。任何幫助在這裏將不勝感激。

注意:我已經安裝了最新版本的Xcode和CLT。

+0

xcode和ruby在這個問題上有關係嗎?你想做什麼,涉及到Ruby和Xcode?問題何時開始? – Ali

+0

是的阿里我正在安裝紅寶石,並且一旦我更新了Xcode和命令行工具,問題就發生了。 Louiscoquio,這是一個很好的觀點。我應該回去爲每個問題選擇一個答案! – mattangriffel

+0

你有沒有解決這個問題的運氣?它看起來像你的編譯器來自macports而不是xcode/CLT。我不使用macports所以我不能確認你的問題。也許你可以臨時將你的macports/opt/local移出你的路徑,看看使用系統編譯器是否有幫助。 – morri

回答

11

事實證明,這是RailsInstaller OSX 1.0.3中的錯誤 - (發現了這一點,而讀Problems installing Ruby on Mountain Lion - ruby 1.9.3 wont' compile

我需要改變/etc/rvmrc包含此:

umask g+w 
export -a rvm_configure_env 
rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib' 'CFLAGS=-I/opt/sm/pkg/active/include' 'CPATH=/opt/sm/pkg/active/include') 

欲瞭解更多信息請參閱:https://github.com/railsinstaller/railsinstaller-nix/issues/10

+0

哇,非常感謝發佈這個答案。我昨天晚上花了幾個小時試圖在其他論壇/博客/問題中提到的所有事情都沒有成功,並稱它爲一個晚上。今天早上你是我遵循的第一篇文章,現在我不僅有1.9.3,而且還有2.0.0。乾杯! – saihgala

1

爲了讓ruby在我使用Mountain Lion和xcode 4.5.2的mac上編譯,我必須創建一個從gcc-4.2到我的路徑上某處gcc的軟鏈接。我最初發現的建議在本頁面:https://gist.github.com/1860902

也許它會幫助你:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2 

如果沒有幫助,您可以將其刪除:

sudo rm /usr/bin/gcc-4.2 

祝你好運!

+0

這沒有幫助:\ – mattangriffel

+0

看起來像當我安裝OSX Maverick和XCode 5時,它以某種方式更改了gcc名稱。感謝張貼,因爲我今天花了2個小時試圖解決這個噩夢般的問題。 –

0

mattangriffel的解決方案爲我做了。就我而言,我的第三條線幾乎是相同的,但在那裏,他

rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib' 'CFLAGS=-I/opt/sm/pkg/active/include' 'CPATH=/opt/sm/pkg/active/include') 

rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include') 

固定礦山看起來像他的伎倆。