Can';t使用RVM–在Lion下安装Ruby;海湾合作委员会问题

Can';t使用RVM–在Lion下安装Ruby;海湾合作委员会问题,ruby,gcc,rvm,osx-lion,xcode4.2,Ruby,Gcc,Rvm,Osx Lion,Xcode4.2,关于这个问题的大多数问题是由于缺少Xcode;我已经安装了Xcode 4.2 安装尝试: rvm install 1.9.3 Installing Ruby from source to: /Users/jamie/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)... ruby-1.9.3-p0 - #fetching ruby-1.9.3-p0 - #extracted to /Users/

关于这个问题的大多数问题是由于缺少Xcode;我已经安装了Xcode 4.2

安装尝试:

rvm install 1.9.3
Installing Ruby from source to: /Users/jamie/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...

ruby-1.9.3-p0 - #fetching 
ruby-1.9.3-p0 - #extracted to /Users/jamie/.rvm/src/ruby-1.9.3-p0 (already extracted)
Fetching yaml-0.1.4.tar.gz to /Users/jamie/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/jamie/.rvm/src
Configuring yaml in /Users/jamie/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/jamie/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/jamie/.rvm/usr
ruby-1.9.3-p0 - #configuring 
ERROR: Error running ' ./configure --prefix=/Users/jamie/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/jamie/.rvm/usr ', please read /Users/jamie/.rvm/log/ruby-1.9.3-p0/configure.log
ERROR: There has been an error while running configure. Halting the installation.
configure.log:

[2011-11-07 04:32:17]  ./configure --prefix=/Users/jamie/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/jamie/.rvm/usr 
configure: WARNING: unrecognized options: --with-libyaml-dir
checking build system type... x86_64-apple-darwin11.2.0
checking host system type... x86_64-apple-darwin11.2.0
checking target system type... x86_64-apple-darwin11.2.0
checking whether the C compiler works... no
configure: error: in `/Users/jamie/.rvm/src/ruby-1.9.3-p0':
configure: error: C compiler cannot create executables
See `config.log' for more details
GCC可提供:

gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~1/src/configure --disable-checking --enable-werror --prefix=/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.1~1/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.1.00)

ls /usr/bin | grep gcc         
gcc
i686-apple-darwin11-llvm-gcc-4.2
llvm-gcc
llvm-gcc-4.2
基于config.log(由于大小而在底部发布),我尝试将gcc-4.2符号链接到gcc,然后安装:

rvm install 1.9.3                       
ERROR: The autodetected CC(/usr/bin/gcc-4.2) is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`, and set CC=/path/to/gcc .
所以我可能会在其他地方抓住gcc,但我最关心的是为什么会发生这种情况。安装Xcode还不够吗

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 --prefix=/Users/jamie/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/jamie/.rvm/usr

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

hostname = Wilson.local
uname -m = x86_64
uname -r = 11.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~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.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64
Kernel configured for up to 4 processors.
4 processors are physically available.
4 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3
Primary memory available: 8.00 gigabytes
Default processor set: 110 tasks, 546 threads, 4 processors
Load average: 1.28, Mach factor: 2.71
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /Users/jamie/.rvm/usr/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/bin
PATH: /usr/X11/bin
PATH: /Users/jamie/bin
PATH: /Users/jamie/.rvm/bin
PATH: /Users/jamie/.rvm/bin


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

configure:2764: checking build system type
configure:2778: result: x86_64-apple-darwin11.2.0
configure:2849: checking host system type
configure:2862: result: x86_64-apple-darwin11.2.0
configure:2882: checking target system type
configure:2895: result: x86_64-apple-darwin11.2.0
configure:3376: checking for C compiler version
configure:3385: gcc-4.2 --version >&5
./configure: line 3387: gcc-4.2: command not found
configure:3396: $? = 127
configure:3385: gcc-4.2 -v >&5
./configure: line 3387: gcc-4.2: command not found
configure:3396: $? = 127
configure:3385: gcc-4.2 -V >&5
./configure: line 3387: gcc-4.2: command not found
configure:3396: $? = 127
configure:3385: gcc-4.2 -qversion >&5
./configure: line 3387: gcc-4.2: command not found
configure:3396: $? = 127
configure:3416: checking whether the C compiler works
configure:3438: gcc-4.2    conftest.c  >&5
./configure: line 3440: gcc-4.2: command not found
configure:3442: $? = 127
configure:3480: 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:3485: error: in `/Users/jamie/.rvm/src/ruby-1.9.3-p0':
configure:3487: error: C compiler cannot create executables
See `config.log' for more details

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

ac_cv_build=x86_64-apple-darwin11.2.0
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
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=
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.2.0
ac_cv_prog_CC=gcc-4.2
ac_cv_target=x86_64-apple-darwin11.2.0

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

ALLOCA=''
AR=''
ARCHFILE=''
ARCH_FLAG=''
AS=''
ASFLAGS=''
BASERUBY='ruby'
BUILTIN_ENCOBJS=''
BUILTIN_TRANSOBJS=''
BUILTIN_TRANSSRCS=''
CAPITARGET=''
CC='gcc-4.2'
CCDLFLAGS=''
CFLAGS=''
CHDIR=''
COMMON_HEADERS=''
COMMON_LIBS=''
COMMON_MACROS=''
COUTFLAG=''
CP=''
CPP=''
CPPFLAGS=''
CPPOUTFILE=''
CXX='g++-4.2'
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=''
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=''
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='2011-10-30'
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-darwin11.2.0'
build_alias=''
build_cpu='x86_64'
build_os='darwin11.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-darwin11.2.0'
host_alias=''
host_cpu='x86_64'
host_os='darwin11.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/jamie/.rvm/rubies/ruby-1.9.3-p0'
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-darwin11.2.0'
target_alias=''
target_cpu='x86_64'
target_os='darwin11.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
该答案经过多次编辑,现在包含多个备选解决方案。首先尝试简单的“编辑3”解决方案

,因此,如果要安装这样的版本,则不需要GCC。如果您正在安装旧版本的Ruby,请继续阅读

要使用GCC编译Ruby,您需要一个非LLVM版本的GCC,它不再包含在Xcode 4.2中。自己安装(或暂时降级到Xcode 4.1),然后执行
CC=/usr/local/bin/gcc-4.2 rvm安装1.9.3--启用共享
(替换非LLVM gcc的路径)

编辑:可能有助于安装GCC。运行
rvm requirements
也可以获得一些信息

编辑2:为了更简单的解决方案,您可以尝试将
--with gcc=clang
添加到
configure
的参数中,以便Ruby使用clang而不是gcc

编辑3
rvm安装1.9.3——使用gcc=clang
可以为您完成这项工作

注意:对于当前版本的Xcode,您需要在Xcode菜单->首选项->下载->组件中单独安装命令行工具。这是在命令行上使用Xcode进行任何编译的先决条件,而不仅仅是Ruby

注意2:如果在执行这些步骤后出现问题,请尝试重新启动或重新登录,以确保正确设置环境


注3:1.9.3-p125之前的Ruby版本可能并不总是与clang完全兼容,因此,如果在生产环境中使用“edit 3”解决方案,请彻底测试您的软件。

堆栈溢出概述

我正试图在App Store的Xcode上的clean Lion安装上安装SiriProxy

我不断地犯这样的错误: 提供的CC(/usr/bin/gcc)是基于LLVM的

bash-3.2$ rvm install 1.9.3
ERROR: The provided CC(/usr/bin/gcc) is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.

两天后,终于用这两行代码工作了:

http://stackoverflow.com/questions/8000145/ruby-rvm-llvm-and-mysql

bash-3.2$ rvm get head
bash-3.2$ CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared
在此之前,我已经尝试了Ruby和Lion上的每一篇stackoverflow文章,因此这样做可能会完成一些设置,帮助完成上述两个步骤:

我试过的东西包括:

运行Install Xcode.app(我已从应用商店下载-运行此程序将进一步安装)

安装

https://github.com/kennethreitz/osx-gcc-installer/downloads may help for installing GCC.
在中设置CC

更多/Users//.bash_配置文件

bash-3.2$ more /Users/<USERNAME>/.bash_profile 
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
export CC=/usr/share/TargetConfigs/bin/gcc
bash-3.2$more/Users//.bash\u配置文件
[[-s“$HOME/.rvm/scripts/rvm”]&&。“$HOME/.rvm/scripts/rvm”#加载rvm函数
导出CC=/usr/share/TargetConfigs/bin/gcc
第一行来自SiriProxy安装说明

二线出口CC似乎从未起作用。所以不要加

它有很多版本
我最后使用了CC=/usr/bin/gcc-4.2rvm安装1.9.3——启用共享

rvm安装1.9.3——强制自动校准


只需告诉configure在Lion(Mac OSX 10.7.2)上使用gcc而不是gcc-4.2

从源代码编译ruby-1.9.3

您可以在配置输出中看到:

configure:3385: gcc-4.2 --version >&5
./configure: line 3387: gcc-4.2: command not found
如果搜索
config.log
,您会看到:

CC='gcc-4.2'
我遇到了同样的问题,因此我在选择
gcc
而不是
gcc-4.2
时运行
configure

> CC=gcc ./configure --prefix=/usr/local 
> make
> make install
> ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]

(我不确定什么是
配置:警告:无法识别的选项:--libyaml dir
在您的输出中,我想您已经找到了答案?

好的,我不必单独安装gcc-4.2,我使用了Xcode中提供的一个,但是我遇到了一个问题,
--with gcc=clang
没有通过。将以下行添加到my
.rvmrc

export rvm_configure_flags="--with-gcc=clang"
按要求工作

rvm upgrade ruby-1.9.2-p290 ruby-1.9.3-p125
...
ruby-1.9.3-p125 - #extracted to /Users/leif/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring
ruby-1.9.3-p125 - #compiling 
ruby-1.9.3-p125 - #installing
....
Successfully migrated ruby-1.9.2-p290 to ruby-1.9.3-p125
Upgrade complete!

bang:$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
注意我的环境如下

操作系统

Xcode

海湾合作委员会

我尝试在命令行上将
--with gcc=clang
传递给rvm upgrade命令,但它没有起作用,似乎没有从rvm传递到configure。显然,RVM中未传递给configure的参数的问题已经修复(在2011年的commit
1641ceb0
中),但即使在将RVM升级到最新版本(通过
RVM get latest
)之后,它仍然没有被传递。使用
.rvmrc
文件是它对我有效的唯一方法

rvm install 1.9.3 --with-gcc=clang

为我工作。这是一个全新的狮子与Xcode(没有“传统”的GCC)

只在这里回答,因为我无法对莱安德罗对原始问题的评论进行投票/评论。经过几天的努力,他的解决方案终于为我带来了效果:

edit3对我不起作用(Xcode 4.2.1),但在安装readline之后

 rvm pkg install readline 
并传递一个额外的参数

rvm install 1.9.3 --with-gcc=clang --with-readline-dir=$rvm_path/usr 

安装成功

下载并使用Mac OS的官方RVM GUI。在“AddRuby”中选择您的Ruby版本。在安装之前,请确保您选择了“Use Clang”,正如此线程中已接受答案的编辑3所建议的那样。

遇到了相同的问题,因为我使用的是Xcode 4.3.2和Lion 10.7.3,几天前我更换了笔记本电脑,然后从旧笔记本电脑传输了所有内容。显然,有些二进制文件无法传输,例如gcc

然后我做了以下几点:

  • 将Xcode 4.3.2拖到垃圾箱中,将其删除
  • 从下载gcc安装包v2
  • 安装它
  • 然后rvm安装1.9.2为我工作
  • 您可以尝试安装,它包括GCC、LLMV和Xcode 4.2及更高版本中排除的其他工具。

    我将从
    rvm要求中建议安装它,而我已经安装了最新的Xcode版本4.4(4F250)

    自制:

    如果您使用的是自制软件,则可以使用ins
    rvm install 1.9.3 --with-gcc=clang
    
     rvm pkg install readline 
    
    rvm install 1.9.3 --with-gcc=clang --with-readline-dir=$rvm_path/usr 
    
      brew update
      brew tap homebrew/dupes
      brew install autoconf automake apple-gcc42
      rvm pkg install openssl
    
    $ brew cleanup [specific-formula or without-formula to clean all]
    
    $ brew remove apple-gcc42
    
    /join #machomebrew
    
    rvm get head
    rm -rf  /usr/local/lib/libsqlite3*
    CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared
    
    brew install ruby193