Ruby gem eventmachine致命错误:';openssl/ssl.h';找不到文件

Ruby gem eventmachine致命错误:';openssl/ssl.h';找不到文件,ruby,macos,openssl,homebrew,eventmachine,Ruby,Macos,Openssl,Homebrew,Eventmachine,刚刚安装El Capitan,无法安装gemeventmachine1.0.7openssl位于1.0.2a-1。试图将--与ssl目录一起使用,但似乎被忽略 也向他们的家人报告了这件事 非常感谢您的建议。谢谢 $ ls /usr/local/Cellar/openssl/1.0.2a-1/include/openssl/ssl.h /usr/local/Cellar/openssl/1.0.2a-1/include/openssl/ssl.h $ gem install eventmachi

刚刚安装El Capitan,无法安装gem
eventmachine
1.0.7
<代码>openssl位于
1.0.2a-1
。试图将
--与ssl目录一起使用,但似乎被忽略

也向他们的家人报告了这件事

非常感谢您的建议。谢谢

$ ls /usr/local/Cellar/openssl/1.0.2a-1/include/openssl/ssl.h
/usr/local/Cellar/openssl/1.0.2a-1/include/openssl/ssl.h

$ gem install eventmachine -v '1.0.7' -- --with-ssl-dir=/usr/local/Cellar/openssl/1.0.2a-1/include
/Users/pain/.rbenv/versions/2.1.2/bin/ruby -r ./siteconf20150612-56154-1hsjz2n.rb extconf.rb --with-ssl-dir=/usr/local/Cellar/openssl/1.0.2a-1/include
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 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... yes
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:
./project.h:116:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^
1 error generated.
make: *** [binder.o] Error 1

make failed, exit code 2
$ls/usr/local/ceral/openssl/1.0.2a-1/include/openssl/ssl.h
/usr/local/ceral/openssl/1.0.2a-1/include/openssl/ssl.h
$gem install eventmachine-v'1.0.7'--with ssl dir=/usr/local/ceral/openssl/1.0.2a-1/include
/Users/pain/.rbenv/versions/2.1.2/bin/ruby-r./siteconf20150612-56154-1hsjz2n.rb extconf.rb——带ssl dir=/usr/local/ceral/openssl/1.0.2a-1/include
正在检查ruby.h、rubysig.h中的rb_陷阱_立即数。。。不
正在检查rb\u线程\u阻塞\u区域()。。。对
正在检查ruby/thread.h。。。对
正在检查ruby/thread.h中是否有rb\u线程调用\u而没有\u gvl()。。。对
正在检查sys/inotify.h中的inotify_init()。。。不
正在检查sys/syscall.h中的\uu NR\u inotify\u init。。。不
正在检查sys/uio.h中的writev()。。。对
正在检查rb\U线程\U fd\U select()。。。对
正在检查ruby/intern.h中的rb_fdset_t。。。对
正在检查rb_wait_for_single_fd()。。。对
正在检查rb_启用_中断()。。。不
正在检查rb_time_new()。。。对
正在检查sys/event.h。。。对
正在检查系统/队列。。。对
正在检查时钟\u gettime()。。。不
正在检查gethrtime()。。。不
创建Makefile
使“DESTDIR=”干净
使“DESTDIR=”
编译binder.cpp
在binder.cpp:20中包含的文件中:
./project.h:116:10:致命错误:“未找到openssl/ssl.h”文件
#包括
^
生成1个错误。
make:**[binder.o]错误1
make失败,退出代码2
您也可以像这样设置bundler,但我认为这是肤浅的

bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include

使用bundler和自制软件时:

$ bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
$ bundle install
然后:

它还修复了:

  • gem安装tak
  • 捆绑安装
  • rake和rails任务
另外,您可能需要删除并再次运行
brew安装openssl


问题的出现是因为苹果从OSX(El Captain build)中删除了openssl。

如果您将EventMachine作为另一个gem的依赖项安装,请确保在手动安装gem时指定正确的版本:

gem install eventmachine -v 1.0.5 -- --with-cppflags=-I$(brew --prefix openssl)/include
然后,您可以安装最初尝试安装的gem:

gem install mailcatcher

另一种方法是为整个用户配置文件添加绑定器配置条目,如下所示:

cd ~
bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
它将在您的主目录中创建一个.bundle/config文件,然后在您运行
bundle install
时在所有项目中使用该文件

gem pristine eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
pristine移除旧宝石并重新编译

cpp标志选项允许编译器查找openssl标头

如果希望抽象掉cpp flags参数,可以执行以下操作:

PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig"
如果愿意,还可以添加版本:

gem pristine eventmachine -v '1.0.4' -- --with-cppflags=-I/usr/local/opt/openssl/include

我试图安装v1.0.3,这对我来说很有效

gem install eventmachine -v '1.0.3' -- --with-cppflags=-I/usr/local/opt/openssl/include
这些讨论非常有帮助:


这假设机器已经通过
brew安装了openssl

这为我解决了问题:

PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" gem install eventmachine -v "1.0.8"

来源:

这对我来说很有效-

    gem install eventmachine -v '1.0.7' -- --debug --backtrace --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib
    Building native extensions with: '--debug --backtrace --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib'
    This could take a while...
    Successfully installed eventmachine-1.0.7
    Parsing documentation for eventmachine-1.0.7
    Installing ri documentation for eventmachine-1.0.7
    Done installing documentation for eventmachine after 9 seconds
    1 gem installed
注意:-在我成功安装这个gem之前,我必须做一些事情。这些可能适用于您,因此在此处列出它们-

1.)已退出公司VPN 或者您可能必须启用代理设置

2.)PKG_配置_路径设置为-

echo $PKG_CONFIG_PATH
/usr/local/opt/openssl/lib/pkgconfig
3.)必须在bash_概要文件中的$PATH中添加以下内容(在我的示例中~/.zshrc)

4.)还要注意的是,与我在这篇SO帖子中得到的一些答案以及这篇帖子相反,我无法安装
eventmachine

gem install eventmachine -v '1.0.7' -- --debug --backtrace --with-cppflags=-I/usr/local/include --with-ldflags=-L/usr/local/lib
Fetching: eventmachine-1.0.7.gem (100%)
Building native extensions with: '--debug --backtrace --with-cppflags=-I/usr/local/include --with-ldflags=-L/usr/local/lib'
This could take a while...
ERROR:  Error installing eventmachine:
    ERROR: Failed to build gem native extension.


在指定openssl位置时,
/usr/local/opt/openssl/include
似乎是正确的位置,而不是
/usr/local/include

对我来说,我必须先安装openssl,然后才能工作。e、 g.
brew安装openssl
这个版本为我在ruby 2.1.2的基础上安装eventmachine 1.0.3提供了帮助!这也是其他依赖OpenS的gem(如puma)的解决方法。我认为这个答案比认可的答案更好,因为它使用
bundle install
来执行实际的gem安装,它保证您将安装bundle中指定的确切版本。被接受的答案将安装最新版本,除非您在
gem install
命令中手动包含
-v x.x.x
。对我来说,我必须先安装openssl,然后才能生效。e、 g.
brew安装openssl
。如果您将gems设置到repo中的特定目录,即
vendor/bundle
,则您需要运行
bundle config build.GEMNAME--cppflags=-i/usr/local/opt/openssl/include
。我必须对gem
puma运行同样的操作,所以我想其他gem也会发生这种情况。请参阅lloeki的回答:“bundle config build.eventmachine--with cppflags=-I$(brew--prefix openssl)/include”。这对我很管用。不是这个。这对我有用
gem install eventmachine-v1.0.8--OSX El Capitan 10.11.5上的cppflags=-I/usr/local/opt/openssl/include
,对我来说,在安装
brew install openssl
后,我必须执行
brew link openssl--force
这确实是El Capitan上的修复程序。为了澄清,brew删除/安装的顺序是什么/link@Abram在
brew链接的情况下,强制openssl
无效。然后执行
brew卸载openssl
brew安装openssl
brew链接——强制openssl
这是今天Mac上的答案(El Capitan,2015-2016)。编辑:只是强制使用brew openssl。我不需要指定EventMachine的版本(我正在安装Middleman)。这也适用于我。好主意。为什么
pristine
而不是
install
gem install eventmachine--with cppflags=-I/usr/local/opt/openssl/include
对我有效。在
I/usr之前你需要一个宣传
    gem install eventmachine -v '1.0.7' -- --debug --backtrace --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib
    Building native extensions with: '--debug --backtrace --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib'
    This could take a while...
    Successfully installed eventmachine-1.0.7
    Parsing documentation for eventmachine-1.0.7
    Installing ri documentation for eventmachine-1.0.7
    Done installing documentation for eventmachine after 9 seconds
    1 gem installed
echo $PKG_CONFIG_PATH
/usr/local/opt/openssl/lib/pkgconfig
export PATH="/usr/local/opt/openssl/bin:$PATH"
gem install eventmachine -v '1.0.7' -- --debug --backtrace --with-cppflags=-I/usr/local/include --with-ldflags=-L/usr/local/lib
Fetching: eventmachine-1.0.7.gem (100%)
Building native extensions with: '--debug --backtrace --with-cppflags=-I/usr/local/include --with-ldflags=-L/usr/local/lib'
This could take a while...
ERROR:  Error installing eventmachine:
    ERROR: Failed to build gem native extension.