Knowing you're in the middle of readying 1.5.0, I'm want to see whether this is 
a real RubyGems issue or something else.

I use an operating_system.rb and a custom devkit.rb to enhance how "gem install 
my_native_gem" and "ruby -r devkit extconf.rb" behaves when building for 
Windows using RubyInstaller. As of ruby-core trunk@30653 the 
operating_system.rb functionality appears to have stopped working. Things stil 
work on "ruby 1.9.2p160 (2011-01-16 revision 30579) [i386-mingw32]"

I suspect this isn't a RubyGems issue, but an expected ruby-core trunk 
stabilization issue.  Is the following "failure" (operating_system.rb's 
pre_install hook not working so build tools not put on PATH) expected at this 
point in the RubyGems refactoring?


=== FAILING CASE ===

# file: C:\ruby19trunk\lib\ruby\1.9.1\rubygems\defaults\operating_system.rb
#
# :DK-BEG: override 'gem install' to enable RubyInstaller DevKit usage
Gem.pre_install do |gem_installer|
  unless gem_installer.spec.extensions.empty?
    unless ENV['PATH'].include?('C:\\DevKit\\mingw\\bin') then
      Gem.ui.say 'Temporarily enhancing PATH to include DevKit...' if 
Gem.configuration.verbose
      ENV['PATH'] = 'C:\\DevKit\\bin;C:\\DevKit\\mingw\\bin;' + ENV['PATH']
    end
    ENV['RI_DEVKIT'] = 'C:\\DevKit'
    ENV['CC'] = 'gcc'
    ENV['CPP'] = 'cpp'
    ENV['CXX'] = 'g++'
  end
end
# :DK-END:


C:\Users\Jon\Documents>gem install rdiscount
Building native extensions.  This could take a while...
ERROR:  Error installing rdiscount:
        ERROR: Failed to build gem native extension.

C:/ruby19trunk/bin/ruby.exe extconf.rb
checking for random()... C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': 
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:460:in `try_link0'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:475:in `try_link'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:618:in `try_func'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:893:in `block in have_func'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:789:in `block in 
checking_for'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in 
postpone'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:788:in `checking_for'
        from C:/ruby19trunk/lib/ruby/1.9.1/mkmf.rb:892:in `have_func'
        from extconf.rb:5:in `<main>'


Gem files will remain installed in 
C:/ruby19trunk/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8 for inspection.
Results logged to 
C:/ruby19trunk/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8/ext/gem_make.out



=== WORKING CASE ===

While I'm tracking down other rdiscount 1.6.8 functionality issues, with the 
following devkit.rb library I can manually get this build to work:

# file: C:\ruby19trunk\lib\ruby\site_ruby\devkit.rb
#
# enable RubyInstaller DevKit usage as a vendorable helper library
unless ENV['PATH'].include?('C:\\DevKit\\mingw\\bin') then
  puts 'Temporarily enhancing PATH to include DevKit...'
  ENV['PATH'] = 'C:\\DevKit\\bin;C:\\DevKit\\mingw\\bin;' + ENV['PATH']
end
ENV['RI_DEVKIT'] = 'C:\\DevKit'
ENV['CC'] = 'gcc'
ENV['CPP'] = 'cpp'
ENV['CXX'] = 'g++'

C:\ruby192\lib\ruby\gems\1.9.1\gems\rdiscount-1.6.8\ext>ruby -r devkit 
extconf.rb
checking for random()... no
checking for srandom()... no
checking for rand()... yes
checking for srand()... yes
creating Makefile

C:\ruby192\lib\ruby\gems\1.9.1\gems\rdiscount-1.6.8\ext>\DevKit\devkitvars.bat
Adding the DevKit to PATH...

C:\ruby192\lib\ruby\gems\1.9.1\gems\rdiscount-1.6.8\ext>make && make install
...SNIP BUNCH-O-WARNINGS...
linking shared-object rdiscount.so
/usr/bin/install -c -m 0755 rdiscount.so 
C:/ruby19trunk/lib/ruby/site_ruby/1.9.1/i386-msvcrt
installing default rdiscount libraries


Jon

---
blog: http://jonforums.github.com/
twitter: @jonforums
_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
Rubygems-developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to