在 Mac OS X Lion 上安装 Ruby 1.9.3 时出错 [英] Error when installing Ruby 1.9.3 on Mac OS X Lion

查看:62
本文介绍了在 Mac OS X Lion 上安装 Ruby 1.9.3 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 MAC OS X Lion 上安装 Ruby 1.9.3 和 Rails.(我的 Xcode 是 4.3 版)(我已经安装了 Rails 3.2.2)

I'm trying to install Ruby 1.9.3 and Rails on MAC OS X Lion. (My Xcode is version 4.3) (I've installed Rails 3.2.2)

不管我是否使用:

rvm install 1.9.3 --with-gcc=clang

或:

rvm install 1.9.3

我的终端显示:

Error running 'make ', please read /Users/AlexHo/.rvm/log/ruby-1.9.3-p125/make.log
There has been an error while running make. Halting the installation.

有人遇到过同样的情况吗?

Has anyone encountered the same situation?

AlexHo@Nien-Yi-Hos-MacBook:~$ rvm install 1.9.3
Fetching yaml-0.1.4.tar.gz to /Users/AlexHo/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/AlexHo/.rvm/src
Configuring yaml in /Users/AlexHo/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/AlexHo/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/AlexHo/.rvm/usr
Installing Ruby from source to: /Users/AlexHo/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...

ruby-1.9.3-p125 - #fetching 
ruby-1.9.3-p125 - #extracted to /Users/AlexHo/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring 
ruby-1.9.3-p125 - #compiling 
Error running 'make ', please read /Users/AlexHo/.rvm/log/ruby-1.9.3-p125/make.log
There has been an error while running make. Halting the installation.

<小时>

AlexHo@Nien-Yi-Hos-MacBook:~$ cat /Users/AlexHo/.rvm/log/ruby-1.9.3-p125/make.log
[2012-03-03 04:15:53] make 
        CC = clang
        LD = ld
        LDSHARED = clang -dynamiclib
        CFLAGS = -O3 -ggdb -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  -fno-common -pipe 
    XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
    CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I. -I.ext/include/x86_64-darwin11.3.0 -I./include -I.
    DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -install_name /Users/AlexHo/.rvm/rubies/ruby-1.9.3-p125/lib/libruby.1.9.1.dylib -current_version 1.9.1 -compatibility_version 1.9.1 -Wl,-unexported_symbol,_Init_* -Wl,-unexported_symbol,*_threadptr_*  -Wl,-u,_objc_msgSend   
    SOLIBS = 
linking miniruby
rbconfig.rb unchanged
generating enc.mk
generating prelude.c
compiling prelude.c
linking static-library libruby.1.9.1-static.a
linking shared-library libruby.1.9.1.dylib
generating encdb.h
encdb.h unchanged
making enc
make[1]: Nothing to be done for `enc'.
making srcs under enc
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h unchanged
making trans
make[1]: Nothing to be done for `./enc/trans'.
making encs
installing default bug libraries
installing default resize libraries
installing default bug libraries
installing default bug libraries
installing default funcall libraries
installing default dot.dot libraries
installing default old_thread_select libraries
installing default numhash libraries
installing default string libraries
installing default wait_for_single_fd libraries
installing default bigdecimal libraries
installing default continuation libraries
installing default coverage libraries
installing default curses libraries
installing default date_core libraries
make[2]: Nothing to be done for `all'.
installing digest libraries
installing default digest libraries
installing default bubblebabble libraries
installing default md5 libraries
installing default rmd160 libraries
installing default sha1 libraries
installing default sha2 libraries
installing dl libraries
installing default dl libraries
installing default callback libraries
make[2]: Nothing to be done for `all'.
installing default etc libraries
installing default fcntl libraries
installing default fiber libraries
installing default fiddle libraries
make[2]: Nothing to be done for `all'.
installing default iconv libraries
installing default console libraries
installing default nonblock libraries
installing default wait libraries
installing default libraries
installing default generator libraries
installing default parser libraries
installing default complex libraries
installing default rational libraries
installing default nkf libraries
installing default objspace libraries
installing default openssl libraries
installing default pathname libraries
installing default psych libraries
installing default pty libraries
installing default cparse libraries
compiling readline.c
readline.c:1499:9: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
                                    rl_username_completion_function);
                                    ^
readline.c:69:42: note: instantiated from:
# define rl_username_completion_function username_completion_function
                                         ^
/usr/local/include/readline/readline.h:449:14: note: 'rl_username_completion_function' declared here
extern char *rl_username_completion_function PARAMS((const char *, int));
             ^
    1 error generated.
    make[2]: *** [readline.o] Error 1
    make[1]: *** [ext/readline/all] Error 2
    make: *** [build-ext] Error 2

推荐答案

我自己也遇到过这个问题,经过大量的挣扎和搜索(没有一个站点有完整的解决方案),我终于想出了以下内容:

I had this problem myself, and after a great deal of struggle and searching (not one site had the complete solution), here's what I finally came up with:

curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz
tar xzvf readline-6.2.tar.gz
cd readline-6.2
./configure --prefix=/usr/local
cd shlib
sed -e 's/-dynamic/-dynamiclib/' Makefile > Makefile.good
mv Makefile.good Makefile
cd ..
make
sudo make install
cd ..
rvm install 1.9.3 -C --with-readline-dir=/usr/local/

这篇关于在 Mac OS X Lion 上安装 Ruby 1.9.3 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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