gemeventmachine致命错误:找不到“openssl / ssl.h”文件

刚安装了El Capitan,不能安装gemeventmachine 1.0.7openssl1.0.2a-1 。 试图使用--with-ssl-dir但似乎被忽略。

也报告给他们的github回购 。

任何build议真的很感激。 谢谢。

 $ 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安装taks
  • 捆绑安装
  • 耙和铁轨任务

PS可能你需要删除并再次运行brew install openssl

问题的发生是因为苹果已经从OSX中删除了openssl(在El Captain版本中)

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

原始删除旧的gem,并重新编译它。

cpp标志选项允许编译器findopenssl头文件。

您也可以添加该版本,如果你喜欢:

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

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

 gem install eventmachine -v 1.0.5 -- --with-cppflags=-I$(brew --prefix openssl)/include 

然后你可以安装你最初试图安装的gem:

 gem install mailcatcher 

我正在尝试安装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

另一种方法是为整个用户configuration文件添加一个bundler config条目,如下所示:

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

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

这解决了我的问题:

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

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

Interesting Posts