I have referred to Installing Ruby on Rails - Mac OS Lion and followed Alain Beauvois's reply and got pretty much everything up. The only difference is I am using 1.9.3 instead of 1.9.2.
我提到了安装Ruby on Rails - Mac OS Lion,并跟踪Alain Beauvois的回复,并得到了几乎所有的东西。唯一的区别是我用的是1.9.3,而不是1.9.2。
I have created .bash_profile
and even made sure that is there by open -e .bash_profile
and even added the line as stated by Alain Beauvois.
我已经创建了.bash_profile,甚至还通过open -e .bash_profile确保了它的存在,甚至还添加了Alain Beauvois所声明的行。
But what seems to be the problem now is I am getting this error:
但是现在的问题是我得到了这个错误
Error running 'make', please read /usr/local/rvm/log/ruby-1.9.3-p374/make.log
There has been an error while running make. Halting the installation.
The referenced log contains this:
引用的日志包含以下内容:
[2013-02-02 21:41:52] make
CC = clang
LD = ld
LDSHARED = clang -dynamic -bundle
CFLAGS = -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -pipe
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/rvm/usr/include -I. -I.ext/include/x86_64-darwin12.2.1 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace
SOLIBS =
compiling regparse.c
regparse.c:582:15: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
return t->num_entries;
~~~~~~ ~~~^~~~~~~~~~~
1 error generated.
make: *** [regparse.o] Error 1
I even tried
我甚至尝试
rvm -install ruby-1.9.3-p374
but still get the same error. I did get some weird errors before I got to this part but after I reran it with an addition of sudo
in front of it, it worked. AFAIK, sudo
= doing something with su
permissions/privileges, right?
但还是会得到相同的误差。在进入这部分之前,我确实有一些奇怪的错误,但是在我重新运行它之后,在它前面加上了sudo,它就成功了。sudo =用su权限/权限做某事,对吗?
9 个解决方案
#1
18
Just found this. I think this is what you need to do.
只是发现了这个。我想这就是你需要做的。
First, if you haven't already, download MacPorts and install it. Then run the following two commands:
首先,如果您还没有下载MacPorts并安装它。然后运行以下两个命令:
sudo port selfupdate
sudo port install apple-gcc42
Too get real UNIX GCC. Then, to install 1.9.3 run:
也可以使用真正的UNIX GCC。然后,安装1.9.3运行:
CC=/opt/local/bin/gcc-apple-4.2 rvm install ruby-1.9.3-p194 --enable-shared --without-tk --without-tcl
Which tells rvm to install Ruby using UNIX GCC without Tk or Tcl which require X11 (left out of OSX 10.8). If you want things like readline support, OpenSSL, etc., check out the above linked gist.
这告诉rvm在没有Tk或Tcl的情况下使用UNIX GCC来安装Ruby,这需要X11(从osx10.8中删除)。如果您需要readline支持、OpenSSL等,请查看上面链接的要点。
#2
31
I had the exact same error, but am using brew instead of MacPorts. All I had to do was:
我犯了同样的错误,但我用的是brew而不是MacPorts。我所要做的就是:
brew update
brew tap homebrew/dupes
brew install apple-gcc42
rvm get stable
rvm install 1.9.3-p374
I didn't have to set the CC environment variable as some instructions point out. HTH!
我不必像某些指示指出的那样设置CC环境变量。HTH !
#3
20
If you are using rbenv and ruby-build instead of rvm, you have to do this:
如果您使用的是rbenv和ruby构建而不是rvm,您必须这样做:
env CC=gcc rbenv install 1.9.3-p392
If this doesn't work, try this:
如果这不起作用,试试这个:
# this export must be done before every new ruby build
export CC=gcc
# use the version you wish to install
rbenv install 1.9.3-p392
If it doesn't work, you need to install gcc first:
如果它不起作用,您需要先安装gcc:
brew update
brew tap homebrew/dupes
# install apple-gcc, only once needed
brew install apple-gcc42
Until the ruby folks build a clang compatible ruby version, you have to export the CC variable before every build of a new ruby version
在ruby人员构建一个与clang兼容的ruby版本之前,您必须在每次构建新的ruby版本之前导出CC变量。
#4
3
This also worked in rbenv on OSX 10.8.2 + XCode 4.6
这也适用于osx10.8.2 + XCode 4.6的rbenv。
$ export CC=gcc
$ rbenv install 1.9.3-p385 -v
But is also useful to know that homebrew can install another version of gcc if apple changes the command line tools of Xcode in the future.
但是,如果苹果在将来修改了Xcode的命令行工具,homebrew可以安装另一个版本的gcc,这也是很有用的。
#5
1
I just did (after installing XCode command line tools):
我刚做了(安装XCode命令行工具):
$ export CC=gcc $ rvm install 1.9.3
And although it said "Ruby 'ruby-1.9.3-p374' was built using clang - but it's not (fully) supported, expect errors." - it worked.
尽管它说“Ruby -1.9.3-p374”是用clang构建的,但它并没有得到完全支持,预计会出现错误。——它工作。
#6
1
This worked for me as well on ruby-1.9.3-p385 with no homebrew or Macports installed.
这对我同样有效,在ruby-1.9.3-p385上,没有安装自制程序或Macports。
export CC=gcc
rvm install 1.9.3
Gave message "Ruby 'ruby-1.9.3-p385' was built using clang - but it's not (fully) supported, expect errors." after completing task.
“Ruby”Ruby -1.9.3-p385是用clang构建的,但它并不是(完全)支持的,在完成任务之后会出现错误。
#7
1
Just to add another answer to the list... I'm using ruby-install, and this is what worked for me:
为了给这个列表添加另一个答案……我使用的是ruby-install,这就是我的工作:
CC=/usr/local/bin/gcc-4.2 ruby-install ruby 1.9.3-p0
#8
0
I tried apple-gcc42
and CC=/usr/bin/gcc
without any luck so I'm not sure if they are necessary. I'm using the rbenv
manager and so this is what worked for me when trying to install 1.9.3-p385
我尝试了苹果-gcc42和CC=/usr/bin/gcc,没有任何运气,所以我不确定是否有必要。我使用的是rbenv管理器这是我在安装1.93 -p385时的工作。
brew install readline
CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)" rbenv install 1.9.3-p385
Found it on this blog
在这个博客上找到的。
#9
0
For the record: Works for me with rbenv
, ruby 1.9.3-p385
, gcc48
(brew install gcc48
) on Darwin Kernel Version 15.2.0
. (there were lots of warnings during compilation that I ignored, ruby works fine so far).
记录:使用rbenv, ruby 1.9.3-p385, gcc48 (brew安装gcc48)在Darwin内核版本15.2.0中工作。(在编译过程中有很多警告,我忽略了,ruby至今还不错)。
I just had to set CC=gcc-4.8
before rbenv install 1.9.3-p385
在rbenv安装1.9.3-p385之前,我只需要设置CC=gcc-4.8。
#1
18
Just found this. I think this is what you need to do.
只是发现了这个。我想这就是你需要做的。
First, if you haven't already, download MacPorts and install it. Then run the following two commands:
首先,如果您还没有下载MacPorts并安装它。然后运行以下两个命令:
sudo port selfupdate
sudo port install apple-gcc42
Too get real UNIX GCC. Then, to install 1.9.3 run:
也可以使用真正的UNIX GCC。然后,安装1.9.3运行:
CC=/opt/local/bin/gcc-apple-4.2 rvm install ruby-1.9.3-p194 --enable-shared --without-tk --without-tcl
Which tells rvm to install Ruby using UNIX GCC without Tk or Tcl which require X11 (left out of OSX 10.8). If you want things like readline support, OpenSSL, etc., check out the above linked gist.
这告诉rvm在没有Tk或Tcl的情况下使用UNIX GCC来安装Ruby,这需要X11(从osx10.8中删除)。如果您需要readline支持、OpenSSL等,请查看上面链接的要点。
#2
31
I had the exact same error, but am using brew instead of MacPorts. All I had to do was:
我犯了同样的错误,但我用的是brew而不是MacPorts。我所要做的就是:
brew update
brew tap homebrew/dupes
brew install apple-gcc42
rvm get stable
rvm install 1.9.3-p374
I didn't have to set the CC environment variable as some instructions point out. HTH!
我不必像某些指示指出的那样设置CC环境变量。HTH !
#3
20
If you are using rbenv and ruby-build instead of rvm, you have to do this:
如果您使用的是rbenv和ruby构建而不是rvm,您必须这样做:
env CC=gcc rbenv install 1.9.3-p392
If this doesn't work, try this:
如果这不起作用,试试这个:
# this export must be done before every new ruby build
export CC=gcc
# use the version you wish to install
rbenv install 1.9.3-p392
If it doesn't work, you need to install gcc first:
如果它不起作用,您需要先安装gcc:
brew update
brew tap homebrew/dupes
# install apple-gcc, only once needed
brew install apple-gcc42
Until the ruby folks build a clang compatible ruby version, you have to export the CC variable before every build of a new ruby version
在ruby人员构建一个与clang兼容的ruby版本之前,您必须在每次构建新的ruby版本之前导出CC变量。
#4
3
This also worked in rbenv on OSX 10.8.2 + XCode 4.6
这也适用于osx10.8.2 + XCode 4.6的rbenv。
$ export CC=gcc
$ rbenv install 1.9.3-p385 -v
But is also useful to know that homebrew can install another version of gcc if apple changes the command line tools of Xcode in the future.
但是,如果苹果在将来修改了Xcode的命令行工具,homebrew可以安装另一个版本的gcc,这也是很有用的。
#5
1
I just did (after installing XCode command line tools):
我刚做了(安装XCode命令行工具):
$ export CC=gcc $ rvm install 1.9.3
And although it said "Ruby 'ruby-1.9.3-p374' was built using clang - but it's not (fully) supported, expect errors." - it worked.
尽管它说“Ruby -1.9.3-p374”是用clang构建的,但它并没有得到完全支持,预计会出现错误。——它工作。
#6
1
This worked for me as well on ruby-1.9.3-p385 with no homebrew or Macports installed.
这对我同样有效,在ruby-1.9.3-p385上,没有安装自制程序或Macports。
export CC=gcc
rvm install 1.9.3
Gave message "Ruby 'ruby-1.9.3-p385' was built using clang - but it's not (fully) supported, expect errors." after completing task.
“Ruby”Ruby -1.9.3-p385是用clang构建的,但它并不是(完全)支持的,在完成任务之后会出现错误。
#7
1
Just to add another answer to the list... I'm using ruby-install, and this is what worked for me:
为了给这个列表添加另一个答案……我使用的是ruby-install,这就是我的工作:
CC=/usr/local/bin/gcc-4.2 ruby-install ruby 1.9.3-p0
#8
0
I tried apple-gcc42
and CC=/usr/bin/gcc
without any luck so I'm not sure if they are necessary. I'm using the rbenv
manager and so this is what worked for me when trying to install 1.9.3-p385
我尝试了苹果-gcc42和CC=/usr/bin/gcc,没有任何运气,所以我不确定是否有必要。我使用的是rbenv管理器这是我在安装1.93 -p385时的工作。
brew install readline
CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)" rbenv install 1.9.3-p385
Found it on this blog
在这个博客上找到的。
#9
0
For the record: Works for me with rbenv
, ruby 1.9.3-p385
, gcc48
(brew install gcc48
) on Darwin Kernel Version 15.2.0
. (there were lots of warnings during compilation that I ignored, ruby works fine so far).
记录:使用rbenv, ruby 1.9.3-p385, gcc48 (brew安装gcc48)在Darwin内核版本15.2.0中工作。(在编译过程中有很多警告,我忽略了,ruby至今还不错)。
I just had to set CC=gcc-4.8
before rbenv install 1.9.3-p385
在rbenv安装1.9.3-p385之前,我只需要设置CC=gcc-4.8。