2016-02-11 24 views
6

Tôi chỉ định dạng lại MacBook của mình và tôi cố gắng sao chép dự án Rails của mình. Khi tôi làm bundle install, đá quý Puma không thành công.Không thể cài đặt đá quý Puma trên OSX 10.11.3

Khi tôi chạy gem install puma -v '2.13.4', tôi nhận được lỗi này:

Fetching: puma-2.13.4.gem (100%) 
Building native extensions. This could take a while... 
ERROR: Error installing puma: 
    ERROR: Failed to build gem native extension. 

    /Users/zulhilmi/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20160211-95547-1pdaoaq.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); 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:796:20: note: expanded from macro 'rb_str_new' 
     rb_str_new_static((str), (len)) : \ 
          ^~~~~ 
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/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); 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:797:13: note: expanded from macro 'rb_str_new' 
     rb_str_new((str), (len));   \ 
        ^~~~~ 
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/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: 
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/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 /Users/zulhilmi/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/puma-2.13.4 for inspection. 

Tôi nên làm gì?

Về dự án của tôi và môi trường của tôi:

  • Ruby: 2.2.0 (Tôi đang sử dụng RVM)
  • Rails: 4.2.0
  • OSX: 10.11.3
+0

Hình như bạn cần phải cài đặt các phụ thuộc như openssl: [Link] (http://stackoverflow.com/questions/ 30143180/puma-gem-failed-to-build-gem-native-mở rộng) – Vincent

Trả lời

4

This solution phù hợp với tôi:

brew install openssl 
brew link --force openssl 
18

Thay vì lực liên kết openssl (là KHÔNG được khuyến nghị theo điều này Github Opened issue) theo đề xuất của Zulhilmi Zainudin, Tôi đề xuất giải pháp sau dựa trên số 783 của mã nguồn Puma (tham chiếu bên dưới).
Tôi đang sử dụng El Capitan (10.11) với openssl cài đặt qua Homebrew:

$ gem install puma -v 2.13.4 -- --with-opt-dir=/usr/local/opt/openssl

tham khảo: https://github.com/puma/puma/issues/783

Nhưng nếu bạn muốn làm cho nó làm việc cho tất cả Gemfiles của bạn, bạn vẫn có thể:

$ bundle config build.puma --with-opt-dir=/usr/local/opt/openssl

và xác nhận:
$ grep PUMA ~/.bundle/config

đầu ra nên là:

BUNDLE_BUILD__PUMA: "--with-opt-dir=/usr/local/opt/openssl"

tham khảo: https://github.com/puma/puma/issues/718

+1

điều này vừa cứu mạng tôi, cảm ơn bạn – yuval

Các vấn đề liên quan