gem eventmachine fatal error: 'openssl/ssl.h' file not found
gem eventmachine fatal error: 'openssl/ssl.h' file not found
刚刚安装了El Capitan,无法安装gemeventmachine
1.0.7
。 openssl
在 1.0.2a-1
。尝试使用 --with-ssl-dir
但它似乎被忽略了。
也向他们的 github repo 报告了。
非常感谢任何建议。谢谢。
$ 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
$ 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
您也可以像这样设置捆绑器,但我认为这是肤浅的
bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
使用捆绑器和自制软件时:
$ bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
$ bundle install
brew link --force openssl
然后:
gem install eventmachine
它还修复了:
- gem 安装任务
- 捆绑安装
- rake 和 rails 任务
P.S。可能您需要再次删除 运行 brew install openssl
出现此问题是因为 Apple 已从 OSX(在 El Captain 版本中)中删除了 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 删除旧的 gem 并重新编译它。
cpp 标志选项允许编译器找到 openssl headers。
如果您更喜欢抽象掉 cpp 标志参数,您可以执行以下操作:
PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig"
如果你喜欢也可以添加版本:
gem pristine eventmachine -v '1.0.4' -- --with-cppflags=-I/usr/local/opt/openssl/include
我正在尝试安装 v 1.0.3,这对我有用。
gem install eventmachine -v '1.0.3' -- --with-cppflags=-I/usr/local/opt/openssl/include
这些讨论很有帮助:https://github.com/eventmachine/eventmachine/issues/602
这假设机器已经通过 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_CONFIG_PATH 设置为 -
echo $PKG_CONFIG_PATH
/usr/local/opt/openssl/lib/pkgconfig
3.) 必须将以下内容添加到 bash_profile 中的 $PATH(在我的例子中是 ~/.zshrc)
export PATH="/usr/local/opt/openssl/bin:$PATH"
4.) 另请注意,与我在此 SO post 以及 github-eventmachine 上的此线程中得到的一些答案相反,我无法安装 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.
似乎 /usr/local/opt/openssl/include
是正确的位置,而不是 /usr/local/include
在指定 openssl 位置时。
对于 Jekyll 和 Fish:
gem install jekyll -- --with-cppflags=-I(brew --prefix openssl)/include
这看起来像是一个更新的问题: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/
英特尔:
gem install eventmachine -- --with-openssl-dir=/usr/local/Cellar/openssl@1.1/1.1.1n/
刚刚安装了El Capitan,无法安装gemeventmachine
1.0.7
。 openssl
在 1.0.2a-1
。尝试使用 --with-ssl-dir
但它似乎被忽略了。
也向他们的 github repo 报告了。
非常感谢任何建议。谢谢。
$ 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
$ 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
您也可以像这样设置捆绑器,但我认为这是肤浅的
bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
使用捆绑器和自制软件时:
$ bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
$ bundle install
brew link --force openssl
然后:
gem install eventmachine
它还修复了:
- gem 安装任务
- 捆绑安装
- rake 和 rails 任务
P.S。可能您需要再次删除 运行 brew install openssl
出现此问题是因为 Apple 已从 OSX(在 El Captain 版本中)中删除了 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 删除旧的 gem 并重新编译它。
cpp 标志选项允许编译器找到 openssl headers。
如果您更喜欢抽象掉 cpp 标志参数,您可以执行以下操作:
PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig"
如果你喜欢也可以添加版本:
gem pristine eventmachine -v '1.0.4' -- --with-cppflags=-I/usr/local/opt/openssl/include
我正在尝试安装 v 1.0.3,这对我有用。
gem install eventmachine -v '1.0.3' -- --with-cppflags=-I/usr/local/opt/openssl/include
这些讨论很有帮助:https://github.com/eventmachine/eventmachine/issues/602
这假设机器已经通过 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_CONFIG_PATH 设置为 -
echo $PKG_CONFIG_PATH
/usr/local/opt/openssl/lib/pkgconfig
3.) 必须将以下内容添加到 bash_profile 中的 $PATH(在我的例子中是 ~/.zshrc)
export PATH="/usr/local/opt/openssl/bin:$PATH"
4.) 另请注意,与我在此 SO post 以及 github-eventmachine 上的此线程中得到的一些答案相反,我无法安装 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.
似乎 /usr/local/opt/openssl/include
是正确的位置,而不是 /usr/local/include
在指定 openssl 位置时。
对于 Jekyll 和 Fish:
gem install jekyll -- --with-cppflags=-I(brew --prefix openssl)/include
这看起来像是一个更新的问题: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/
英特尔:
gem install eventmachine -- --with-openssl-dir=/usr/local/Cellar/openssl@1.1/1.1.1n/