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

zf2sa74q  于 2023-10-17  发布在  Ruby
关注(0)|答案(2)|浏览(267)

我正在尝试安装一个旧版本的Ruby,这样我就可以使用react native .70了。如果能帮上忙我会很感激的。我发布了这个命令,以便使用openssl 1.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该日志列出了几个错误:

  1. conftest.c:14:57: error: use of undeclared identifier 't_open'
  2. t(void) { void ((*volatile p)()); p = (void ((*)()))t_open; return !p; }
  3. ^
  4. 1 error generated.
  5. checked program was:
  6. /* begin */
  7. 1: #include "ruby.h"
  8. 2:
  9. 3: /*top*/
  10. 4: extern int t(void);
  11. 5: int main(int argc, char **argv)
  12. 6: {
  13. 7: if (argc > 1000000) {
  14. 8: int (* volatile tp)(void)=(int (*)(void))&t;
  15. 9: printf("%d", (*tp)());
  16. 10: }
  17. 11:
  18. 12: return !!argv[argc];
  19. 13: }
  20. 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))t_open; return !p; }
  21. ----------------
  22. ld: library not found for -lnsl
  23. clang: error: linker command failed with exit code 1 (use -v to see invocation)
  24. checked program was:
  25. /* begin */
  26. 1: #include "ruby.h"
  27. 2:
  28. 3: /*top*/
  29. 4: extern int t(void);
  30. 5: int main(int argc, char **argv)
  31. 6: {
  32. 7: if (argc > 1000000) {
  33. 8: int (* volatile tp)(void)=(int (*)(void))&t;
  34. 9: printf("%d", (*tp)());
  35. 10: }
  36. 11:
  37. 12: return !!argv[argc];
  38. 13: }
  39. 14: extern void t_open();
  40. 15: int t(void) { t_open(); return 0; }
  41. /* end */
  42. ------------------------
  43. conftest.c:14:57: error: use of undeclared identifier 'socket'
  44. int t(void) { void ((*volatile p)()); p = (void ((*)()))socket; return !p; }
  45. ^
  46. 1 error generated.
  47. checked program was:
  48. /* begin */
  49. 1: #include "ruby.h"
  50. 2:
  51. 3: /*top*/
  52. 4: extern int t(void);
  53. 5: int main(int argc, char **argv)
  54. 6: {
  55. 7: if (argc > 1000000) {
  56. 8: int (* volatile tp)(void)=(int (*)(void))&t;
  57. 9: printf("%d", (*tp)());
  58. 10: }
  59. 11:
  60. 12: return !!argv[argc];
  61. 13: }
  62. 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))socket; return !p; }
  63. /* end */
  64. -----------------------------
  65. ld: library not found for -lsocket
  66. clang: error: linker command failed with exit code 1 (use -v to see invocation)
  67. checked program was:
  68. /* begin */
  69. 1: #include "ruby.h"
  70. 2:
  71. 3: /*top*/
  72. 4: extern int t(void);
  73. 5: int main(int argc, char **argv)
  74. 6: {
  75. 7: if (argc > 1000000) {
  76. 8: int (* volatile tp)(void)=(int (*)(void))&t;
  77. 9: printf("%d", (*tp)());
  78. 10: }
  79. 11:
  80. 12: return !!argv[argc];
  81. 13: }
  82. 14: extern void socket();
  83. 15: int t(void) { socket(); return 0; }
  84. /* end */
  85. --------------------
  86. conftest.c:6:3: error:
  87. # error
  88. ^
  89. conftest.c:7:1: error: expected identifier or '('
  90. |:/ === LIBRESSL_VERSION_NUMBER undefined === /:|
  91. ^
  92. 2 errors generated.
  93. checked program was:
  94. /* begin */
  95. 1: #include "ruby.h"
  96. 2:
  97. 3: #include <openssl/opensslv.h>
  98. 4: /*top*/
  99. 5: #ifndef LIBRESSL_VERSION_NUMBER
  100. 6: # error
  101. 7: |:/ === LIBRESSL_VERSION_NUMBER undefined === /:|
  102. 8: #endif
  103. /* end */
  104. ---------------
  105. /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
  106. /Users/dcent/.rvm/src/ruby-2.7.5/ext/openssl/extconf.rb:111:in `<top (required)>'
  107. ./ext/extmk.rb:214:in `load'
  108. ./ext/extmk.rb:214:in `block in extmake'
  109. /Users/dcent/.rvm/src/ruby-2.7.5/lib/mkmf.rb:331:in `open'
  110. ./ext/extmk.rb:210:in `extmake'
  111. ./ext/extmk.rb:572:in `block in <main>'
  112. ./ext/extmk.rb:568:in `each'
  113. ./ext/extmk.rb:568:in `<main>'

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

b09cbbtk

b09cbbtk1#

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

thigvfpy

thigvfpy2#

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

  1. "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

  1. 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

相关问题