From 8f5c1e6a9b63b755b0d9098264cae64f99f825b6 Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Tue, 1 Sep 2026 07:57:14 -0700 Subject: [PATCH] Build Ruby without libgmp on macOS The macOS runners come with a Homebrew-provided `libgmp` installed in `/usr/local/opt/`. This library is required by the `ruby-build` Ruby that run Vanagon builds. However, this `libgmp` is specifically built for macOS 26.0. The Ruby build in `puppet-runtime` finds this library during `./configure` and the following warning message is generated: ld: warning: building for macOS-13.0, but linking with dylib '/usr/local/opt/gmp/lib/libgmp.10.dylib' which was built for newer version 26.0 Oddly, the presence of _something_ being printed to stderr causes `./configure` to alter its logic and the resulting Ruby builds fail. This commit adds `--without-gmp` to the configure args for macOS so that the Homebrew library is ignored. The resulting configuration still supports arbitrary-precision arithmatic as Ruby's `Bignum` uses an internal implementation instead of `libgmp`. Signed-off-by: Charlie Sharpsteen --- configs/components/ruby-3.2.rb | 3 +++ configs/components/ruby-4.0.rb | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/configs/components/ruby-3.2.rb b/configs/components/ruby-3.2.rb index 11603035..0cc6c674 100644 --- a/configs/components/ruby-3.2.rb +++ b/configs/components/ruby-3.2.rb @@ -120,6 +120,9 @@ end elsif platform.is_macos? special_flags += " --with-openssl-dir=#{settings[:prefix]} " + # configure will pick up libgmp from Homebrew, and the resulting compiler + # warnings cause mis-configuration. + special_flags += ' --without-gmp ' end without_dtrace = [ diff --git a/configs/components/ruby-4.0.rb b/configs/components/ruby-4.0.rb index e9412ff2..2a166f7b 100644 --- a/configs/components/ruby-4.0.rb +++ b/configs/components/ruby-4.0.rb @@ -76,7 +76,12 @@ # want to use/maintain pl-ruby if we don't have to. Instead set baseruby to # "no" which will force ruby to build and use miniruby. special_flags += ' --with-baseruby=no ' - special_flags += " --with-openssl-dir=#{settings[:prefix]} " if platform.is_macos? + if platform.is_macos? + special_flags += " --with-openssl-dir=#{settings[:prefix]} " + # configure will pick up libgmp from Homebrew, and the resulting compiler + # warnings result in mis-configuration. + special_flags += ' --without-gmp ' + end without_dtrace = [ 'macos-all-arm64',