2011-11-30 133 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