Ruby 3.2.1搭建Jekyll时gem install eventmachine -v '1.2.7'失败如何解决?
解决Ruby 3.2.1搭建Jekyll时bundle安装eventmachine失败的问题
问题现象
执行bundle命令时触发eventmachine编译失败,核心报错信息如下:
current directory: /Users/chandanj/.rvm/gems/ruby-3.2.1/gems/eventmachine-1.2.7/ext make DESTDIR\= sitearchdir\=./.gem.20230620-52033-h7p7oy sitelibdir\=./.gem.20230620-52033-h7p7oy compiling binder.cpp In file included from binder.cpp:20: ./project.h:119: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 An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
错误原因
eventmachine 1.2.7编译时依赖OpenSSL的开发头文件,当前系统未安装该依赖或编译器无法识别其路径。
解决步骤
- 安装OpenSSL开发包(针对macOS系统,使用Homebrew):
brew install openssl - 指定OpenSSL路径手动安装eventmachine:
gem install eventmachine -v '1.2.7' -- --with-openssl-dir=$(brew --prefix openssl) - 重新执行bundle命令:
bundle install
内容的提问来源于stack exchange,提问作者Indyarocks
相关产品推荐
相关产品推荐

