GCC 15 and Ruby Gems

Jeff BiglerJeff Bigler
2 min read

I recently had the joyful experience of discovering that I could not install a gem (in this case ruby-ll), which was installing fine on other systems and left me in a quandary.

Some research led me to the likely culprit. The recent update of my system to GCC 15, which changed the default C language standard from gnu17 to gnu23. I checked out the repo for git-ll and found this issue:

ruby-ll won’t compile with GCC 15 which recommended the following:

gem install ruby-ll -v 2.1.3  -- --with-cflags="-std=gnu17"

# Or add it to bundler config
bundle config build.ruby-ll --with-cflags="-std=gnu17"

While that worked on my old computer, my new system that I had just finished building would still fail installing the gem. It would complain that the <stdbool.h> header had not been loaded, as well as other incompatibilities. Much hair pulling ensued.

Two systems running:

  • Arch Linux

    • Ruby not installed through the package manager
  • mise-en-place tool version manager

    • Various versions of Ruby installed via mise

My old computer is using a version of Ruby that was compiled before GCC 15 was installed. However, my new system installed Ruby more recently and compiled it using GCC 15. Hence the errors when compiling the gem. The gem extension was using the headers from the Ruby compilation.

One of the changes from gnu 17 to 23 is that language keywords were introduced for bool values, so apparently Ruby did not need to use the <stdbool.h> file when being compiled.

The only way I was able to get everything working again was to recompile Ruby itself with the CFLAGS option.

export RUBY_CFLAGS=-march=native\ -std=gnu17

mise install ruby@3.3.8 --force

After that I was able to install the gems and continue on.

And now it is documented for posterity. Until I forget in 6 months and find this post.

1
Subscribe to my newsletter

Read articles from Jeff Bigler directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Jeff Bigler
Jeff Bigler