Error installing ruby 3.1.0 with ruby-build on Arch Linux / Manjaro

Error installing ruby 3.1.0 with ruby-build on Arch Linux / Manjaro

I'm trying to install Ruby 3.1.0 on my machine, but it fails with:

BUILD FAILED (ManjaroLinux 25.0.2 on x86_64 using ruby-build 20250529.1)

It works with version 3.2.0 and up.

I can't figure what is missing wrong from the error log. Here is the full log file: https://gist.github.com/paulodiovani/4fa20fe5237d725365881d04c5fcdc2b

Error lines in the log:

./include/ruby/internal/stdbool.h:43:23: error: ‘_Bool’ cannot be defined via ‘typedef’
   43 | typedef unsigned char _Bool;
      |                       ^~~~~
./include/ruby/internal/stdbool.h:43:23: note: ‘_Bool’ is a keyword with ‘-std=c99’ onwards
./include/ruby/internal/stdbool.h:43:1: warning: useless type name in empty declaration
   43 | typedef unsigned char _Bool;
      | ^~~~~~~
In file included from ./include/ruby/backward/2/bool.h:22,
                 from ./include/ruby/defines.h:74,
                 from ./include/ruby/ruby.h:25,
                 from internal.h:28,
                 from compar.c:13:

last line:

external command failed with status 2

What I've tried so far, without success.

  1. Use openssl 1.1

    RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/lib/openssl-1.1 asdf install ruby 3.1.0

  2. Install ruby-erb package

Answer

After some digging, I figured that I needed gcc6.

There is a line at the docs on https://github.com/rbenv/ruby-build/wiki#arch-linux, but not much information on how to use it:

If needed, install gcc6 from the AUR.

Here is how to do it:

  1. Install gcc6 from AUR (note: takes a long time to compile)

  2. Install with:

RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/lib/openssl-1.1 --with-gcc=gcc-6" asdf install ruby 3.1.0

Enjoyed this question?

Check out more content on our blog or follow us on social media.

Browse more questions