无法编译 ruby​​ 1.9.3 [英] Cannot compile ruby 1.9.3

查看:28
本文介绍了无法编译 ruby​​ 1.9.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我跑步时

rvm install 1.9.3 --with-gcc=clang

在 Mac OSX Lion 上,ruby 无法编译,并且在 (.rvm/log/ruby-1.9.3-p374/make.log) 中出现以下错误

on Mac OSX Lion, ruby does not compile, and I get the following error in (.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

如何在 Lion 上安装 ruby​​ 1.9.3?

How can I get ruby 1.9.3 to install on Lion?

推荐答案

你正在使用 clang,根据这张票 http://bugs.ruby-lang.org/issues/5883 - 它不是完全"支持的 - 你需要尝试使用 gcc-4.2,您可以通过运行 rvm 要求 获得自制软件的说明.

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.

这里是这个问题的 RVM 票 https://github.com/wayneeseguin/rvm/问题/1480

here is RVM ticket for this problem https://github.com/wayneeseguin/rvm/issues/1480

更新:Ruby-2.0.0 实际上用 clang 比用 gcc-4.2 编译得更好,更多细节在这里:https://stackoverflow.com/a/15655034/497756

UPDATE: Ruby-2.0.0 actually compiles better with clang then with gcc-4.2, more details here: https://stackoverflow.com/a/15655034/497756

这篇关于无法编译 ruby​​ 1.9.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆