[英]rvm can't compile ruby: fails openssl check
我正在嘗試使用rvm
在 MacOS 11.6.1 上安裝 ruby 2.7.6。 我正在指定 brew 安裝的 openssl 的位置,但日志說它不是正確的版本。 在我看來一切都很好。 我不確定如何進一步排除故障。 詳細信息如下。
我執行這個命令:
rvm install 2.7.6 --with-openssl-dir=`brew --prefix openssl@1.1`
RVM 日志的相關部分是
openssl:
Could not be configured. It will not be installed.
Check ext/openssl/mkmf.log for more details.
ext/openssl/mkmf.log
的相關部分是:
checking for OpenSSL version >= 1.0.1 and < 3.0.0... -------------------- no
"gcc -I../../.ext/include/x86_64-darwin20 -I../.././include -I../.././ext/openssl -I/usr/local/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -O2 -fno-common -pipe -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <openssl/opensslv.h>
4:
5: /*top*/
6: int conftest_const[(OPENSSL_VERSION_NUMBER >= 0x10001000L) ? 1 : -1];
/* end */
"gcc -I../../.ext/include/x86_64-darwin20 -I../.././include -I../.././ext/openssl -I/usr/local/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -O2 -fno-common -pipe -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <openssl/opensslv.h>
4:
5: /*top*/
6: int conftest_const[(OPENSSL_VERSION_MAJOR >= 3) ? 1 : -1];
/* end */
--------------------
/Users/germuska/.rvm/src/ruby-2.7.6/ext/openssl/extconf.rb:111: OpenSSL >= 1.0.1, < 3.0.0 or LibreSSL >= 2.5.0 is required
/Users/germuska/.rvm/src/ruby-2.7.6/ext/openssl/extconf.rb:111:in `<top (required)>'
./ext/extmk.rb:214:in `load'
./ext/extmk.rb:214:in `block in extmake'
/Users/germuska/.rvm/src/ruby-2.7.6/lib/mkmf.rb:331:in `open'
./ext/extmk.rb:210:in `extmake'
./ext/extmk.rb:572:in `block in <main>'
./ext/extmk.rb:568:in `each'
./ext/extmk.rb:568:in `<main>'
仔細查看后,我意識到我在/usr/local/include
中有一個openssl
目錄(包含版本 3),它位於我使用--with-openssl-dir
選項指定的目錄之前的包含路徑上。
我通過將/usr/local/include/openssl
重命名為/usr/local/include/openssl_hideme
; 之后,擴展編譯器找到了我想要的版本。
我猜想命令行中的 include 會放在路徑的前面,但吸取了教訓。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.