0

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.

tadman
  • 208,517
  • 23
  • 234
  • 262
  • 3
    Did you roll over your machine from x86_64 hardware? If so you may want to clear out your Homebrew install entirely to get rid of any lingering libraries compiled for the wrong architecture. As always, be sure to back-up before doing anything major like this. – tadman May 29 '23 at 02:45
  • 1
    Yes, I had migrated things over from an x86_64 machine. After many uninstall and reinstalls, I did get ruby installed and rails added. Thanks for your help @tadman! – karmic_mishap May 30 '23 at 16:13

1 Answers1

1

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.