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

fir*_*dev 265 ruby macos homebrew openssl eventmachine

刚安装El Capitan并且无法安装gem eventmachine 1.0.7.openssl1.0.2a-1.试图使用--with-ssl-dir但似乎被忽略了.

报告给他们的github回购也.

任何建议都非常感谢.谢谢.

$ 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
Run Code Online (Sandbox Code Playgroud)

fir*_*dev 513

$ gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include                                                                                                             
Building native extensions with: '--with-cppflags=-I/usr/local/opt/openssl/include'
This could take a while...
Successfully installed eventmachine-1.0.8
1 gem installed
Run Code Online (Sandbox Code Playgroud)

你也可以设置这样的捆绑器,但我认为这是肤浅的

bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
Run Code Online (Sandbox Code Playgroud)

  • 对我来说,安装 `brew install openssl` 之后我必须执行 `brew link openssl --force` (6认同)
  • 请参阅答案:'包配置build.eventmachine --with-cppflags = -I $(brew --prefix openssl)/ include'来自lloeki.这对我有用.不是这个. (4认同)
  • 对我来说,在这个工作之前我必须首先安装openssl.例如`brew install openssl`. (2认同)
  • 这对我来说在OSX El Capitan 10.11.5上运行`gem install eventmachine -v 1.0.8 - --with-cppflags = -I/usr/local/opt/openssl/include` (2认同)

Llo*_*eki 231

使用bundler和homebrew时:

$ bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
$ bundle install
Run Code Online (Sandbox Code Playgroud)

  • 对我来说,我必须先安装 openssl 才能起作用。例如`brew install openssl` (4认同)

its*_*lay 115

brew link --force openssl
Run Code Online (Sandbox Code Playgroud)

然后:

gem install eventmachine
Run Code Online (Sandbox Code Playgroud)

它还修复了:

  • 宝石安装技术
  • 捆绑安装
  • 耙和轨道任务

PS可能你需要删除并brew install openssl重新运行

这个问题发生了,因为Apple从OSX中移除了openssl(在El Captain构建中)

  • 这确实是对El Capitan的修复. (10认同)
  • @Abram如果是'brew link --force openssl`没有效果.然后做`brew uninstall openssl`,`brew install openssl`,`brew link --force openssl` (7认同)

jLu*_*Luc 13

gem pristine eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
Run Code Online (Sandbox Code Playgroud)

原始删除旧宝石并重新编译它.

cpp flags选项允许编译器查找openssl头文件.

如果您愿意,也可以添加版本:

gem pristine eventmachine -v '1.0.4' -- --with-cppflags=-I/usr/local/opt/openssl/include
Run Code Online (Sandbox Code Playgroud)

  • `gem install eventmachine - --with-cppflags = -I/usr/local/opt/openssl/include`为我工作. (4认同)

Ana*_*bel 8

我试图安装v 1.0.3,这对我有用.

gem install eventmachine -v '1.0.3' -- --with-cppflags=-I/usr/local/opt/openssl/include
Run Code Online (Sandbox Code Playgroud)

这些讨论非常有帮助.https://github.com/eventmachine/eventmachine/issues/602

  • 你需要在'I/usr/local/opt/openssl/include`之前进行宣传.这是一个字符,所以stackoverflow不允许我编辑它 (2认同)

Hea*_*ers 8

这看起来像是最近的问题:https ://github.com/eventmachine/eventmachine/issues/936

我在 macOS 上12.3.1通过以下方法解决了这个问题:

M1 最大:

gem install eventmachine -- --with-openssl-dir=/opt/homebrew/Cellar/openssl@1.1/1.1.1n/
Run Code Online (Sandbox Code Playgroud)

英特尔:

gem install eventmachine -- --with-openssl-dir=/usr/local/Cellar/openssl@1.1/1.1.1n/
Run Code Online (Sandbox Code Playgroud)


And*_*rew 7

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

gem install eventmachine -v 1.0.5 -- --with-cppflags=-I$(brew --prefix openssl)/include
Run Code Online (Sandbox Code Playgroud)

然后,您可以安装最初尝试安装的gem:

gem install mailcatcher
Run Code Online (Sandbox Code Playgroud)


Gio*_*ssi 7

这为我解决了问题:

PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" gem install eventmachine -v "1.0.8"
Run Code Online (Sandbox Code Playgroud)

来源:https : //github.com/sj26/mailcatcher/issues/254


Fre*_*röm 5

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

cd ~
bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
Run Code Online (Sandbox Code Playgroud)

它将在您的主目录中创建一个 .bundle/config 文件,然后在您运行时在所有项目中使用该文件bundle install


Zer*_*nel 5

我遇到了同样的 eventmachine 问题,上面的答案对我不起作用,最后使用给定的 openssl 版本重新安装 ruby​​:

rvm reinstall 3.1.2 --with-openssl-dir=/usr/local/opt/openssl@3
Run Code Online (Sandbox Code Playgroud)