Wil*_*ill 20 ruby compiler-errors clang rvm osx-lion
我跑的时候
rvm install 1.9.3 --with-gcc=clang
Run Code Online (Sandbox Code Playgroud)
在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
Run Code Online (Sandbox Code Playgroud)
如何在Lion上安装ruby 1.9.3?
小智 33
使用Xcode 4.6我也遇到了这个问题.我安装了命令行工具,使得/ usr/bin/gcc中的gcc可用.
我设法让它使用:
rvm install 1.9.3 --with-gcc=gcc
Run Code Online (Sandbox Code Playgroud)
NB.我没有安装自制软件.
mpa*_*pis 13
你正在使用clang,根据这张票http://bugs.ruby-lang.org/issues/5883 - 它没有"完全"支持 - 你需要尝试使用gcc-4.2,你得到自制的运行说明rvm requirements.
这是此问题的RVM票证https://github.com/wayneeseguin/rvm/issues/1480
更新:红宝石2.0.0实际上编译更好clang然后gcc-4.2在这里,更多的细节:/sf/answers/1095852411/
Cri*_*ris 11
如果您还没有安装rvm,则rvm要求将不起作用.使用自制软件安装gcc 4.2并重新启动rvm安装.为我工作.
brew update
brew tap homebrew/dupes
brew install apple-gcc42
Run Code Online (Sandbox Code Playgroud)
如果你使用rbenv和ruby-build而不是rvm,你必须定义,应该使用哪个编译器来构建ruby:
# 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
Run Code Online (Sandbox Code Playgroud)
如果它不起作用,您需要先安装Gnu C编译器(gcc):
brew update
brew tap homebrew/dupes
# install gcc, only once needed
brew install gcc
# You can view the installed GCC version, currently gcc-8
brew info gcc
# Maybe you have to tell, which gcc version must be used,
# to get it working.
export CC=gcc-8
Run Code Online (Sandbox Code Playgroud)
对于较旧的系统或不是最新的系统安装旧的GCC 4.2版本:
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
Run Code Online (Sandbox Code Playgroud)
在ruby人构建clang兼容的ruby版本之前,你必须在每次构建新的ruby版本之前导出CC变量,或者只是将导出添加到你的.bashrc oder .zshenv文件中.
| 归档时间: |
|
| 查看次数: |
10285 次 |
| 最近记录: |