Skip to content

Build Ruby without libgmp on macOS - #253

Merged
Sharpie merged 1 commit into
OpenVoxProject:mainfrom
Sharpie:macos-intel-fix
Sep 1, 2026
Merged

Build Ruby without libgmp on macOS#253
Sharpie merged 1 commit into
OpenVoxProject:mainfrom
Sharpie:macos-intel-fix

Conversation

@Sharpie

@Sharpie Sharpie commented Sep 1, 2026

Copy link
Copy Markdown
Member

Short description

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.

Checklist

I have:

@Sharpie Sharpie added the bug Something isn't working label Sep 1, 2026
@bastelfreak

Copy link
Copy Markdown
Contributor

Has the internal implementation and known issues? Is it worth building our own libgmp for 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 <charlie@overlookinfratech.com>
@Sharpie

Sharpie commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

I believe the internal implementation is less performant, but otherwise correct. The rv project also uses without-gmp when building their portable rubies:

https://github.com/spinel-coop/rv-ruby/blob/20260723/Abstract/rv-ruby.rb#L111

@Sharpie
Sharpie enabled auto-merge September 1, 2026 18:17
@Sharpie
Sharpie merged commit e970dc6 into OpenVoxProject:main Sep 1, 2026
39 checks passed
@Sharpie
Sharpie deleted the macos-intel-fix branch September 1, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants