【问题标题】:error while 'sudo gem install eventmachine -v 1.0.8 ' on mac osmac os 上的“sudo gem install eventmachine -v 1.0.8”时出错
【发布时间】:2016-03-18 07:20:49
【问题描述】:

这是我在 mac os 上安装 eventmachine 时遇到的错误,我已经尝试了所有答案,但直到现在都无法解决,这里是错误日志。

<pre><code>Building native extensions.  This could take a while...
ERROR:  Error installing eventmachine:
	ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for pipe2() in unistd.h... no
checking for accept4() in sys/socket.h... no
checking for SOCK_CLOEXEC in sys/socket.h... no
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue.h... yes
CFLAGS=$(cflags)  -pipe -I/opt/local/include -Wall -Wextra -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-unused-result
CPPFLAGS=-D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags) -Wall -Wextra -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-unused-result
checking for clock_gettime()... no
checking for gethrtime()... no
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling binder.cpp
In file included from binder.cpp:20:0:
project.h:29:20: fatal error: iostream: No such file or directory
 #include <iostream>
                    ^
compilation terminated.
make: *** [binder.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.8 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/eventmachine-1.0.8/gem_make.out</code></pre>

如有任何帮助,我们将不胜感激。

【问题讨论】:

    标签: ruby-on-rails ruby macos gem bundler


    【解决方案1】:

    这是你的问题:

    make "DESTDIR="
    compiling binder.cpp
    In file included from binder.cpp:20:0:
    project.h:29:20: fatal error: iostream: No such file or directory
    #include <iostream>
    

    发生的情况是编译器找不到 project.h 的包含 iostream。您可以手动安装它,下面提供了链接。

    https://github.com/eventmachine/eventmachine/wiki/Building-EventMachine

    此链接可能有助于解决您的问题。

    C++ Hello World trouble on OSX10.8

    另一个潜在的快速修复方法是手动安装它,看看添加标题扩展是否能解决您的问题。

    #include <iostream.h>
    

    【讨论】:

    • 我尝试手动构建 gem,但仍然存在同样的问题,并且所有东西都正确安装(即 xcode、gcc、g++ ...)
    • 您尝试了最后一步吗?请记住,如果您有一个较旧的编译器,则可能需要头文件扩展,这意味着当您尝试手动安装它时,您需要先进入并添加它。您遇到的唯一问题是活页夹无法找到 iostream。此外,请使用旧版本的 Ruby 尝试所有这些,因为我知道某些 gem 无法使用最新版本的 Ruby 正确编译,因为某些原因它无法正确找到 devkit。
    • 是的,我尝试添加 iostream.h,但日志告诉我找不到 iostream.h 标头。当我尝试使用 ruby​​-2.0.0 安装它时,它可以工作,但是使用 2.1.5 它会出现上述错误。
    • 当我在 Ruby 2.2.3p173 和 2.1.6p336 上安装它时,它运行良好。这可能是您正在使用的当前版本的问题,或者您的 ENV 有问题。
    【解决方案2】:

    如果您使用的是 Mac OSX el Captain,默认情况下不安装 openssl 标头,因此请尝试安装 openssl。如果 openssl 已安装,请尝试使用以下命令重新链接

    brew link openssl --force
    

    查看此问题了解更多详情 - https://github.com/eventmachine/eventmachine/issues/643

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-01
      • 1970-01-01
      • 2014-03-30
      • 2014-11-17
      • 2014-04-17
      • 2014-01-28
      • 2014-02-03
      • 2013-05-23
      相关资源
      最近更新 更多