2011-11-30 136 views
1

我想在Mac OS X Lion(10.7.2)上使用memcached gem(http://fauna.github.com/fauna/memcached/)。 已经安装了Xcode 4.2。gem install memcached在Lion上失败

我已经安装了memcached和libmemcached homebrew。

$ brew list -v 
libmemcached 0.50 
memcached 1.4.10 

我使用ruby 1.9.3-p0和rvm(ruby版本管理器)。

$ ruby -v 
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] 
$ rvm -v 
rvm 1.9.2 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/] 

但我不能安装memcached gem(1.3.5)。我粘贴安装日志。 https://gist.github.com/1395459

在make libmemcached中发生了一些错误。我看到了那些目录。

$ pwd 
/Users/inohiro/.rvm/gems/ruby-1.9.3-p0/gems/memcached-1.3.5/ext/libmemcached-0.32 

配置成功。但是make(全部)失败。

$ make all 
make all-recursive 
Making all in docs 
make[2]: Nothing to be done for `all'. 
Making all in libmemcached 
make all-am 
make[3]: Nothing to be done for `all-am'. 
Making all in libmemcachedutil 
make[2]: Nothing to be done for `all'. 
Making all in support 
make[2]: Nothing to be done for `all'. 
Making all in clients 
/bin/sh ../libtool --tag=CC --mode=link gcc -std=gnu99 -O3 -pedantic -Wall -Wextra -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wstrict-aliasing -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -D_THREAD_SAFE -rpath /usr/local/lib/libmemcached -lsasl2 -L/usr/local/lib -o memcat memcat.o libutilities.la ../libmemcached/libmemcached.la 
libtool: link: gcc -std=gnu99 -O3 -pedantic -Wall -Wextra -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wstrict-aliasing -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -D_THREAD_SAFE -o .libs/memcat memcat.o -L/usr/local/lib ./.libs/libutilities.a ../libmemcached/.libs/libmemcached.dylib -lsasl2 
Undefined symbols for architecture x86_64: 
    "_memcached_create", referenced from: 
     _main in memcat.o 
    "_memcached_behavior_set", referenced from: 
     _main in memcat.o 
     _process_hash_option in libutilities.a(utilities.o) 
    "_memcached_get", referenced from: 
     _main in memcat.o 
    "_memcached_free", referenced from: 
     _main in memcat.o 
ld: symbol(s) not found for architecture x86_64 
collect2: ld returned 1 exit status 
make[2]: *** [memcat] Error 1 
make[1]: *** [all-recursive] Error 1 
make: *** [all] Error 2 

完整的日志配置和make libmemcached在这里。 https://gist.github.com/1395470

请告诉我如何安装memcached的宝石狮子:/

后记-1

我试过 “酿造环节的memcached”。但是返回一个错误。我该怎么办?

$ brew link memcached 
Linking /usr/local/Cellar/memcached/1.4.10... 
Error: Cannot link memcached 
Another version is already linked: /usr/local/Cellar/memcached/1.4.10 

后记-2

我试图移除的/ usr /本地/地窖/分布式缓存/。然后运行'brew link memcached',但出现以下错误。

$ rm -rf memcached 
$ brew link memcached 
Error: No such keg: /usr/local/Cellar/memcached 

回答

0

做到这一点:

ls -l /usr/local/include/memcached 
lrwxr-xr-x 1 root staff 43 Jul 18 14:17 /usr/local/include/memcached -> ../Cellar/memcached/1.4.5/include/memcached 

您需要删除旧的链接第一:

sudo rm /usr/local/include/memcached 

然后尝试brew link memcached再次

你可能也想这样做:

Installed memcached via homebrew, how to start and stop server?

+0

谢谢你的亲切。但我无法解决。添加Postscript-2。 – inohiro

+0

是“sudo rm/usr/local/include/memcaced(< - 它的符号链接”正确吗?或者是“sudo rm/usr/local/Cellar/memcaced /(< - 它的目录”? – inohiro

+0

对不起,这是一个错字。试试这个:'sudo rm/usr/local/include/memcached' – Tilo

1

我觉得问题是gcc无法找到brew安装的memcached库。

尝试运行brew link memcached,然后再运行gem install memcached

+0

谢谢您的评论!我添加了关于这个的附言。 – inohiro