Skip to content

Fix building gem with gcc 15.1.1#229

Closed
skipkayhil wants to merge 1 commit intotrilogy-libraries:mainfrom
skipkayhil:hm-fix-gcc-15
Closed

Fix building gem with gcc 15.1.1#229
skipkayhil wants to merge 1 commit intotrilogy-libraries:mainfrom
skipkayhil:hm-fix-gcc-15

Conversation

@skipkayhil
Copy link
Copy Markdown
Contributor

@skipkayhil skipkayhil commented May 15, 2025

Fixes #228

Installing trilogy 2.9.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/hartley/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/trilogy-2.9.0/ext/trilogy-ruby
/home/hartley/.local/share/mise/installs/ruby/3.4.3/bin/ruby extconf.rb
checking for CRYPTO_malloc() in -lcrypto... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Previously, trying to build Trilogy with gcc 15.1.1 would result in an error like above. Other gems with c extensions have encountered the same error with gcc 15.1.1, and their fix was to use append_cflags instead of modifying $CFLAGS. (RubyCrypto/ed25519#45, tonytonyjan/jaro_winkler#62)

Testing locally, bundle exec rake build && gem install pkg/*.gem fails with the above error before this patch but is able to install the gem after.

```
Installing trilogy 2.9.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/hartley/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/trilogy-2.9.0/ext/trilogy-ruby
/home/hartley/.local/share/mise/installs/ruby/3.4.3/bin/ruby extconf.rb
checking for CRYPTO_malloc() in -lcrypto... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.
```

Previously, trying to build Trilogy with gcc 15.1.1 would result in an
error like above. Other gems with c extensions have encountered the same
error with gcc 15.1.1, and their fix was to use `append_cflags` instead
of modifying `$CFLAGS`.

Testing locally, `bundle exec rake build && gem install pkg/*.gem` fails
with the above error before this patch but is able to install the gem
after.
@skipkayhil
Copy link
Copy Markdown
Contributor Author

Fixed by rebuilding my Ruby with ruby/ruby@2297afd

(I used MISE_RUBY_APPLY_PATCHES=https://github.com/ruby/ruby/commit/2297afda7ff3926c51fea700dfbf0f0eb4fea1e5.patch mise install ruby 3.4.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot compile native extension on Fedora 42 w/ GCC 15

1 participant