【问题标题】:could not install gem zmq on mac osx yosemite无法在 mac osx 优胜美地上安装 gem zmq
【发布时间】:2016-01-06 13:11:05
【问题描述】:

我在 mac osx maverick 上正确安装了 gem zmq。升级到 mac osx yosemite 后,安装 gem 失败,错误日志如下:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/apple/.rbenv/versions/1.9.3-p484/bin/ruby extconf.rb
checking for zmq.h... yes
checking for zmq_init() in -lzmq... yes
Cool, I found your zmq install...
creating Makefile

make
compiling rbzmq.c
rbzmq.c:968:7: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC'
        case ZMQ_RECOVERY_IVL_MSEC:
             ^
rbzmq.c:990:10: error: use of undeclared identifier 'ZMQ_HWM'
    case ZMQ_HWM:
         ^
rbzmq.c:991:10: error: use of undeclared identifier 'ZMQ_SWAP'
    case ZMQ_SWAP:
         ^
rbzmq.c:995:10: error: use of undeclared identifier 'ZMQ_MCAST_LOOP'
    case ZMQ_MCAST_LOOP:
         ^
rbzmq.c:1292:10: error: use of undeclared identifier 'ZMQ_HWM'
    case ZMQ_HWM:
         ^
rbzmq.c:1293:10: error: use of undeclared identifier 'ZMQ_SWAP'
    case ZMQ_SWAP:
         ^
rbzmq.c:1297:10: error: use of undeclared identifier 'ZMQ_MCAST_LOOP'
    case ZMQ_MCAST_LOOP:
         ^
rbzmq.c:1315:10: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC'
    case ZMQ_RECOVERY_IVL_MSEC:
         ^
rbzmq.c:1443:81: error: too few arguments to function call, expected 4, have 3
    send_args->rc = zmq_send(send_args->socket, send_args->msg, send_args->flags);
                    ~~~~~~~~                                                    ^
/usr/local/include/zmq.h:354:1: note: 'zmq_send' declared here
ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags);
^
/usr/local/include/zmq.h:67:27: note: expanded from macro 'ZMQ_EXPORT'
#       define ZMQ_EXPORT __attribute__ ((visibility("default")))
                          ^
rbzmq.c:1517:38: error: too few arguments to function call, expected 4, have 3
        rc = zmq_send (s, &msg, flags);
             ~~~~~~~~                ^
/usr/local/include/zmq.h:354:1: note: 'zmq_send' declared here
ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags);
^
/usr/local/include/zmq.h:67:27: note: expanded from macro 'ZMQ_EXPORT'
#       define ZMQ_EXPORT __attribute__ ((visibility("default")))
                          ^
rbzmq.c:1541:81: error: too few arguments to function call, expected 4, have 3
    recv_args->rc = zmq_recv(recv_args->socket, recv_args->msg, recv_args->flags);
                    ~~~~~~~~                                                    ^
/usr/local/include/zmq.h:356:1: note: 'zmq_recv' declared here
ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags);
^
/usr/local/include/zmq.h:67:27: note: expanded from macro 'ZMQ_EXPORT'
#       define ZMQ_EXPORT __attribute__ ((visibility("default")))
                          ^
rbzmq.c:1602:38: error: too few arguments to function call, expected 4, have 3
        rc = zmq_recv (s, &msg, flags);
             ~~~~~~~~                ^
/usr/local/include/zmq.h:356:1: note: 'zmq_recv' declared here
ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags);
^
/usr/local/include/zmq.h:67:27: note: expanded from macro 'ZMQ_EXPORT'
#       define ZMQ_EXPORT __attribute__ ((visibility("default")))
                          ^
rbzmq.c:1675:50: error: use of undeclared identifier 'ZMQ_HWM'
    rb_define_const (zmq_module, "HWM", INT2NUM (ZMQ_HWM));
                                                 ^
/Users/apple/.rbenv/versions/1.9.3-p484/include/ruby-1.9.1/ruby/ruby.h:973:35: note: expanded from macro 'INT2NUM'
# define INT2NUM(v) INT2FIX((int)(v))
                                  ^
/Users/apple/.rbenv/versions/1.9.3-p484/include/ruby-1.9.1/ruby/ruby.h:225:45: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                                            ^
rbzmq.c:1676:51: error: use of undeclared identifier 'ZMQ_SWAP'
    rb_define_const (zmq_module, "SWAP", INT2NUM (ZMQ_SWAP));
                                                  ^
/Users/apple/.rbenv/versions/1.9.3-p484/include/ruby-1.9.1/ruby/ruby.h:973:35: note: expanded from macro 'INT2NUM'
# define INT2NUM(v) INT2FIX((int)(v))
                                  ^
/Users/apple/.rbenv/versions/1.9.3-p484/include/ruby-1.9.1/ruby/ruby.h:225:45: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                                            ^
rbzmq.c:1683:57: error: use of undeclared identifier 'ZMQ_MCAST_LOOP'
    rb_define_const (zmq_module, "MCAST_LOOP", INT2NUM (ZMQ_MCAST_LOOP));
                                                        ^
/Users/apple/.rbenv/versions/1.9.3-p484/include/ruby-1.9.1/ruby/ruby.h:973:35: note: expanded from macro 'INT2NUM'
# define INT2NUM(v) INT2FIX((int)(v))
                                  ^
/Users/apple/.rbenv/versions/1.9.3-p484/include/ruby-1.9.1/ruby/ruby.h:225:45: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                                            ^
rbzmq.c:1698:64: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC'
    rb_define_const (zmq_module, "RECOVERY_IVL_MSEC", INT2NUM (ZMQ_RECOVERY_IVL_MSEC));
                                                               ^
/Users/apple/.rbenv/versions/1.9.3-p484/include/ruby-1.9.1/ruby/ruby.h:973:35: note: expanded from macro 'INT2NUM'
# define INT2NUM(v) INT2FIX((int)(v))
                                  ^
/Users/apple/.rbenv/versions/1.9.3-p484/include/ruby-1.9.1/ruby/ruby.h:225:45: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                                            ^
16 errors generated.
make: *** [rbzmq.o] Error 1


Gem files will remain installed in /Users/apple/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/zmq-2.1.4 for inspection.
Results logged to /Users/apple/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/zmq-2.1.4/./gem_make.out.

我成功地进行了一次 brew install zmq 并且我从错误日志中了解到 bundler 也可以找到 zmp。

我在这里错过了任何依赖项吗?请帮忙。

【问题讨论】:

    标签: ruby-on-rails-3 rubygems zeromq


    【解决方案1】:

    答案的想法来自这个博客http://blog.cuberoot.in/installing-zmq-gem-on-mountain-lion-mac-os-x/。我只是用不同的方式解决了它。

    这就是博客中提到的内容

    事实证明,zmq gem 没有针对 ZeroMQ 的最新稳定版本 3.2.2 进行更新,它与 2.2.0 版本一起工作(基本上是安装)。

    所以 zmq gem 与 2.2.0 版配合得很好

    我像这样从 brew 中删除我所有的 zeromq

    brew uninstall zeromq
    

    然后我搜索其他版本的zeromq

    brew search zeromq
    

    我从 brew search 得到这个结果

    homebrew/versions/zeromq22  homebrew/versions/zeromq32                       
    zeromq homebrew/versions/zeromq3  homebrew/versions/zeromq405
    

    幸运的是,brew 仍然支持 zeromq22。让我们安装它

    brew install homebrew/versions/zeromq22
    

    然后我尝试再次安装 gem

    gem install zmq -v 2.1.4
    

    但我仍然收到以下错误:

    gem install zmq -v 2.1.4
    Building native extensions.  This could take a while...
    ERROR:  Error installing zmq:
    ERROR: Failed to build gem native extension.
    
        /Users/ilab/.rbenv/versions/1.9.3-p484/bin/ruby extconf.rb
    checking for zmq.h... no
    checking for zmq.h in /opt/local/include,/usr/local/include,/usr/include... no
    extconf.rb:36:in `<main>': Couldn't find zmq library. try setting --with-zmq-dir=<path> to tell me where it is. (RuntimeError)      
    

    好像 zmq gem 找不到 zeromq。然后我尝试再次使用最新的 zeromq。

    brew install zeromq
    

    然后 zmq gem 知道 zeromq 安装。所以我认为 brew install 和 link 应该有问题。我强制 brew 链接回 zeromq22,如下所示:

    brew link --overwrite zeromq22 --force 
    

    然后尝试再次安装 gem。有效!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-06-02
      • 1970-01-01
      • 1970-01-01
      • 2015-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多