When I run
当我跑
rvm install 1.9.3 --with-gcc=clang
on Mac OSX Lion, ruby does not compile, and I get the following error in (.rvm/log/ruby-1.9.3-p374/make.log)
在Mac OSX Lion上,ruby无法编译,我在(.rvm / log / ruby-1.9.3-p374 / make.log)中收到以下错误
[2013-01-29 16:31:05] 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/Users/will/.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
How can I get ruby 1.9.3 to install on Lion?
如何在Lion上安装ruby 1.9.3?
5 个解决方案
#1
13
you are using clang
, according to this ticket http://bugs.ruby-lang.org/issues/5883 - it's not "fully" supported - you need to try using gcc-4.2
, you get instructions for homebrew with running rvm requirements
.
你正在使用clang,根据这张票http://bugs.ruby-lang.org/issues/5883 - 它没有“完全”支持 - 你需要尝试使用gcc-4.2,你得到了自制的运行rvm要求的说明。
here is RVM ticket for this problem https://github.com/wayneeseguin/rvm/issues/1480
这是此问题的RVM票据https://github.com/wayneeseguin/rvm/issues/1480
UPDATE: Ruby-2.0.0 actually compiles better with clang
then with gcc-4.2
, more details here: https://*.com/a/15655034/497756
更新:Ruby-2.0.0实际上用clang然后用gcc-4.2编译得更好,更多细节在这里:https://*.com/a/15655034/497756
#2
33
With Xcode 4.6 I was also getting this problem. I installed the command line tools which made gcc available in /usr/bin/gcc.
使用Xcode 4.6我也遇到了这个问题。我安装了命令行工具,它们在/ usr / bin / gcc中提供了gcc。
I managed to get it to work using:
我设法让它使用:
rvm install 1.9.3 --with-gcc=gcc
NB. I dont have homebrew installed.
NB。我没有安装自制软件。
#3
11
If you don't have rvm already installed, rvm requirements won't work. Install gcc 4.2 with homebrew and restart the rvm installation. Worked for me.
如果您还没有安装rvm,则rvm要求将不起作用。使用自制软件安装gcc 4.2并重新启动rvm安装。为我工作。
brew update
brew tap homebrew/dupes
brew install apple-gcc42
#4
7
If you are using rbenv and ruby-build instead of rvm, you have to do this:
如果你使用rbenv和ruby-build而不是rvm,你必须这样做:
# 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-p385
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
# Maybe you have to tell, which gcc version must be used,
# to get it working on newer systems
export CC=gcc-4.2
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变量
#5
1
I solved this using Macports.
我用Macports解决了这个问题。
I had problems compiling and were getting the error "Ruby 'ruby-1.9.3-p374' was built using clang - but it's not (fully) supported, expect errors."
我有编译问题,并且得到错误“Ruby'ruby-1.9.3-p374'是使用clang构建的 - 但它没有(完全)支持,期待错误。”
Github was also down for maintenance so I couldnt try compiling using brew as suggested in the previous answer... This is what I did, and it compiled fine on Mountain Lion 10.8.2:
Github也因为维护而失败,所以我不能尝试使用brew进行编译,如前面的答案所示......这就是我所做的,它在Mountain Lion 10.8.2上编译得很好:
First install Macports
首先安装Macports
http://www.macports.org/install.php
http://www.macports.org/install.php
Then run:
然后运行:
sudo port selfupdate
sudo port selfupdate
sudo port install apple-gcc42
sudo port安装apple-gcc42
sudo rvm install ruby-1.9.3-p374 --with-gcc=gcc-apple-4.2
sudo rvm install ruby-1.9.3-p374 --with-gcc = gcc-apple-4.2
#1
13
you are using clang
, according to this ticket http://bugs.ruby-lang.org/issues/5883 - it's not "fully" supported - you need to try using gcc-4.2
, you get instructions for homebrew with running rvm requirements
.
你正在使用clang,根据这张票http://bugs.ruby-lang.org/issues/5883 - 它没有“完全”支持 - 你需要尝试使用gcc-4.2,你得到了自制的运行rvm要求的说明。
here is RVM ticket for this problem https://github.com/wayneeseguin/rvm/issues/1480
这是此问题的RVM票据https://github.com/wayneeseguin/rvm/issues/1480
UPDATE: Ruby-2.0.0 actually compiles better with clang
then with gcc-4.2
, more details here: https://*.com/a/15655034/497756
更新:Ruby-2.0.0实际上用clang然后用gcc-4.2编译得更好,更多细节在这里:https://*.com/a/15655034/497756
#2
33
With Xcode 4.6 I was also getting this problem. I installed the command line tools which made gcc available in /usr/bin/gcc.
使用Xcode 4.6我也遇到了这个问题。我安装了命令行工具,它们在/ usr / bin / gcc中提供了gcc。
I managed to get it to work using:
我设法让它使用:
rvm install 1.9.3 --with-gcc=gcc
NB. I dont have homebrew installed.
NB。我没有安装自制软件。
#3
11
If you don't have rvm already installed, rvm requirements won't work. Install gcc 4.2 with homebrew and restart the rvm installation. Worked for me.
如果您还没有安装rvm,则rvm要求将不起作用。使用自制软件安装gcc 4.2并重新启动rvm安装。为我工作。
brew update
brew tap homebrew/dupes
brew install apple-gcc42
#4
7
If you are using rbenv and ruby-build instead of rvm, you have to do this:
如果你使用rbenv和ruby-build而不是rvm,你必须这样做:
# 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-p385
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
# Maybe you have to tell, which gcc version must be used,
# to get it working on newer systems
export CC=gcc-4.2
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变量
#5
1
I solved this using Macports.
我用Macports解决了这个问题。
I had problems compiling and were getting the error "Ruby 'ruby-1.9.3-p374' was built using clang - but it's not (fully) supported, expect errors."
我有编译问题,并且得到错误“Ruby'ruby-1.9.3-p374'是使用clang构建的 - 但它没有(完全)支持,期待错误。”
Github was also down for maintenance so I couldnt try compiling using brew as suggested in the previous answer... This is what I did, and it compiled fine on Mountain Lion 10.8.2:
Github也因为维护而失败,所以我不能尝试使用brew进行编译,如前面的答案所示......这就是我所做的,它在Mountain Lion 10.8.2上编译得很好:
First install Macports
首先安装Macports
http://www.macports.org/install.php
http://www.macports.org/install.php
Then run:
然后运行:
sudo port selfupdate
sudo port selfupdate
sudo port install apple-gcc42
sudo port安装apple-gcc42
sudo rvm install ruby-1.9.3-p374 --with-gcc=gcc-apple-4.2
sudo rvm install ruby-1.9.3-p374 --with-gcc = gcc-apple-4.2