環境
- Mac Pro (多分どのMacで起きるかと)
- macOS Sierra 10.12.4
- Ruby 2.0.0p645
- Rubyは書かないという強い意志
(私はRubyを書きたくありません)
具体的なエラー内容
$ bundle install --path vendor/bundle
・・・
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/path/to/ruby extconf.rb
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.h... yes
checking for clock_gettime()... yes
checking for CLOCK_MONOTONIC_RAW in time.h... yes
checking for CLOCK_MONOTONIC in time.h... yes
creating Makefile
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
Gem files will remain installed in /path/to/project/vendor/bundle/ruby/2.0.0/gems/eventmachine-1.0.7 for
inspection.
Results logged to /path/to/project/vendor/bundle/ruby/2.0.0/gems/eventmachine-1.0.7/ext/gem_make.out
An error occurred while installing eventmachine (1.0.7), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.7'` succeeds before bundling.
といったかんじに eventmachine
でエラーが発生する。
対処法
OpenSSLをとりあえず入れる
Homebrewが入っていない人は以下
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update
$ brew install openssl
$ brew link openssl --force # ここだけログを書いておきます
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
1番下に出てきた -I/usr/local/opt/openssl/include
がミソになるらしい
eventmachineを入れる
$ gem install eventmachine -v '1.0.7' -- --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.7
Parsing documentation for eventmachine-1.0.7
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/fastfilereaderext.bundle, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/rubyeventmachine.bundle, skipping
Installing ri documentation for eventmachine-1.0.7
1 gem installed
入った!
参考サイト