Skip to content

gnu99 check in extconf seems to prevent Makefile generation on JRuby, MacOS 15 #2433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
headius opened this issue Apr 25, 2025 · 2 comments

Comments

@headius
Copy link

headius commented Apr 25, 2025

A check for the flag -std=gnu99 appears to fail and prevent generating the Makefile on JRuby. Other gems with "plain" C libraries seem to install correctly on this system (JRuby, Java 21, MacOS 15):

$ bundle exec rake compile
Source locally installed gems is ignoring #<Bundler::StubSpecification name=resolv version=0.6.0 platform=ruby> because it is missing extensions
🚨🚨🚨🚨 Skipping RubyMemcheck: #<LoadError: no such file to load -- ruby_memcheck> 🚨🚨🚨🚨
mkdir -p tmp/java/rbs_extension/3.4.2
cd tmp/java/rbs_extension/3.4.2
/Users/headius/work/jruby/bin/jruby -I. ../../../../ext/rbs_extension/extconf.rb
checking for whether -std=gnu99 is accepted as CFLAGS... *** ../../../../ext/rbs_extension/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.

I have not investigated this yet myself.

Note that in order to bundle, some gems need to be masked out as described in #2432.

@headius
Copy link
Author

headius commented Apr 25, 2025

Removing the gnu99 flag allows the Makefile to be generated, but there seems to still be a dependency on ruby.h which is not shipped with JRuby:

diff --git a/ext/rbs_extension/extconf.rb b/ext/rbs_extension/extconf.rb
index 9ea9b000..fe533791 100644
--- a/ext/rbs_extension/extconf.rb
+++ b/ext/rbs_extension/extconf.rb
@@ -11,5 +11,5 @@ root_dir = File.expand_path('../../../', __FILE__)
 $srcs = Dir.glob("#{root_dir}/src/**/*.c") +
         Dir.glob("#{root_dir}/ext/rbs_extension/*.c")
 
-append_cflags ['-std=gnu99']
+#append_cflags ['-std=gnu99']
 create_makefile 'rbs_extension'
$ bundle exec rake compile       
Source locally installed gems is ignoring #<Bundler::StubSpecification name=resolv version=0.6.0 platform=ruby> because it is missing extensions
🚨🚨🚨🚨 Skipping RubyMemcheck: #<LoadError: no such file to load -- ruby_memcheck> 🚨🚨🚨🚨
cd tmp/java/rbs_extension/3.4.2
/Users/headius/work/jruby/bin/jruby -I. ../../../../ext/rbs_extension/extconf.rb
Source locally installed gems is ignoring #<Bundler::StubSpecification name=resolv version=0.6.0 platform=ruby> because it is missing extensions
creating Makefile
cd -
⚠️⚠️⚠️ ext/rbs_extension/lexer.c is older than ext/rbs_extension/lexer.re. You may need to run `rake lexer` ⚠️⚠️⚠️
Compiling a native C extension on JRuby. This is discouraged and a
Java extension should be preferred.
cd tmp/java/rbs_extension/3.4.2
/usr/bin/make
make: *** No rule to make target `/Users/headius/work/jruby/lib/ruby/include/ruby/ruby.h', needed by `constants.o'.  Stop.
rake aborted!
Command failed with status (2): [/usr/bin/make]

@headius
Copy link
Author

headius commented Apr 25, 2025

Ok, looks like there's still quite a few dependencies on the CRuby C API, so perhaps this is premature...

@headius headius mentioned this issue Apr 25, 2025
7 tasks
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

No branches or pull requests

1 participant