ruby-on-rails – 无法在OS X优胜美地上构建美宝宝

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 无法在OS X优胜美地上构建美宝宝前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
(修订)问题:

在我的OS X优胜美地(10.10.1)系统上安装美宝玛宝石是什么?我已经耗尽了一大堆(我有XCode工具,我有OpenSSL),但是在尝试构建本机扩展时仍然失败.

问题

在我的OS X系统上,当我做:

  1. $gem install puma

我得到:

  1. Building native extensions. This could take a while...
  2. ERROR: Error installing puma:
  3. ERROR: Failed to build gem native extension.
  4.  
  5. /Users/home/sandBox/usr/bin/ruby extconf.rb
  6. checking for SSL_CTX_new() in -lssl... no
  7. checking for SSL_CTX_new() in -lssleay32... no
  8. *** extconf.rb Failed ***
  9. Could not create Makefile due to some reason,probably lack of necessary
  10. libraries and/or headers. Check the mkmf.log file for more details. You may
  11. need configuration options.
  12.  
  13. Provided configuration options:
  14. --with-opt-dir
  15. --with-opt-include
  16. --without-opt-include=${opt-dir}/include
  17. --with-opt-lib
  18. --without-opt-lib=${opt-dir}/lib
  19. --with-make-prog
  20. --without-make-prog
  21. --srcdir=.
  22. --curdir
  23. --ruby=/Users/home/sandBox/usr/bin/ruby
  24. --with-puma_http11-dir
  25. --without-puma_http11-dir
  26. --with-puma_http11-include
  27. --without-puma_http11-include=${puma_http11-dir}/include
  28. --with-puma_http11-lib
  29. --without-puma_http11-lib=${puma_http11-dir}/lib
  30. --with-ssllib
  31. --without-ssllib
  32. --with-ssleay32lib
  33. --without-ssleay32lib
  34.  
  35. extconf Failed,exit code 1
  36.  
  37. Gem files will remain installed in /Users/home/sandBox/usr/lib/ruby/gems/2.1.0/gems/puma-2.10.2 for inspection.
  38. Results logged to /Users/home/sandBox/usr/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0/puma-2.10.2/gem_make.out

环境

我怀疑gem安装无法找到SSL头和/或库.这是我的系统上的(注意〜/ sandBox / usr是我的“沙盒”目录,包含我的Ruby on Rails开发的所有可执行文件,库,标题等).请注意,“ssl.h”定义SSL_CTX_new():

  1. $which openssl
  2. ~/sandBox/usr/bin/openssl
  3. $openssl version
  4. OpenSSL 1.0.1j 15 Oct 2014
  5. $openssl version -d
  6. OPENSSLDIR: "/Users/home/sandBox/usr/ssl"
  7. $find ~/sandBox/usr -name "*libssl*" -print
  8. ~/sandBox/usr/lib/libssl.a
  9. $find ~/sandBox/usr -name "*.h" -exec grep SSL_CTX_new {} /dev/null \;
  10. ~/sandBox/usr/include/openssl/ssl.h:SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);

另外,这里是如何编译ruby的. $INSTALL_DIR是〜/ home / sandBox

  1. ./configure --prefix=$(INSTALL_DIR) --enable-shared --disable-install-doc --with-opt-dir=$(INSTALL_DIR) --with-openssl-dir=$(INSTALL_DIR)/bin; where INSTALL_DIR is ~/sandBox/usr.

问题

我只是想要一些构建过程的配置标志?我或多或少地尝试过一堆标志:

  1. $gem install puma -- --with-openssl-dir=/Users/home/sandBox/usr/ssl
  2. $gem install puma -- --with-ssllib=/Users/home/sandBox/usr/lib/libssl.a
  3. $gem install puma -- --with-ssl=/Users/home/sandBox/usr/bin/openssl
  4. $gem install puma -- --with-ssl=/Users/home/sandBox/usr/bin
  5. $gem install puma -- --with-opt-dir=/Users/home/sandBox/usr

但是在每种情况下都有相同的错误.有人能告诉我我失踪了吗?

更多信息…

带有错误的mkmf.log文件看起来像这样(为了可读性而添加换行符):

  1. "clang -o conftest
  2. -I/Users/home/sandBox/usr/include/ruby-2.1.0/x86_64-darwin14.0
  3. -I/Users/home/sandBox/usr/include/ruby-2.1.0/ruby/backward
  4. -I/Users/home/sandBox/usr/include/ruby-2.1.0
  5. -I.
  6. -I/Users/home/sandBox/usr/include
  7. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT
  8. -O3 -fno-fast-math -ggdb3 -Wall -Wextra
  9. -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers
  10. -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement
  11. -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wextra-tokens
  12. -fno-common -pipe conftest.c
  13. -L.
  14. -L/Users/home/sandBox/usr/lib
  15. -L/Users/home/sandBox/usr/lib
  16. -L. -fstack-protector
  17. -L/Users/home/sandBox/usr/lib
  18. -lruby.2.1.0 -lssl -lpthread -ldl -lobjc "
  19.  
  20. conftest.c:13:57: error: use of undeclared identifier 'SSL_CTX_new'
  21.  
  22. int t(void) { void ((*volatile p)()); p = (void ((*)()))SSL_CTX_new; return 0; }

当我浏览我的沙箱目录树时,唯一定义SSL_CTX_new的头文件是〜/ sandBox / include / openssl / ssl.h.看来这个文件没有包括在内,我目前还在为甚么而感到失望.

解决方法

对于那些遇到麻痹症和开漏症的人来说,特别是在Mac OS 10.11(El Capitan)上,添加一些标志可以节省您几个小时的心痛:
  1. gem install puma -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib

https://gist.github.com/edvinasbartkus/0e99ea8305a20737f562

猜你在找的Ruby相关文章