在Mac OS Ventura上安装Ruby 2.7.5失败***以下扩展未编译:openssl:无法配置,将不会安装

zf2sa74q  于 12个月前  发布在  Ruby
关注(0)|答案(2)|浏览(195)

我正在尝试安装一个旧版本的Ruby,这样我就可以使用react native .70了。如果能帮上忙我会很感激的。我发布了这个命令,以便使用openssl 1.1:

CONFIG_PATH=/usr/local/opt/[email protected]/lib/pkgconfig rvm reinstall 2.7.5 --with-openssl-lib=/usr/local/opt/[email protected] --with-openssl-include=/usr/local/opt/[email protected]

Ruby安装失败日志列出了我在标题中提到的错误,然后将我引用到ext/openssl/mkmf.log该日志列出了几个错误:

conftest.c:14:57: error: use of undeclared identifier 't_open'
     t(void) { void ((*volatile p)()); p = (void ((*)()))t_open; return !p; }
                                                            ^
    1 error generated.
    checked program was:
    /* begin */
     1: #include "ruby.h"
     2:
     3: /*top*/
     4: extern int t(void);
     5: int main(int argc, char **argv)
     6: {
     7:   if (argc > 1000000) {
     8:     int (* volatile tp)(void)=(int (*)(void))&t;
     9:     printf("%d", (*tp)());
    10:   }
    11:
    12:   return !!argv[argc];
    13: }
    14: int t(void) { void ((*volatile p)()); p = (void ((*)()))t_open; return !p; }

----------------



ld: library not found for -lnsl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11:
12:   return !!argv[argc];
13: }
14: extern void t_open();
15: int t(void) { t_open(); return 0; }
/* end */

------------------------
conftest.c:14:57: error: use of undeclared identifier 'socket'
int t(void) { void ((*volatile p)()); p = (void ((*)()))socket; return !p; }
                                                        ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11:
12:   return !!argv[argc];
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))socket; return !p; }
/* end */

-----------------------------

ld: library not found for -lsocket
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11:
12:   return !!argv[argc];
13: }
14: extern void socket();
15: int t(void) { socket(); return 0; }
/* end */

--------------------
conftest.c:6:3: error:
# error
  ^
conftest.c:7:1: error: expected identifier or '('
|:/ === LIBRESSL_VERSION_NUMBER undefined === /:|
^
2 errors generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <openssl/opensslv.h>
4: /*top*/
5: #ifndef LIBRESSL_VERSION_NUMBER
6: # error
7: |:/ === LIBRESSL_VERSION_NUMBER undefined === /:|
8: #endif
/* end */

---------------

 
/Users/dcent/.rvm/src/ruby-2.7.5/ext/openssl/extconf.rb:111: OpenSSL >= 1.0.1, < 3.0.0 or LibreSSL >= 2.5.0 is required
        /Users/dcent/.rvm/src/ruby-2.7.5/ext/openssl/extconf.rb:111:in `<top (required)>'
        ./ext/extmk.rb:214:in `load'
        ./ext/extmk.rb:214:in `block in extmake'
        /Users/dcent/.rvm/src/ruby-2.7.5/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>'

感谢您的指导。
我不知道下一步该怎么办。

b09cbbtk

b09cbbtk1#

brew install [[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection)
你试过这个吗

thigvfpy

thigvfpy2#

回顾日志,真正的问题是在我的标志之前处理openssl 3。

"gcc -I../../.ext/include/x86_64-darwin22 -I../.././include -I../.././ext/openssl -I/usr/local/Cellar/openssl@3/3.1.2/include -I/usr/local/opt/[email protected] .....

对我有效的修复方法-有些步骤可能不需要。安装rvm uninstall 2.7.5失败
在另一个线程中对每个解决方案包含目录进行临时重命名。mv /usr/local/Cellar/openssl@3 /usr/local/Cellar/hide_me
安装Ruby 2.7.5

CONFIG_PATH=/usr/local/opt/[email protected]/lib/pkgconfig rvm install 2.7.5 --with-openssl-lib=/usr/local/opt/[email protected] --with-openssl-include=/usr/local/opt/[email protected]

成功!!!
将openssl 3目录恢复为原始名称mv /usr/local/Cellar/hide_me /usr/local/Cellar/openssl@3

相关问题