在Lion上,gem install memcached失败了

时间:2011-11-30 05:49:06

标签: rubygems memcached osx-lion libmemcache

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

我已经安装了Homebrew的memcached和libmemcached。

$ 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 (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]

但我无法安装memcached gem(1.3.5)。我按照gits粘贴了安装日志。     https://gist.github.com/1395459

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

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

配置成功。但是make(all)都失败了。

$ 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

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

请告诉我如何在Lion上安装memcached gem:/

后记-1

我尝试过“brew link 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 / local / Cellar / memcached /。并运行'brew link memcached',但会收到以下错误。

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

2 个答案:

答案 0 :(得分:1)

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

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

答案 1 :(得分: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?