rbs icon indicating copy to clipboard operation
rbs copied to clipboard

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

Open headius opened this issue 7 months ago • 2 comments

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 avatar Apr 25 '25 14:04 headius

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 avatar Apr 25 '25 14:04 headius

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

headius avatar Apr 25 '25 14:04 headius