Thrift
  1. Thrift
  2. THRIFT-979

ruby bindings used to work on jruby

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.5
    • Fix Version/s: 0.6
    • Component/s: Ruby - Library
    • Labels:
      None

      Description

      The current ruby bindings do not work on JRuby do to the use of mkmf in the build. It used to be that on jruby, the build would just skip over the extconf.rb step and only install the pure ruby code. (See the current version up on <http://github.com/fauna/thrift>.

      I've been fighting with rubygems to figure out why I can't make this work like I was able to with 0.2. Unfortunately, I'm at my limit, so here's just the bug. Help appreciated.

      1. THRIFT-979.patch
        0.3 kB
        Jeff Hodges
      2. THRIFT-979-2.patch
        0.4 kB
        Jeff Hodges
      3. THRIFT-979-3.patch
        0.6 kB
        Jeff Hodges
      4. THRIFT-979-4.patch
        0.6 kB
        Jeff Hodges

        Activity

        Hide
        Bryan Duxbury added a comment -

        Awesome, that version worked. I just committed this. Thanks for your persistence and responsiveness.

        Show
        Bryan Duxbury added a comment - Awesome, that version worked. I just committed this. Thanks for your persistence and responsiveness.
        Hide
        Jeff Hodges added a comment -

        Swear to god, I'm not a total idiot.

        Show
        Jeff Hodges added a comment - Swear to god, I'm not a total idiot.
        Hide
        Bryan Duxbury added a comment -

        Hm:

        [bryanduxbury rb]$pwd
        /Users/bryanduxbury/projects/thrift/thrift-trunk/lib/rb
        [bryanduxbury rb]$ruby -v
        ruby 1.8.6 (2010-01-11 patchlevel 388) [i686-darwin10.4.0]
        [bryanduxbury rb]$ruby ext/extconf.rb
        ext/extconf.rb:20: uninitialized constant RUBY_ENGINE (NameError)

        Show
        Bryan Duxbury added a comment - Hm: [bryanduxbury rb] $pwd /Users/bryanduxbury/projects/thrift/thrift-trunk/lib/rb [bryanduxbury rb] $ruby -v ruby 1.8.6 (2010-01-11 patchlevel 388) [i686-darwin10.4.0] [bryanduxbury rb] $ruby ext/extconf.rb ext/extconf.rb:20: uninitialized constant RUBY_ENGINE (NameError)
        Hide
        Jeff Hodges added a comment -

        Diffing against trunk. Yeesh.

        Show
        Jeff Hodges added a comment - Diffing against trunk. Yeesh.
        Hide
        Bryan Duxbury added a comment -

        This patch doesn't apply for me against the current Thrift trunk. It looks like a diff on a previous diff.

        Show
        Bryan Duxbury added a comment - This patch doesn't apply for me against the current Thrift trunk. It looks like a diff on a previous diff.
        Hide
        Kevin Clark added a comment -

        +1

        Show
        Kevin Clark added a comment - +1
        Hide
        Jeff Hodges added a comment -

        Corrected patch for jruby support.

        Show
        Jeff Hodges added a comment - Corrected patch for jruby support.
        Hide
        Jeff Hodges added a comment -

        Er, wrong diff. One moment.

        Show
        Jeff Hodges added a comment - Er, wrong diff. One moment.
        Hide
        Jeff Hodges added a comment -

        This patch implements the "okay, fine, we'll make a Makefile even though we don't need it" fix to the extconf.rb call for JRuby. Fixes this ticket.

        Show
        Jeff Hodges added a comment - This patch implements the "okay, fine, we'll make a Makefile even though we don't need it" fix to the extconf.rb call for JRuby. Fixes this ticket.
        Hide
        Chris Kite added a comment -

        I am able to reproduce this issue with JRuby 1.5.3 and Thrift 0.5.0.

        However, if I first build against MRI 1.9.2 to generate a Makefile and then comment out extconf.rb, the JRuby gem builds and installs correctly.

        Show
        Chris Kite added a comment - I am able to reproduce this issue with JRuby 1.5.3 and Thrift 0.5.0. However, if I first build against MRI 1.9.2 to generate a Makefile and then comment out extconf.rb, the JRuby gem builds and installs correctly.
        Hide
        Kevin Clark added a comment -

        Ahh, that'd make sense. Could you try having the JRuby guard output a Makefile with stubbed out targets? Might be enough to fake it out.

        Soon as I have it reproing at home, I'll do the same.

        Show
        Kevin Clark added a comment - Ahh, that'd make sense. Could you try having the JRuby guard output a Makefile with stubbed out targets? Might be enough to fake it out. Soon as I have it reproing at home, I'll do the same.
        Hide
        Jeff Hodges added a comment -

        With debug, it seems that rubygems is expecting a makefile to be made but is not seeing it. Perhaps, this only worked in the 0.2 branch because an old makefile was still being packaged up?

        Building native extensions.  This could take a while...
        Exception `Gem::InstallError' at /Users/jhodges/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/ext/builder.rb:16 - Makefile not found:
        
        /Users/jhodges/.rvm/rubies/jruby-1.5.3/bin/jruby extconf.rb
        
        Exception `Gem::Installer::ExtensionBuildError' at /Users/jhodges/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/installer.rb:482 - ERROR: Failed to build gem native extension.
        
        /Users/jhodges/.rvm/rubies/jruby-1.5.3/bin/jruby extconf.rb
        
        
        Gem files will remain installed in /Users/jhodges/.rvm/gems/jruby-1.5.3/gems/thrift-0.5.1 for inspection.
        Results logged to /Users/jhodges/.rvm/gems/jruby-1.5.3/gems/thrift-0.5.1/ext/gem_make.out
        
        ERROR:  Error installing pkg/thrift-0.5.1.gem:
        	ERROR: Failed to build gem native extension.
        
        /Users/jhodges/.rvm/rubies/jruby-1.5.3/bin/jruby extconf.rb
        
        
        Gem files will remain installed in /Users/jhodges/.rvm/gems/jruby-1.5.3/gems/thrift-0.5.1 for inspection.
        Results logged to /Users/jhodges/.rvm/gems/jruby-1.5.3/gems/thrift-0.5.1/ext/gem_make.out
        Exception `Gem::SystemExitException' at /Users/jhodges/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:171 - Exiting RubyGems with exit_code 1
        
        Show
        Jeff Hodges added a comment - With debug, it seems that rubygems is expecting a makefile to be made but is not seeing it. Perhaps, this only worked in the 0.2 branch because an old makefile was still being packaged up? Building native extensions. This could take a while ... Exception `Gem::InstallError' at /Users/jhodges/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/ext/builder.rb:16 - Makefile not found: /Users/jhodges/.rvm/rubies/jruby-1.5.3/bin/jruby extconf.rb Exception `Gem::Installer::ExtensionBuildError' at /Users/jhodges/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/installer.rb:482 - ERROR: Failed to build gem native extension. /Users/jhodges/.rvm/rubies/jruby-1.5.3/bin/jruby extconf.rb Gem files will remain installed in /Users/jhodges/.rvm/gems/jruby-1.5.3/gems/thrift-0.5.1 for inspection. Results logged to /Users/jhodges/.rvm/gems/jruby-1.5.3/gems/thrift-0.5.1/ext/gem_make.out ERROR: Error installing pkg/thrift-0.5.1.gem: ERROR: Failed to build gem native extension. /Users/jhodges/.rvm/rubies/jruby-1.5.3/bin/jruby extconf.rb Gem files will remain installed in /Users/jhodges/.rvm/gems/jruby-1.5.3/gems/thrift-0.5.1 for inspection. Results logged to /Users/jhodges/.rvm/gems/jruby-1.5.3/gems/thrift-0.5.1/ext/gem_make.out Exception `Gem::SystemExitException' at /Users/jhodges/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:171 - Exiting RubyGems with exit_code 1
        Hide
        Kevin Clark added a comment -

        Just an update - I've got dependency issues on the machine I was using for dev. Will try to resolve.

        Show
        Kevin Clark added a comment - Just an update - I've got dependency issues on the machine I was using for dev. Will try to resolve.
        Hide
        Kevin Clark added a comment -

        I'll take a look when I get home and have a unix machine in front of me. Let me know if you manage to track it down in the meantime.

        Any idea what's failing? The automake stuff or the gem stuff?

        Show
        Kevin Clark added a comment - I'll take a look when I get home and have a unix machine in front of me. Let me know if you manage to track it down in the meantime. Any idea what's failing? The automake stuff or the gem stuff?
        Hide
        Jeff Hodges added a comment - - edited

        That was the deal I was trying. No clue why it doesn't seem to work.

        This is what extconf.rb looks like locally:

        unless RUBY_ENGINE =~ /jruby/
          require 'mkmf'
        
          $CFLAGS = "-g -O2 -Wall -Werror"
        
          have_func("strlcpy", "string.h")
        
          create_makefile 'thrift_native'
        end
        

        Output I get from that is the usual "Failed to build gem native extension". This reproducible on your end?

        Show
        Jeff Hodges added a comment - - edited That was the deal I was trying. No clue why it doesn't seem to work. This is what extconf.rb looks like locally: unless RUBY_ENGINE =~ /jruby/ require 'mkmf' $CFLAGS = "-g -O2 -Wall -Werror" have_func( "strlcpy" , "string.h" ) create_makefile 'thrift_native' end Output I get from that is the usual "Failed to build gem native extension". This reproducible on your end?
        Hide
        Kevin Clark added a comment -

        Does the right thing happen (no Makefile generation, no compilation) if you wrap the extconf.rb in an `if RUBY_ENGINE != jruby`? (I'm not sure if that's the right RUBY_ENGINE value - you should double check).

        Show
        Kevin Clark added a comment - Does the right thing happen (no Makefile generation, no compilation) if you wrap the extconf.rb in an `if RUBY_ENGINE != jruby`? (I'm not sure if that's the right RUBY_ENGINE value - you should double check).

          People

          • Assignee:
            Jeff Hodges
            Reporter:
            Jeff Hodges
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development