在ARM-64 MacOS机器上构建Ruby时遇到的问题。

huangapple go评论100阅读模式
英文:

Problems building Ruby on ARM-64 MacOS machine

问题

无法在我的Mac OS ARM-64机器上构建Ruby 3.1.1,因为它尝试使用一些x86_64版本的文件。

我正在尝试使用brew和rbenv来管理我的Ruby安装。我已经查看了几个在线资源,尝试指定系统上的OpenSSL和libFFI安装,但显然仍然存在问题。

我正在输入:

rvm reinstall 3.1.1 --with-openssl-dir=`brew --prefix openssl`

仍然收到错误消息。

具体来说,我收到以下错误消息:
openssl_missing.c:24:13: error: incomplete definition of type 'struct X509_crl_st' *psig = crl->signature;,以及在进程后面似乎与之相关的错误:ld: warning: ignoring file /usr/local/Cellar/libffi/3.4.4/lib/libffi.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

这是在我设置了我的.zshrc文件之后的,文件中包含以下内容:

export LDFLAGS="-L/usr/local/opt/libffi/lib"
export CPPFLAGS="-I/usr/local/opt/libffi/include"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

这是根据其他搜索结果以及其他地方的指示所做的。

有人知道该怎么办吗?我想象Ruby 3.1.1已经由其他人在MacOS上编译过。至少我之所以做这个操作的部分原因是因为我无法安装Rails的gem。

英文:

Unable to build Ruby 3.1.1 on my Mac OS ARM-64 machine, as it tries to use x86_64 versions of some files.

I'm trying to use brew and rbenv to manage my Ruby installation. I have used several sources online to try to specify the OpenSSL and libFFI installations on my system, but something is clearly still wrong.

I'm typing:

rvm reinstall 3.1.1 --with-openssl-dir=`brew --prefix openssl`

Still getting an error.

Specifically, I get:
openssl_missing.c:24:13: error: incomplete definition of type 'struct X509_crl_st'
*psig = crl->signature;
, and, later in the process, what appears to be a related error: ld: warning: ignoring file /usr/local/Cellar/libffi/3.4.4/lib/libffi.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

This is after I setup my .zshrc with the lines

export LDFLAGS="-L/usr/local/opt/libffi/lib"
export CPPFLAGS="-I/usr/local/opt/libffi/include"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

,as instructed by other searches here and elsewhere.

Does anyone have any idea what to do? I imagine that Ruby 3.1.1 has been compiled by others on MacOS. At least part of the reason I'm doing this at all is because I can't install the gem for Rails.

答案1

得分: 1

正如在评论中指出的,这个问题是因为我使用了来自x86_64机器的Time Machine备份导致的。这导致我使用了几个库的错误版本,可能还包括Homebrew本身的错误版本。我不得不卸载Ruby和Homebrew,然后重新安装它们。最终,这让我成功安装了rails,这是我期望的结果。@tadman 应该得到这个解决方案的荣誉,但我希望其他遇到这个问题的人也能看到这个问题的答案。

英文:

As noted in a comment, this problem occurred because I had used a Time Machine backup from an x86_64 machine. That led to me having the wrong version of several libraries, and possibly of Homebrew itself. I had to uninstall Ruby and Homebrew, then install them again. This eventually let me even install rails, which was my desired outcome. @tadman deserves the credit on this but I wanted others with this problem to see an Answer to this question.

huangapple
  • 本文由 发表于 2023年5月29日 06:58:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76353900.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定