Error installing memcached gem on Snow Leopard - wrong architecture?
I'm having an issue installing the memcached
ruby gem on my Mac Pro machine with OS X Snow Leopard (10.6.4).
Memcache is installed and working fine and for most projects I use the memcache-client
gem without issue, but this current project I need to use the memcached
gem instead.
Installing the gem with env ARCHFLAGS='-arch x86_64' gem install memcached
or just via the normal gem install memcached
both give the same error when trying to run the application:
(in /src/mojotech/projectr)
dlopen(/Users/cpjolicoeur/.rvm/gems/ruby-1.8.7-p174/gems/memcached-0.19.7/lib/rlibmemcached.bundle, 9): no suitable image found.
Did find: /Users/cpjolicoeur/.rvm/gems/ruby-1.8.7-p174/gems/memcached-0.19.7/lib/rlibmemcached.bundle: mach-o, but wrong architecture - /Users/cpjolicoeur/.rvm/gems/ruby-1.8.7-p174/gems/memcached-0.19.7/lib/rlibmemcached.bundle
However, running file
on the rlibmemcached.bundle
gives the correct arch?
cpjolicoeur@~/.rvm/gems开发者_运维问答/ruby-1.8.7-p174/gems/memcached-0.19.7/lib $ file rlibmemcached.bundle
rlibmemcached.bundle: Mach-O 64-bit bundle x86_64
I'm not sure what the problem is, or how to properly install the memcached
gem for my system.
I was seeing the same exact error message on Snow Leopard, Ruby 1.9.1, and the memcached gem. I scoured the net for hours for an answer. Everyone suggested this solution, which did not change the error message:
# Did Not Work
sudo gem uninstall
sudo env ARCHFLAGS='-arch x86_64' gem install memcached
I also tried doing 'rake clean' and re-running extconf.rb on the gem. Same error.
Finally, I went through every past version of the memcached gem until I found one that worked with my system.
# This Worked!
sudo gem uninstall memcached
sudo gem install --version 0.17.1 memcached --no-ri --no-rdoc
Version 0.17.1 of the gem is the only version that works for me. I'm an iPhone developer, so have the latest version of XCode installed, and this might explain why my system is different.
This is a late answer, but hopefully useful for someone who runs across the same issue. (With Ruby 1.9.2 on Snow Leopard.)
Install the Perl modules Pod::Simple, Pod::Man, Pod::Checker (via cpan is easiest).
Download the latest version of libmemcached from http://download.tangent.org/ (was libmemcached-0.44.tar.gz as of this post)
Do the configure/make/install dance by hand in Terminal:
tar -xzvf libmemcached-0.44.tar.gz
cd libmemcached-0.44
./configure
make
sudo make install
After this, sudo gem install memcached
worked, and the Rails 3 app in question ran fine.
精彩评论