jruby-lib build fails in windows #1698

Closed
walkeriniraq opened this Issue May 15, 2014 · 5 comments

Projects

None yet

3 participants

@walkeriniraq

Clean source and mvn build reports:

NotImplementedError: unlink unsupported or native support failed to load
            unlink at org/jruby/RubyFile.java:1112
       remove_file at C:/Users/nathan/code/jruby/lib/../lib/ruby/2.1/fileutils.rb:1464
  platform_support at C:/Users/nathan/code/jruby/lib/../lib/ruby/2.1/fileutils.rb:1469
       remove_file at C:/Users/nathan/code/jruby/lib/../lib/ruby/2.1/fileutils.rb:1463
       remove_file at C:/Users/nathan/code/jruby/lib/../lib/ruby/2.1/fileutils.rb:801
                rm at C:/Users/nathan/code/jruby/lib/../lib/ruby/2.1/fileutils.rb:578
              each at org/jruby/RubyArray.java:1549
                rm at C:/Users/nathan/code/jruby/lib/../lib/ruby/2.1/fileutils.rb:577
              rm_f at C:/Users/nathan/code/jruby/lib/../lib/ruby/2.1/fileutils.rb:600
          eval_pom at (eval):184
              call at org/jruby/RubyProc.java:276

Which is not surprising, as windows doesn't do unlink. Windows build was working before, but it looks like it was changed a month or two ago (most likely when @headius added unlink to jnr-posix, I'm guessing). I couldn't find anything that indicated that JRuby wasn't going to support windows build, but maybe I missed it.

I got the build working by replacing lib/pom.rb:183:

FileUtils.rm_f( File.join( ruby_dir, 'shared', 'jruby-openssl.rb' ) )

with a straight call to File#delete. This worked the first time, but subsequent runs required me to add an if exist? check before deleting the file, which is I guess what unlink was there to accomplish.

Is there a (good) way to patch this in jnr-posix? Making the underlying posix library compatible across the board sounds like a way to avoid the problem in the future.

@mkristian
Member

first I have to say that the build should work on windows as well even if it gets less attention.

the problem with the unlink sounds more a general problem for windows - the FileUtils.rm_f should work on windows as well.

not sure what to do with lib/pom.rb ! could work around it as you did with File.delete + File.exists? for the time until the FileUtils.rm_f is fixed ?

@walkeriniraq

Glad to hear it! JRuby is the only dynamic language that I know of that is:

  1. generally platform independent (including setup!)
  2. on parity with other implementations
    And I think that makes it very useful, especially for those of us tied to windows.

Once I got past that section, mvn -Pbootstrap failed, although I haven't had a chance to dig into it to figure out what the issue is. I'll have a look at it later.

FileUtils.rm_f just delegates to jnr-posix unlink method. I wasn't very clear about that in my late-night ramblings.

@mkristian
Member

fixed it with 396735b

what happens with mvn -Pbootstrap ? there are some comments about the bootstrap and windows in BUILDING.md !

could you please verify the new issue #1702 I added ?

@mkristian mkristian closed this May 16, 2014
@walkeriniraq

So - I figured out to use mvn -Pbootstrap-no-launcher

However, that didn't solve the problem. The call stack I get:

[INFO] --- gem-maven-plugin:1.0.0:initialize (default) @ jruby-tests ---
[INFO] installing gems for compile scope . . .
[WARNING] io/console not supported; tty will not be manipulated
[WARNING] ERROR:  Loading command: install (NameError)
[WARNING]       uninitialized constant Fiddle::Pointer
[WARNING] ERROR:  While executing gem ... (NoMethodError)
[WARNING]     undefined method `invoke_with_build_args' for nil:NilClass
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JRuby ............................................. SUCCESS [0.208s]
[INFO] JRuby Core ........................................ SUCCESS [16.777s]
[INFO] JRuby Lib Setup ................................... SUCCESS [2.542s]
[INFO] JRuby Integration Tests ........................... FAILURE [2.932s]
[INFO] ------------------------------------------------------------------------

Useful, isn't it?

It's a failed require (of course), and I managed to track down the chain, although I'm not sure what it means...
lib/ruby/2.1/dl/struct.rb:79
lib/ruby/2.1/dl/import.rb:3
lib/ruby/2.1/win32/importer.rb:2
lib/ruby/2.1/win32/resolv.rb:37 (must be some sort of autoload...?)
lib/ruby/2.1/resolv.rb:174
lib/ruby/shared/rubygems/remote_fetcher.rb:5
lib/ruby/shared/rubygems/spec_fetcher.rb:1
lib/ruby/shared/rubygems/dependency_installer.rb:5
lib/ruby/shared/rubygems/commands/install_command.rb:3
lib/ruby/shared/rubygems/command_manager.rb:203
<magic? Not sure>

It looks like there's no Fiddle::Pointer implementation for win32?

@walkeriniraq

Found this:
https://groups.google.com/forum/#!topic/jruby-developers/t9J50yDnkF8

I'm guessing that for builds that are working, another DL implementation is being injected into the environment before you get to fiddle.

In my environment, Fiddle triggers a load of DL, which defines fiddle?, which causes

class CStructEntity < (DL.fiddle? ? Fiddle::Pointer : CPtr)

in struct.rb to try and inherit from Fiddle::Pointer, which does not exist. (it isn't defined in Fiddle, and furthermore Fiddle isn't finished loading...?)

I can't get find any history for struct.rb - it appears to have sprung fully formed from the head of Zeus. I'm not sure why it was changed to be the way it is... Honestly, I'm having trouble coming up with a scenario where that code would work at all.

I replaced the ternary check with just CPtr, which gets me to:

uninitialized constant Win32::Registry::Error::Win32API

Le sigh. Something to figure out tomorrow. On the plus side, I feel that I am learning a lot about JRuby. :)

@enebo enebo added this to the JRuby 1.7.13 milestone Jun 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment