在Snow Leopard上安装memcached gem时出错--架构错误?[英] Error installing memcached gem on Snow Leopard - wrong architecture?

本文是小编为大家收集整理的关于在Snow Leopard上安装memcached gem时出错--架构错误?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我在我的Mac Pro Machine上安装memcached Ruby Gem的问题,使用OS X Snow Leopard(10.6.4).

memcache已安装并正常工作,对于大多数项目,我都会使用memcache-client gem没有问题,但是我需要使用memcached gem的当前项目.

使用env ARCHFLAGS='-arch x86_64' gem install memcached或仅通过常规gem install memcached在尝试运行应用程序时都会出现相同的错误:

(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

但是,在rlibmemcached.bundle上运行file给出正确的拱门?

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

我不确定问题是什么,或如何正确安装我的系统的memcached宝石.

推荐答案

我在Snow Leopard,Ruby 1.9.1和Memcached Gem上看到了相同的错误消息.我搜寻了网络几个小时的答案.每个人都建议使用此解决方案,该解决方案没有更改错误消息:

# Did Not Work
sudo gem uninstall
sudo env ARCHFLAGS='-arch x86_64' gem install memcached

我还尝试在宝石上进行"耙干",然后重新运行extconf.rb.同样的错误.

最后,我经历了过去的每一个版本的宝石,直到找到与系统一起使用的宝石为止.

# This Worked!
sudo gem uninstall memcached
sudo gem install --version 0.17.1 memcached --no-ri --no-rdoc

GEM的0.17.1版本是唯一适合我的版本.我是iPhone开发人员,因此安装了最新版本的Xcode,这可以解释为什么我的系统不同.

其他推荐答案

这是一个较晚的答案,但希望对遇到同一问题的人有用. (在雪豹上使用红宝石1.9.2.)

安装perl模块pod :: simple,pod :: man,pod :: checker(通过CPAN最简单).

http://download.tangent.org/下载最新版本的libmemememcach 0.44.tar.gz截至本文)

在终端手工手工进行配置/make/安装舞蹈:

tar -xzvf libmemcached-0.44.tar.gz
cd libmemcached-0.44
./configure
make
sudo make install

此后,sudo gem install memcached工作,而Rails 3应用程序正常运行.

本文地址:https://www.itbaoku.cn/post/786672.html

问题描述

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.