Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError: symlink unsupported or native support failed to load #3905

Closed
tobymurray-nanometrics opened this issue May 19, 2016 · 20 comments · Fixed by #3926
Closed

Comments

@tobymurray-nanometrics
Copy link

tobymurray-nanometrics commented May 19, 2016

I created an issue here (sorry for the duplication, not sure where it should go). Trying to figure out a workaround, it seems as though it works in the 1.7 branch of JRuby, as well as 9.0.5.0, so perhaps a regression?

Environment

Windows 10
JRuby 9.1.1.0 and 9.1.0.0

Expected Behavior

λ gem install warbler -v 2.0.1
Successfully installed warbler-2.0.1
1 gem installed

Actual Behavior

λ gem install warbler -v 2.0.1
NotImplementedError: symlink unsupported or native support failed to load; see http://wiki.jruby.org/Native-Libraries

                  symlink at org/jruby/RubyFile.java:1035
  block in extract_tar_gz at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package.rb:386
                     each at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package/tar_reader.rb:65
  block in extract_tar_gz at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package.rb:363
     block in open_tar_gz at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package.rb:457
                     wrap at org/jruby/ext/zlib/RubyGzipFile.java:94
              open_tar_gz at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package.rb:454
           extract_tar_gz at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package.rb:362
   block in extract_files at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package.rb:343
                     each at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package/tar_reader.rb:65
   block in extract_files at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package.rb:340
                     open at org/jruby/RubyIO.java:1131
                     open at org/jruby/RubyKernel.java:305
             with_read_io at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package/file_source.rb:30
            extract_files at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/package.rb:337
            extract_files at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/installer.rb:766
                  install at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/installer.rb:296
                  install at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/resolver/specification.rb:97
         block in install at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/request_set.rb:166
                     each at org/jruby/RubyArray.java:1593
                  install at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/request_set.rb:156
              install_gem at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:205
    block in install_gems at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:255
                     each at org/jruby/RubyArray.java:1593
             install_gems at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:251
                  execute at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:158
   invoke_with_build_args at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/command.rb:310
             process_args at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/command_manager.rb:169
                      run at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/command_manager.rb:139
                      run at C:/tools/jruby/9.1.1.0/lib/ruby/stdlib/rubygems/gem_runner.rb:55
                    <top> at C:/tools/jruby/9.1.1.0/bin/jgem:21
                     load at org/jruby/RubyKernel.java:962
                    <top> at C:/tools/jruby/9.1.1.0/bin/gem:4

1.7.25

λ jruby --version
jruby 1.7.25 (1.9.3p551) 2016-04-13 867cb81 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_92-b14 +jit [Windows 10-amd64]

λ gem install warbler -v 2.0.0
Fetching: warbler-2.0.0.gem (100%)
Successfully installed warbler-2.0.0
1 gem installed

λ gem install warbler -v 2.0.1
Successfully installed warbler-2.0.1
1 gem installed

9.0.5.0

λ jruby --version
jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [Windows 10-amd64]

λ gem install warbler -v 2.0.0
Fetching: jruby-jars-9.1.1.0.gem (100%)
Successfully installed jruby-jars-9.1.1.0
WARNING: SSLSocket#session= is not supported
Fetching: jruby-rack-1.1.20.gem (100%)
Successfully installed jruby-rack-1.1.20
Fetching: rubyzip-1.2.0.gem (100%)
Successfully installed rubyzip-1.2.0
Fetching: warbler-2.0.0.gem (100%)
Successfully installed warbler-2.0.0
4 gems installed

λ gem install warbler -v 2.0.1
Fetching: warbler-2.0.1.gem (100%)
Successfully installed warbler-2.0.1
1 gem installed

Fails in both 9.1.1.0 and 9.1.0.0 with the same stack trace

@vais
Copy link

vais commented May 20, 2016

The same exact problem happened to me today as well (Windows Server 2008 R2, SP 1), so you're not alone.

C:\Users\Administrator\Desktop\app>jruby -v
jruby 9.1.1.0 (2.3.0) 2016-05-19 fe84e89 Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [mswin32-x86_64]

@headius
Copy link
Member

headius commented May 20, 2016

This is definitely a regression. Looks like something got missed on Windows :-(

@vais
Copy link

vais commented May 21, 2016

@headius thanks for looking into this issue. Is there an ETA for 9.1.2.0 yet? (Not being able to install warbler is a bit of a show-stopper in my personal exploration of JRuby ecosystem 😉 )

@lucassch
Copy link

Hi!

Having the same problem on Windows 10:

jruby -S gem install warbler
Successfully installed rubyzip-1.2.0
Successfully installed jruby-rack-1.1.20
Successfully installed jruby-jars-9.1.1.0
NotImplementedError: symlink unsupported or native support failed to load; see http://wiki.jruby.org/Native-Libraries

 jruby --version
jruby 9.1.0.0 (2.3.0) 2016-05-02 a633c63 Java HotSpot(TM) Client VM 25.60-b23 on 1.8.0_60-b27 +jit [mswin32-x86]

 java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

@enebo
Copy link
Member

enebo commented May 24, 2016

@vais @lucassch @tobymurray-nanometrics It is our hope to get out a 9.1.2.0 this week with so far this and one other windows-related issue.

@djberg96
Copy link
Contributor

FWIW the win32-file gem has had an implementation of File.symlink and File.symlink? for quite some time. So, after seeing the same failure initially as the OP, I did this:

gem install win32-file
$env:RUBYOPT="-rwin32-file" # powershell
gem install warbler

Then I hit this oddity:

PS C:\Users\Daniel> gem install warbler -v 2.0.1
Successfully installed rubyzip-1.2.0
Fetching: rake-11.1.2.gem (100%)
Successfully installed rake-11.1.2
Successfully installed jruby-rack-1.1.20
Successfully installed jruby-jars-9.1.1.0
ERROR:  Error installing warbler:
    warbler requires rake (>= 10.1.0)

@headius
Copy link
Member

headius commented May 25, 2016

@djberg96 Already on top of it! I've created #3926 that incorporates just what we need from symlink, but I may have gotten something wrong. Can you have a look at that PR?

@djberg96
Copy link
Contributor

As mentioned on the other thread, you'll need to run with administrator rights to create symlinks with Windows 7 and 8. Also, drop the quotes around the RUBYOPT setting if you're using a cmd shell.

Still working on the Rakefile thing.

@headius
Copy link
Member

headius commented May 25, 2016

@djberg96 On my Windows system, I was able to eventually install warbler after running from an Administrator console:

C:\Users\headius                    
λ gem install warbler               
Successfully installed warbler-2.0.1
1 gem installed                     

Are you sure you're on latest JRuby plus win32-file stuff? There were some activation problems in 9.1.0.0, I believe.

Patch is looking ok to me at this point but would like to get confirmation from @djberg96 that it's working for him too.

@djberg96
Copy link
Contributor

@headius Oh, great! Since I seem to regularly hose up my JRuby env one way or another, I will take your word for it that it works. Perhaps @tobymurray-nanometrics, @vais or @lucassch can confirm?

@tobymurray-nanometrics
Copy link
Author

@djberg96 What did you need a confirmation on specifically?

Running JRuby 9.1.1.0 as administrator in Windows 10 command prompt (and cmder) I see identical behavior to running as not-administrator:

image

Would you like me to try something else?

@djberg96
Copy link
Contributor

@tobymurray-nanometrics Please try installing the win32-file gem first, then set RUBYOPT=-rwin32-file, then try again.

@tobymurray-nanometrics
Copy link
Author

It looks like I ran into the same oddity as you, @djberg96. Trying this both as admin and as not-admin, I get the same result:

jruby 9.1.1.0 (2.3.0) 2016-05-19 fe84e89 Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [mswin32-x86_64]

C:\Users\TobyMurray
λ gem install win32-file
Successfully installed win32-file-0.8.0
1 gem installed

C:\Users\TobyMurray
λ echo %RUBYOPT%
-rwin32-file

C:\Users\TobyMurray
λ gem install warbler -v 2.0.1           
Successfully installed rubyzip-1.2.0     
Successfully installed rake-11.1.2       
Successfully installed jruby-rack-1.1.20 
Successfully installed jruby-jars-9.1.1.0
ERROR:  Error installing warbler:        
        warbler requires rake (>= 10.1.0)
...

@djberg96
Copy link
Contributor

djberg96 commented May 25, 2016

@tobymurray-nanometrics well, crap, I'm not sure what's happening yet. I'll have to wait until tonight to look at this closer.

BTW, I did try unpacking the gem locally, and modifying the gemspec to just remove the rake dependency, but then got a similar error for jruby-jars.

EDIT: It looks like win32-file breaks gem list somehow, and so it can't find the dependencies. The dangers of redefining core methods...

headius added a commit that referenced this issue May 25, 2016
@headius
Copy link
Member

headius commented May 26, 2016

The patch I came up with based on win32-file seems to work well with proper administrative privileges, so I went ahead and merged it to 9.1.2.0 and master. We'd really appreciate if someone can verify things are working with the patch on either branch, but especially 9.1.2.0 since we want to release tomorrow (Thursday).

@tortuetorche
Copy link

tortuetorche commented May 26, 2016

Hi @headius,

With jruby-complete-9.1.3.0-SNAPSHOT.jar (2016-05-26T04:39:17.000Z) from http://ci.jruby.org/snapshots/master/jruby-complete-9.1.3.0-SNAPSHOT.jar

I got this error:

NameError: uninitialized constant JRuby::Windows::File::Constants::FFI
       const_missing at org/jruby/RubyModule.java:3309
  <module:Constants> at uri:classloader:/jruby/kernel/file.rb:10
       <module:File> at uri:classloader:/jruby/kernel/file.rb:8
    <module:Windows> at uri:classloader:/jruby/kernel/file.rb:7
      <module:JRuby> at uri:classloader:/jruby/kernel/file.rb:6
               <top> at uri:classloader:/jruby/kernel/file.rb:5
                load at org/jruby/RubyKernel.java:962
               <top> at file:/C:/app/my_cool_app/vendor/jruby-complete.jar!/jruby/kernel.rb:1

Maybe it's a module/namespace issue: ::FFI::Platform::ADDRESS_SIZE instead of FFI::Platform::ADDRESS_SIZE? in https://github.com/headius/jruby/blob/3d1ada0df8c9d4d22f65211e644849fac96c157a/core/src/main/ruby/jruby/kernel/file.rb#L10

And with jruby-complete-9.1.2.0-SNAPSHOT.jar (2016-05-25T04:38:59.000Z).
I still have this error:

NotImplementedError: waitpid unsupported or native support failed to load; see http://wiki.jruby.org/Native-Libraries

Cheers,
Tortue Torche

@tobymurray-nanometrics
Copy link
Author

This worked for me as administrator. Am I understanding correctly that JRuby has to be executed as admin so it can handle symlinks?

Admin

C:\Users\TobyMurray
λ jruby --version
jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [mswin32-x86_64]

C:\Users\TobyMurray
λ gem install warbler -v 2.0.1
Fetching: rubyzip-1.2.0.gem (100%)
Successfully installed rubyzip-1.2.0
Fetching: jruby-rack-1.1.20.gem (100%)
Successfully installed jruby-rack-1.1.20
Fetching: jruby-jars-9.1.2.0.gem (100%)
Successfully installed jruby-jars-9.1.2.0
Fetching: warbler-2.0.1.gem (100%)
Successfully installed warbler-2.0.1
4 gems installed

Not Admin

C:\Users\TobyMurray
λ jruby --version
jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [mswin32-x86_64]

C:\Users\TobyMurray
λ gem install warbler -v 2.0.1
ERROR:  While executing gem ... (SystemCallError)
    Unknown error 1314 - CreateSymbolicLink

@djberg96
Copy link
Contributor

@tobymurray-nanometrics It's a deliberate restriction in the way that the underlying CreateSymbolicLink function works on Windows, not a JRuby issue per se.

Alternatively, you can add SeCreateSymbolicLinkPrivilege to your local security policy.

@tobymurray-nanometrics
Copy link
Author

tobymurray-nanometrics commented May 27, 2016

@djberg96 - awesome. Thanks so much (and @headius ) for the quick responses and the fix!

@enebo
Copy link
Member

enebo commented May 27, 2016

@tobymurray-nanometrics This is a transitive statement but added for posterity. MRI also has this same restriction for creating symlinks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants