rubygemsmemcachedosx-lionlibmemcache

gem install memcached is failed on Lion


I want to use memcached gem (http://fauna.github.com/fauna/memcached/) on Mac OS X Lion (10.7.2). The Xcode 4.2 was installed already.

I have installed memcached, and libmemcached by Homebrew.

$ brew list -v 
libmemcached 0.50
memcached 1.4.10

And I use ruby 1.9.3-p0 with rvm (ruby version manager).

$ 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/]

But I cann't install memcached gem (1.3.5). I pasted installation log following gits. https://gist.github.com/1395459

Some errors happend in the make of libmemcached. I saw directories of that.

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

The configure is succeed. But make (all) is failed.

$ 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

Full log of configure and make of libmemcached is here. https://gist.github.com/1395470

Please tell me How to install memcached gem to Lion :/

Postscript-1

I tried "brew link memcached". But return a error. What should I do?

$ 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

Postscript-2

I tried remove /usr/local/Cellar/memcached/. And run 'brew link memcached', but get following error.

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

Solution

  • do this:

    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
    

    you need to remove that old link first:

    sudo rm /usr/local/include/memcached
    

    then try the brew link memcached again

    You probably also want to do this:

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