Subject:
Re: [ruby-ffi] 1.2.0.pre6 testing
From:
Jon
Date:
11/14/12 7:23 PM
To:
ruby-ffi@googlegroups.com

On Wed, 14 Nov 2012 20:07:22 -0500
Jon <jon.forums@gmail.com> wrote:

> > > > While I never install ffi this way, jruby+bundler on Win7 32bit with JRuby 
> > > > 1.7.0 ended up in Wile E. flames trying to build the C ext due to my 
> > > > scheming: 
> > > >
> > > > C:\Users\Jon\Downloads\temp\ffi-java>type Gemfile 
> > > > source :rubygems 
> > > > gem 'ffi', '1.2.0.pre6', :platforms => :jruby 
> > > >
> > > > C:\Users\Jon\Downloads\temp\ffi-java>bundle install 
> > > > Fetching gem metadata from http://rubygems.org/........... 
> > > > Fetching gem metadata from http://rubygems.org/.. 
> > > > Installing ffi (1.2.0.pre6) with native extensions 
> > > > Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native 
> > > > extension. 
> > > 
> > >  
> > > Hmm.  When installing on something that is not MRI, extconf.rb generates a 
> > > dummy Makefile.  I suspect on win32, the dummy Makefile isn't quite 
> > > correct.  Can you investigate this one a bit more (look right at the bottom 
> > > of ext/ext_c/extconf.rb)?  It could be something as simple as \r\n vs \n 
> > > line termination.
> > > 
> > > I can continue to publish the ffi-java gem, but, I want to get rid of it in 
> > > the long term.
> > 
> > Likely just need this tweak at extconf.rb:59
> > 
> > -  File.open("Makefile", "w") do |mf|
> > +  File.open("Makefile", "wb") do |mf|
> > 
> > I'll try it out a bit later.
> 
> While binary mode may turn out to be an issue, the bigger issue is the dummy Makefile. If a JRuby on Windows user doesn't have `make` on PATH...eeek.
> 
> Perhaps an alternative is to change from a extconf.rb to a Rakefile based extension:
> 
>   https://github.com/rubygems/rubygems/blob/master/lib/rubygems/installer.rb#L667-680
>   https://github.com/rubygems/rubygems/blob/master/lib/rubygems/ext/rake_builder.rb#L22-36
> 
> I don't build native gems this way, but it looks like we could use the Rakefile to wrap 
> 
>   https://github.com/rubygems/rubygems/blob/master/lib/rubygems/ext/ext_conf_builder.rb#L12-21
> 
> since both `build` class methods take the same args, and both return a `results` Array.
> 
> A bit more complicated, but is there any scenario (regardless of platform) where a successful FFI gem install truly requires a JRuby user to have build tools on PATH?

Oh hell, scratch that...doing too many things at once.

I'm not seeing how the Rakefile can call `Gem::Ext::ExtConfBuilder.build` with the same args as sent to the original `Gem::Ext::RakeBuilder.build`.