安装 ruby 但出现错误"linker command failed with exit code 1"



我正在构建一个GitHub Pages网站,并试图为我的Mac安装Ruby,如下所述。当我运行ruby-install ruby 时,我得到以下内容:

linking shared-object -test-/arith_seq/extract.bundle
Undefined symbols for architecture arm64:
  "_rb_arithmetic_sequence_extract", referenced from:
      _arith_seq_s_extract in extract.o
  "_rb_ary_new_capa", referenced from:
      _arith_seq_s_extract in extract.o
  "_rb_ary_store", referenced from:
      _arith_seq_s_extract in extract.o
  "_rb_define_singleton_method", referenced from:
      _Init_extract in extract.o
  "_rb_path2class", referenced from:
      _Init_extract in extract.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../../../../.ext/arm64-darwin22/-test-/arith_seq/extract.bundle] Error 1
make[1]: *** [ext/-test-/arith_seq/extract/all] Error 2
make: *** [build-ext] Error 2
!!! Compiling ruby 3.1.2 failed!

我完全不熟悉Ruby,不知道如何理解它。什么好主意吗?由于

在遵循Jekyll指南之后,我遇到了和你一样的问题。

Christian从你的评论中提供了一个非常详细的解决方案,并解释了导致它的原因。

更新到macOS 12.6或13.0后,您可能仍然可以安装2.7。X和3。使用rbenv或asdf的x版本的Ruby。使用ruby-install,您需要添加——enable-shared标志。一旦2.7.7和3.1.3发布,你应该不再需要添加任何标志。

Install for me on Mac OS 12.6 working with ruby-install 3.1.2 -- --enable-shared

相关内容

最新更新