[英]Gem::Ext::BuildError: ERROR: Failed to build gem native extension for Puma Gem
I have imported my ruby project from Linux(using RVM) to MacOSX(rbenv).我已经将我的 ruby 项目从 Linux(使用 RVM)导入到 MacOSX(rbenv)。 Both are using the same version of rails & ruby.两者都使用相同版本的 rails & ruby。 As I followed the GoRails guide to install RoR on both the machines.当我按照 GoRails 指南在两台机器上安装 RoR 时。
So as I have imported the sample_app from Linux to MacOSX, I ran bundle install.因此,当我将 sample_app 从 Linux 导入到 MacOSX 时,我运行了 bundle install。 I installed lots of gems nearly 50-100 but this one failed.我安装了近 50-100 个宝石,但这个失败了。 I have no idea why is it failing.我不知道为什么它失败了。 To me it looks like it failed to compile some of the c files but I don't know how to fix these errors.对我来说,它似乎无法编译某些 c 文件,但我不知道如何修复这些错误。 Thanks谢谢
Installing puma 2.11.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/var/rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160304-50117-b8gsxw.rb extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling http11_parser.c
compiling io_buffer.c
io_buffer.c:119:10: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
return rb_str_new(b->top, b->cur - b->top);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/var/rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/intern.h:796:20: note: expanded from macro 'rb_str_new'
rb_str_new_static((str), (len)) : \
^~~~~
/usr/local/var/rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/intern.h:727:37: note: passing argument to parameter here
VALUE rb_str_new_static(const char *, long);
^
io_buffer.c:119:10: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
return rb_str_new(b->top, b->cur - b->top);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/var/rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/intern.h:797:13: note: expanded from macro 'rb_str_new'
rb_str_new((str), (len)); \
^~~~~
/usr/local/var/rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/intern.h:706:29: note: passing argument to parameter here
VALUE rb_str_new(const char*, long);
^
2 warnings generated.
compiling mini_ssl.c
In file included from mini_ssl.c:3:
/usr/local/var/rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/backward/rubyio.h:2:2: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings]
#warning use "ruby/io.h" instead of "rubyio.h"
^
mini_ssl.c:4:10: fatal error: 'openssl/bio.h' file not found
#include <openssl/bio.h>
^
1 warning and 1 error generated.
make: *** [mini_ssl.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/puma-2.11.1 for inspection.
Results logged to /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/puma-2.11.1/gem_make.out
You need homebrew and openssl.你需要自制软件和 openssl。 Run brew install openssl
and then bundle config build.puma --with-opt-dir=/usr/local/opt/openssl
运行brew install openssl
然后bundle config build.puma --with-opt-dir=/usr/local/opt/openssl
Then running bundle install
should work.然后运行bundle install
应该可以工作。
Relevant issue: https://github.com/puma/puma/issues/718相关问题: https : //github.com/puma/puma/issues/718
If you are using ubuntu 14.04 to any upgraded versions and if you have installed OpenSSL in your system then you just need to run these commands如果您使用 ubuntu 14.04 到任何升级版本,并且您的系统中安装了 OpenSSL,那么您只需要运行这些命令
First Just get the location where OpenSSL installed normally it is installed in this location /usr/bin/openssl if you have installed in separate location get your location first using首先只需获取正常安装 OpenSSL 的位置,它安装在此位置 /usr/bin/openssl 如果您已安装在单独的位置,请先获取您的位置
sudo find / -name openssl
and then接着
bundle config build.puma --with-opt-dir=/usr/bin/openssl
and then接着
bundle install
It will be succeeded unless your OpenSSL installed in a path is correct除非您安装在路径中的 OpenSSL 正确,否则它将成功
If you haven't installed OpenSSL before just install it using如果您在安装之前尚未安装 OpenSSL,请使用
sudo apt-get install openssl
It will work prefectly.它将完美地工作。 Cheers干杯
Installing openssl ruby-openssl and libssl-dev on ubuntu finally helped me out.在 ubuntu 上安装 openssl ruby-openssl 和 libssl-dev 终于帮到了我。
apt-get install openssl ruby-openssl libssl-dev apt-get install openssl ruby-openssl libssl-dev
嘿,您是否尝试使用以下标志安装 gem?
-- --with-cflags="-Wno-error=implicit-function-declaration"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.