刚安装 El Capitan,无法安装 gem eventmachine
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 install openssl
bundle install
来执行实际的 gem 安装,它保证您将安装包中指定的确切版本。接受的答案将安装最新版本,除非您在 gem install
命令中手动包含 -v x.x.x
。
brew link --force openssl
然后:
gem install eventmachine
它还修复了:
gem 安装任务
捆绑安装
rake 和 rails 任务
PS 可能您需要删除并再次运行 brew install openssl
问题发生是因为 Apple 已从 OSX 中删除了 openssl(在 El Captain 构建中)
brew link --force openssl
没有效果。然后执行 brew uninstall openssl
、brew install openssl
、brew link --force openssl
gem pristine eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
pristine 删除旧的 gem 并重新编译它。
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
pristine
而不是 install
?
gem install eventmachine -- --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。
I/usr/local/opt/openssl/include
之前需要一个连字符。这是一个字符,所以stackoverflow不允许我编辑它
如果您将 EventMachine 作为另一个 gem 的依赖项安装,请确保在手动安装 gem 时指定正确的版本:
gem install eventmachine -v 1.0.5 -- --with-cppflags=-I$(brew --prefix openssl)/include
然后您可以安装您最初尝试安装的 gem:
gem install mailcatcher
这为我解决了这个问题:
PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" gem install eventmachine -v "1.0.8"
来源:https://github.com/sj26/mailcatcher/issues/254
一种替代方法是为您的整个用户配置文件添加一个捆绑器配置条目,如下所示:
cd ~
bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
它将在您的主目录中创建一个 .bundle/config 文件,然后在您运行 bundle install
时在您的所有项目中使用该文件。
这对我有用 -
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 帖子中得到的一些答案以及 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.
在指定 openssl 位置时,似乎 /usr/local/opt/openssl/include
是正确的位置,而不是 /usr/local/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/
对于杰基尔和鱼:
gem install jekyll -- --with-cppflags=-I(brew --prefix openssl)/include
这为我安装了它:
gem install eventmachine -- --with-openssl-dir=/usr/local/opt/openssl@1.1
我从 the eventmachine Github repo 得到的。显然,OpenSSL 工具在某个时候从 MacOS 中移动/删除。
就我而言,我想安装依赖于 eventmachine 的其他东西(mailcatcher)。我通过在上述命令中将 eventmachine
替换为 mailcatcher
来做到这一点。
brew install openssl
。vendor/bundle
,那么您将需要运行bundle config build.GEMNAME--with-cppflags=-I/usr/local/opt/openssl/include
。我必须用 gempuma
运行相同的东西,所以我想这也发生在其他 gem 上。gem install eventmachine -v 1.0.8 -- --with-cppflags=-I/usr/local/opt/openssl/include
brew install openssl
我必须做brew link openssl --force