rubymacoscompiler-errorsopensslrvm

Error installing Ruby with rvm: "__rvm_make -j8"


I was trying to install latest stable Ruby versions (3.1.x, 3.2.x) using rvm. However, the rvm install command of any of those versions fails when compiling Ruby. For instance, when trying to run

rvm install 3.1.4

I get the following output:

Searching for binary rubies, this might take some time.
No binary rubies available for: osx/13.5/arm64/ruby-3.1.4.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Updating certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem'
Requirements installation successful.
Installing Ruby from source to: /Users/davidlj95/.rvm/rubies/ruby-3.1.4, this may take a while depending on your cpu(s)...
ruby-3.1.4 - #downloading ruby-3.1.4, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 19.9M  100 19.9M    0     0  12.8M      0  0:00:01  0:00:01 --:--:-- 12.8M
No checksum for downloaded archive, recording checksum in user configuration.
/Users/davidlj95/.rvm/tmp/rvm_src_74481
ruby-3.1.4 - #extracting ruby-3.1.4 to /Users/davidlj95/.rvm/src/ruby-3.1.4 - please wait
ruby-3.1.4 - #configuring - please wait
ruby-3.1.4 - #post-configuration - please wait
ruby-3.1.4 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/davidlj95/.rvm/log/1692282742_ruby-3.1.4/make.log

There has been an error while running make. Halting the installation.

Looked for errors in the file with less -p error /Users/davidlj95/.rvm/log/1692282742_ruby-3.1.4/make.log.

Seems the last error appearing before failing is related to OpenSSL:

ossl_ts.c:829:5: error: incomplete definition of type 'struct TS_verify_ctx'
    TS_VERIFY_CTX_set_certs(ctx, x509inter);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ...
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
+__rvm_make:0> return 2
1 warning and 1 error generated.

I am using an M1 / ARM chipset MacBook Pro. With macOS Ventura 13.5.

I've tried:


Solution

  • As the Ruby build guide suggests, export the configuration arguments environment variable for the pre-compilation step indicating where libraries installed by Homebrew are installed. You can do so by running:

    export CONFIGURE_ARGS=""
    for ext in openssl readline libyaml zlib; do 
      CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-$ext-dir=$(brew --prefix $ext)" 
    done
    

    Then, run the rvm install command. Compilation succeeded and that Ruby version was installed. Worked for several Ruby versions.