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: flock unsupported or native support failed to load #3409

Closed
akkie opened this Issue Oct 22, 2015 · 37 comments

Comments

Projects
None yet
7 participants
@akkie
Copy link

akkie commented Oct 22, 2015

I get the following exception if I try to install bundler with JRuby 9.0.3.0 on Ubuntu 14.04:

$ gem install bundler
NotImplementedError: flock unsupported or native support failed to load
                   flock at org/jruby/RubyFile.java:304
    block in read_binary at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems.rb:773
                    open at org/jruby/RubyIO.java:1125
                    open at org/jruby/RubyKernel.java:310
             read_binary at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems.rb:772
              fetch_spec at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/source.rb:145
                    spec at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/resolver/api_specification.rb:76
      add_always_install at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/resolver/installer_set.rb:77
    resolve_dependencies at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/dependency_installer.rb:473
             install_gem at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:238
   block in install_gems at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:299
                    each at org/jruby/RubyArray.java:1560
            install_gems at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:295
                 execute at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:202
  invoke_with_build_args at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/command.rb:307
            process_args at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/command_manager.rb:168
                     run at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/command_manager.rb:138
                     run at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/gem_runner.rb:54
                   <top> at /home/christian/.rvm/rubies/jruby-9.0.3.0/bin/jgem:21
                    load at org/jruby/RubyKernel.java:957
                   <top> at /home/christian/.rvm/rubies/jruby-9.0.3.0/bin/gem:1
@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

That's strange...flock should work fine. Can you try running it with JRUBY_OPTS="-Xnative.verbose=true" and post the output?

@Slicertje

This comment has been minimized.

Copy link

Slicertje commented Oct 22, 2015

I got the same exception

stefaan@halley:~$ jruby -Xnative.verbose=true -S gem install bundler
Failed to load native POSIX impl; falling back on Java impl. Stacktrace follows.
java.lang.UnsatisfiedLinkError: /lib32/libcrypt.so.1: verkeerde ELF-klasse: ELFCLASS32
        at jnr.ffi.provider.jffi.NativeLibrary.loadNativeLibraries(NativeLibrary.java:87)
        at jnr.ffi.provider.jffi.NativeLibrary.getNativeLibraries(NativeLibrary.java:70)
        at jnr.ffi.provider.jffi.NativeLibrary.getSymbolAddress(NativeLibrary.java:49)
        at jnr.ffi.provider.jffi.NativeLibrary.findSymbolAddress(NativeLibrary.java:59)
        at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:117)
        at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:59)
        at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:43)
        at jnr.ffi.LibraryLoader.load(LibraryLoader.java:290)
        at jnr.ffi.Library.loadLibrary(Library.java:127)
        at jnr.posix.POSIXFactory$DefaultLibCProvider$SingletonHolder.<clinit>(POSIXFactory.java:279)
        at jnr.posix.POSIXFactory$DefaultLibCProvider.getLibC(POSIXFactory.java:283)
        at jnr.posix.BaseNativePOSIX.<init>(BaseNativePOSIX.java:36)
        at jnr.posix.LinuxPOSIX.<init>(LinuxPOSIX.java:18)
        at jnr.posix.POSIXFactory.loadLinuxPOSIX(POSIXFactory.java:143)
        at jnr.posix.POSIXFactory.loadNativePOSIX(POSIXFactory.java:121)
        at jnr.posix.POSIXFactory.loadPOSIX(POSIXFactory.java:90)
        at jnr.posix.LazyPOSIX.loadPOSIX(LazyPOSIX.java:36)
        at jnr.posix.LazyPOSIX.posix(LazyPOSIX.java:32)
        at jnr.posix.LazyPOSIX.isNative(LazyPOSIX.java:370)
        at org.jruby.RubyGlobal.prepareStdioChannel(RubyGlobal.java:279)
        at org.jruby.RubyGlobal.createGlobals(RubyGlobal.java:193)
        at org.jruby.Ruby.init(Ruby.java:1239)
        at org.jruby.Ruby.newInstance(Ruby.java:330)
        at org.jruby.Main.internalRun(Main.java:272)
        at org.jruby.Main.run(Main.java:233)
        at org.jruby.Main.main(Main.java:200)
NotImplementedError: flock unsupported or native support failed to load
                   flock at org/jruby/RubyFile.java:304
    block in read_binary at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems.rb:773
                    open at org/jruby/RubyIO.java:1125
                    open at org/jruby/RubyKernel.java:310
             read_binary at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems.rb:772
              fetch_spec at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/source.rb:145
                    spec at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/resolver/api_specification.rb:76
               full_spec at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/resolver/activation_request.rb:74
              installed? at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/resolver/activation_request.rb:104
        block in install at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/request_set.rb:151
                    each at org/jruby/RubyArray.java:1560
                 install at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/request_set.rb:150
             install_gem at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:249
   block in install_gems at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:299
                    each at org/jruby/RubyArray.java:1560
            install_gems at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:295
                 execute at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:202
  invoke_with_build_args at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/command.rb:307
            process_args at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/command_manager.rb:168
                     run at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/command_manager.rb:138
                     run at /home/stefaan/Apps/jruby/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/gem_runner.rb:54
                   <top> at /home/stefaan/Apps/jruby/current/bin/jgem:21
                    load at org/jruby/RubyKernel.java:957
                   <top> at /home/stefaan/Apps/jruby/current/bin/gem:1
@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

Ok for some reason on your system our native subsystem is not loading, and the fallback to a pure-Java flock is not working.

A couple things to check:

  • Do you have a nonstandard tmp location in TMP or TMPDIR or something like that?
  • Do you have a secure setup that prevents code in TMPDIR from being loaded?
  • Try setting TMP or TMPDIR to your current dir and see if it works properly.
@Slicertje

This comment has been minimized.

Copy link

Slicertje commented Oct 22, 2015

Tmp is standard location (/tmp), no security measures in place. It's my dev laptop.
Setting TMPDIR to current dir doesn't change anything.

I did get it working. Apt said I had 2 packets that were no longer necessairy lib32z1 and libc6-i386. After an apt-get autoremove the problem was gone. (it removed /lib32/libcrypt.so.1 and left only /lib/x86_64-linux-gnu/libcrypt.so.1)

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

Ahh so this would likely be an issue loading the wrong bit-width version of crypt. I'll talk with @enebo about how to avoid this in the future.

Thanks for the update!

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

@akkie Perhaps @Slicertje's fix would work for you too?

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

Unfortunately I can't reproduce the issue even with lib32z1 and libc6-i386 installed.

@Slicertje What env vars do you have relating to LD_LIBRARY*?

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

Also LD64_LIBRARY or other variations.

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Oct 22, 2015

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Oct 22, 2015

see also my stacktrace in #3380 (comment)

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

@mkristian How do you enable multiarch?

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Oct 22, 2015

@headius I do not remember but something along this howto https://wiki.debian.org/Multiarch/HOWTO on ubuntu (I did it already a few times and each time it is different then the last time)

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

@mkristian Well phooey... my Ubuntu says it supports both i386 and x86_64 according to that page, but I don't get the wrong files loading. Do you have any unusual LD(64)LIBRARY* env?

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

Marking this for 9.0.5 because the workaround is reasonably simple. There's obviously something wrong in our library selection logic (or the logic in https://github.com/jnr/jffi) that's picking the wrong bit-width and trying to run it.

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Oct 22, 2015

possible - if I want to install a game I can be very persistent.

I can look into this since I have reproducible case but not before Tuesday, since I am off to visit my son over the weekend.

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

@mkristian That would be great. I will keep trying to reproduce, but we have to get ready for JavaOne next week.

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 22, 2015

@mkristian Oh, you might try running jnr-posix tests. If you can get them to fail you'll have a much easier path to figuring out why jffi/jnr-ffi is loading the wrong lib.

@akkie

This comment has been minimized.

Copy link
Author

akkie commented Oct 23, 2015

@headius No it doesn't solve the issue on my machine. I also have a multiarch system and running jruby -Xnative.verbose=true -S gem install bundler shows the same error:

Failed to load native POSIX impl; falling back on Java impl. Stacktrace follows.
java.lang.UnsatisfiedLinkError: /lib32/libcrypt.so.1: falsche ELF-Klasse: ELFCLASS32
    at jnr.ffi.provider.jffi.NativeLibrary.loadNativeLibraries(NativeLibrary.java:87)
    at jnr.ffi.provider.jffi.NativeLibrary.getNativeLibraries(NativeLibrary.java:70)
    at jnr.ffi.provider.jffi.NativeLibrary.getSymbolAddress(NativeLibrary.java:49)
    at jnr.ffi.provider.jffi.NativeLibrary.findSymbolAddress(NativeLibrary.java:59)
    at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:117)
    at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:59)
    at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:43)
    at jnr.ffi.LibraryLoader.load(LibraryLoader.java:290)
    at jnr.ffi.Library.loadLibrary(Library.java:127)
    at jnr.posix.POSIXFactory$DefaultLibCProvider$SingletonHolder.<clinit>(POSIXFactory.java:279)
    at jnr.posix.POSIXFactory$DefaultLibCProvider.getLibC(POSIXFactory.java:283)
    at jnr.posix.BaseNativePOSIX.<init>(BaseNativePOSIX.java:36)
    at jnr.posix.LinuxPOSIX.<init>(LinuxPOSIX.java:18)
    at jnr.posix.POSIXFactory.loadLinuxPOSIX(POSIXFactory.java:143)
    at jnr.posix.POSIXFactory.loadNativePOSIX(POSIXFactory.java:121)
    at jnr.posix.POSIXFactory.loadPOSIX(POSIXFactory.java:90)
    at jnr.posix.LazyPOSIX.loadPOSIX(LazyPOSIX.java:36)
    at jnr.posix.LazyPOSIX.posix(LazyPOSIX.java:32)
    at jnr.posix.LazyPOSIX.isNative(LazyPOSIX.java:370)
    at org.jruby.RubyGlobal.prepareStdioChannel(RubyGlobal.java:279)
    at org.jruby.RubyGlobal.createGlobals(RubyGlobal.java:193)
    at org.jruby.Ruby.init(Ruby.java:1239)
    at org.jruby.Ruby.newInstance(Ruby.java:330)
    at org.jruby.Main.internalRun(Main.java:272)
    at org.jruby.Main.run(Main.java:233)
    at org.jruby.Main.main(Main.java:200)
NotImplementedError: flock unsupported or native support failed to load
                   flock at org/jruby/RubyFile.java:304
    block in read_binary at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems.rb:773
                    open at org/jruby/RubyIO.java:1125
                    open at org/jruby/RubyKernel.java:310
             read_binary at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems.rb:772
              fetch_spec at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/source.rb:145
                    spec at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/resolver/api_specification.rb:76
      add_always_install at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/resolver/installer_set.rb:77
    resolve_dependencies at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/dependency_installer.rb:473
             install_gem at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:238
   block in install_gems at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:299
                    each at org/jruby/RubyArray.java:1560
            install_gems at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:295
                 execute at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:202
  invoke_with_build_args at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/command.rb:307
            process_args at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/command_manager.rb:168
                     run at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/command_manager.rb:138
                     run at /home/christian/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/gem_runner.rb:54
                   <top> at /home/christian/.rvm/rubies/jruby-9.0.3.0/bin/jgem:21
                    load at org/jruby/RubyKernel.java:957
                   <top> at /home/christian/.rvm/rubies/jruby-9.0.3.0/bin/gem:1

mkristian added a commit to mkristian/jnr-ffi that referenced this issue Oct 23, 2015

exclude the wrong paths for the wrong cpu architecture
using ld.so.conf on multiarch linux systems will include search
paths for both 32 and 64 architecture. when finding the native
library we need to look only at the paths which contains the
libraries for the cpu in use.

fixes jruby/jruby#3409

Sponsored by Lookout Inc.
@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Oct 23, 2015

@headius since you have already a multiarch system then I guess you just need to install
sudo apt-get install libc6-dev:i386 to see the error (not sure here). my ld.conf.d setup is

$ ls -1 /etc/ld.so.conf.d/
fakeroot-x86_64-linux-gnu.conf
i386-linux-gnu.conf
i386-linux-gnu_GL.conf
libc.conf
x86_64-linux-gnu.conf
x86_64-linux-gnu_EGL.conf
x86_64-linux-gnu_GL.conf
zz_i386-biarch-compat.conf

and

 $ cat /etc/ld.so.conf.d/*/usr/lib/x86_64-linux-gnu/libfakeroot
# Multiarch support
/lib/i386-linux-gnu
/usr/lib/i386-linux-gnu
/lib/i686-linux-gnu
/usr/lib/i686-linux-gnu
# libc default configuration
/usr/local/lib
# Multiarch support
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/mesa-egl
/usr/lib/nvidia-355
/usr/lib32/nvidia-355
# Legacy biarch compatibility support
/lib32
/usr/lib32

so all those lib32/i386 or x86_64 paths can/do cause problems with the current search logic.

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 23, 2015

@mkristian Ahh, I did not have the :i386 bit when I tried before. Will confirm today.

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 23, 2015

Well I managed to get it to fail but I kinda had to force it a little:

headius@headius-vbox-ubuntu64:~/jruby$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib32
headius@headius-vbox-ubuntu64:~/jruby$ gem install bundler
NotImplementedError: flock unsupported or native support failed to load
                   flock at org/jruby/RubyFile.java:304

Before this my LD_LIBRARY_PATH was not set at all, nor was LD64_LIBRARY_PATH. I believe my ld.so.conf files are about like @mkristian's, with lib32 only in the "zz" file.

I will proceed to try to make jffi/jnr-ffi deal with my case, but I still would like to see LD*LIBRARY_PATH env from those of you having this problem.

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 23, 2015

Also, anyone having this issue could provide the output of following command:

jruby -Xnative.enabled=false -e "puts ENV_JAVA['java.library.path']"

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Oct 23, 2015

@headius did you try the jnr-ffi with jnr/jnr-ffi#52 on your forced LD_LIBRARY_PATH - could already resolve your problem.

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 23, 2015

@mkristian a-ha, I had forgotten that one. I will try it.

This won't go into 9.0.4 in any case because I don't believe it's a new issue, but if jnr/jnr-ffi#52 works we'll roll it into 9.0.5 and let it bake on master until that release.

headius added a commit that referenced this issue Oct 23, 2015

@headius

This comment has been minimized.

Copy link
Member

headius commented Oct 23, 2015

So here's the deal...we've rolled JRuby master to jnr-ffi 2.0.5 which we believe fixes the reported issues here. It does not fix my LD_LIBRARY_PATH case but I believe that one is pretty artificial...basically forcing a 32-bit library path into the env running 64-bit stuff, bypassing ld.so.conf logic and appropriate path calculations based on it.

We would VERY MUCH like for you folks to verify this with JRuby master, and to that end I have forced a dist build here: https://projectodd.ci.cloudbees.com/view/JRuby/job/jruby-master-dist/66/

When that completes, http://ci.jruby.org will contain updated 9.0.4 builds including the jnr-ffi update for you to verify.

@Slicertje

This comment has been minimized.

Copy link

Slicertje commented Oct 26, 2015

I still have the problem on my desktop. But I tried jruby-bin-9.0.4.0-SNAPSHOT.tar.gz and have no error any more:

stefaan@nova:~/Apps/jruby/jruby-9.0.4.0-SNAPSHOT/bin$ ./jruby -v
jruby 9.0.4.0-SNAPSHOT (2.2.2) 2015-10-25 097c715 Java HotSpot(TM) 64-Bit Server VM 25.60-b23 on 1.8.0_60-b27 +jit [linux-amd64]
stefaan@nova:~/Apps/jruby/jruby-9.0.4.0-SNAPSHOT/bin$ ./jruby -S gem install bundler
Fetching: bundler-1.10.6.gem (100%)
Successfully installed bundler-1.10.6
1 gem installed
@richtmat

This comment has been minimized.

Copy link

richtmat commented Nov 5, 2015

I have the problem on ubuntu 14.04 with a fresh 9.0.4.0-SNAPSHOT:

bin  ./jruby -v
jruby 9.0.4.0-SNAPSHOT (2.2.2) 2015-11-05 cbf61e6 Java HotSpot(TM) 64-Bit Server VM 25.66-b17 on 1.8.0_66-b17 +jit [linux-amd64]

bin  ./jruby -S gem install bundler
NotImplementedError: flock unsupported or native support failed to load
                   flock at org/jruby/RubyFile.java:304
    block in read_binary at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems.rb:773
                    open at org/jruby/RubyIO.java:1125
                    open at org/jruby/RubyKernel.java:310
             read_binary at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems.rb:772
              fetch_spec at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/source.rb:145
                    spec at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/resolver/api_specification.rb:76
      add_always_install at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/resolver/installer_set.rb:77
    resolve_dependencies at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/dependency_installer.rb:473
             install_gem at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:238
   block in install_gems at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:299
                    each at org/jruby/RubyArray.java:1560
            install_gems at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:295
                 execute at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:202
  invoke_with_build_args at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/command.rb:307
            process_args at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/command_manager.rb:168
                     run at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/command_manager.rb:138
                     run at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/gem_runner.rb:54
                   <top> at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/bin/jgem:21
                    load at org/jruby/RubyKernel.java:957
                   <top> at gem:4
@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Nov 5, 2015

@richtmat I need more info on your setup:

  • jdk version
  • how did you install jdk ? via debian package-manager ?
  • how does the whole thing work without native enabled - jruby -Xnative.enabled=false -S gem install bundler
  • and what do you get with jruby -Xnative.verbose=true -S gem install bundler

sorry so many questions but we need to be able to reproduce your problem :)

@richtmat

This comment has been minimized.

Copy link

richtmat commented Nov 5, 2015

@mkristian no problem. thanks for the help!

JDK, installed via apt-get, package is oracle-java8-installer:

$ java -version 
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

without native enabled:

$ ~/Downloads/jruby-9.0.4.0-SNAPSHOT/bin/jruby -Xnative.enabled=false -S gem install bundler
NotImplementedError: flock unsupported or native support failed to load
                   flock at org/jruby/RubyFile.java:304
    block in read_binary at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems.rb:773
                    open at org/jruby/RubyIO.java:1125
                    open at org/jruby/RubyKernel.java:310
             read_binary at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems.rb:772
              fetch_spec at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/source.rb:145
                    spec at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/resolver/api_specification.rb:76
               full_spec at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/resolver/activation_request.rb:74
              installed? at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/resolver/activation_request.rb:104
        block in install at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/request_set.rb:151
                    each at org/jruby/RubyArray.java:1560
                 install at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/request_set.rb:150
             install_gem at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:249
   block in install_gems at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:299
                    each at org/jruby/RubyArray.java:1560
            install_gems at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:295
                 execute at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:202
  invoke_with_build_args at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/command.rb:307
            process_args at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/command_manager.rb:168
                     run at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/command_manager.rb:138
                     run at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/gem_runner.rb:54
                   <top> at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/bin/jgem:21
                    load at org/jruby/RubyKernel.java:957
                   <top> at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/bin/gem:4

verbose:

$ ~/Downloads/jruby-9.0.4.0-SNAPSHOT/bin/jruby -Xnative.verbose=true -S gem install bundler
Failed to load native POSIX impl; falling back on Java impl. Stacktrace follows.
java.lang.UnsatisfiedLinkError: /libx32/libcrypt.so.1: wrong ELF class: ELFCLASS32
    at jnr.ffi.provider.jffi.NativeLibrary.loadNativeLibraries(NativeLibrary.java:87)
    at jnr.ffi.provider.jffi.NativeLibrary.getNativeLibraries(NativeLibrary.java:70)
    at jnr.ffi.provider.jffi.NativeLibrary.getSymbolAddress(NativeLibrary.java:49)
    at jnr.ffi.provider.jffi.NativeLibrary.findSymbolAddress(NativeLibrary.java:59)
    at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:117)
    at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:59)
    at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:43)
    at jnr.ffi.LibraryLoader.load(LibraryLoader.java:290)
    at jnr.ffi.Library.loadLibrary(Library.java:127)
    at jnr.posix.POSIXFactory$DefaultLibCProvider$SingletonHolder.<clinit>(POSIXFactory.java:279)
    at jnr.posix.POSIXFactory$DefaultLibCProvider.getLibC(POSIXFactory.java:283)
    at jnr.posix.BaseNativePOSIX.<init>(BaseNativePOSIX.java:36)
    at jnr.posix.LinuxPOSIX.<init>(LinuxPOSIX.java:18)
    at jnr.posix.POSIXFactory.loadLinuxPOSIX(POSIXFactory.java:143)
    at jnr.posix.POSIXFactory.loadNativePOSIX(POSIXFactory.java:121)
    at jnr.posix.POSIXFactory.loadPOSIX(POSIXFactory.java:90)
    at jnr.posix.LazyPOSIX.loadPOSIX(LazyPOSIX.java:36)
    at jnr.posix.LazyPOSIX.posix(LazyPOSIX.java:32)
    at jnr.posix.LazyPOSIX.isNative(LazyPOSIX.java:370)
    at org.jruby.RubyGlobal.prepareStdioChannel(RubyGlobal.java:279)
    at org.jruby.RubyGlobal.createGlobals(RubyGlobal.java:193)
    at org.jruby.Ruby.init(Ruby.java:1239)
    at org.jruby.Ruby.newInstance(Ruby.java:330)
    at org.jruby.Main.internalRun(Main.java:272)
    at org.jruby.Main.run(Main.java:233)
    at org.jruby.Main.main(Main.java:200)
NotImplementedError: flock unsupported or native support failed to load
                   flock at org/jruby/RubyFile.java:304
    block in read_binary at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems.rb:773
                    open at org/jruby/RubyIO.java:1125
                    open at org/jruby/RubyKernel.java:310
             read_binary at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems.rb:772
              fetch_spec at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/source.rb:145
                    spec at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/resolver/api_specification.rb:76
               full_spec at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/resolver/activation_request.rb:74
              installed? at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/resolver/activation_request.rb:104
        block in install at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/request_set.rb:151
                    each at org/jruby/RubyArray.java:1560
                 install at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/request_set.rb:150
             install_gem at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:249
   block in install_gems at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:299
                    each at org/jruby/RubyArray.java:1560
            install_gems at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:295
                 execute at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/commands/install_command.rb:202
  invoke_with_build_args at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/command.rb:307
            process_args at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/command_manager.rb:168
                     run at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/command_manager.rb:138
                     run at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/lib/ruby/stdlib/rubygems/gem_runner.rb:54
                   <top> at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/bin/jgem:21
                    load at org/jruby/RubyKernel.java:957
                   <top> at /home/matthias/Downloads/jruby-9.0.4.0-SNAPSHOT/bin/gem:4

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Nov 5, 2015

any chance you can tell me how you got /libx32/libcrypt.so.1 onto your system. the new jnr-ffi does handle lib32 directories but not libx32 directories :(

@mkristian mkristian reopened this Nov 5, 2015

@richtmat

This comment has been minimized.

Copy link

richtmat commented Nov 5, 2015

@mkristian I don't know to be honest. How do I even find out?

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Nov 5, 2015

@richtmat no problem. the latest patch is not enough for your case: jnr/jnr-ffi@3b4725d#diff-1d195f2e86fc2b08a79caba9a89d0856R444

the fix for this is obvious :)

mkristian added a commit to mkristian/jnr-ffi that referenced this issue Nov 8, 2015

improve the check on 32bit vs 64bit directory name
there are indeed /libx32/ on ubuntu 14.04 using the oracle-java8-installer
package. this patch is to make the detection of those directories more lenient.

fixes jruby/jruby#3409

Sponsored by Lookout Inc.
@headius

This comment has been minimized.

Copy link
Member

headius commented Nov 12, 2015

So we have part of the fix in for 9.0.4 but not all of it, is that correct?

headius added a commit that referenced this issue Nov 12, 2015

Bump up to jnr-ffi 2.0.7.
Includes all fixes for #3409.

@headius headius modified the milestones: JRuby 9.0.4.0, JRuby 9.0.5.0 Nov 12, 2015

@Gonzih

This comment has been minimized.

Copy link

Gonzih commented Feb 6, 2016

I just tried to install jruby-9.0.5.0 on alpine linux inside docker container and got the same error. I'm assuming that is because flock is part of busybox.

Seems to be related to this issue gliderlabs/docker-alpine#11
So it's issue with glibc and busybox.

@headius

This comment has been minimized.

Copy link
Member

headius commented Feb 13, 2016

@Gonzih Ahh, very good information, thanks. Hopefully they'll figure out a way to resolve that issue, and if anyone else runs into it they'll find your comment.

@Gonzih

This comment has been minimized.

Copy link

Gonzih commented Feb 13, 2016

@headius apparently current solution is to bring glibc in to alpine linux to run jvm :)

marques-work added a commit to snap-ci/ruby-build that referenced this issue Jan 31, 2017

jruby-9.0.3.0 has issues on the ubuntu container, so don't build it. …
…resolved in jruby-9.0.4.0

  - issues with jffi and ld.so.conf library paths; loads wrong libcrypt in lib32. see jruby/jruby#3409
    - while we can work around assembling jruby by setting the ld config path, one would have to do this at runtime as well. not worth it.
  - this was fixed with a small patch that made it into 9.0.4.0 (so not a big deal to remove 9.0.3.0)

[snap/#3050] Move rbenv installation in containers to $HOME (i.e. /var/go)
@cpuguy83

This comment has been minimized.

Copy link

cpuguy83 commented Oct 26, 2017

:( Seeing this trying to build the i386/alpine image of the docker jruby image.

tianon pushed a commit to docker-library/official-images that referenced this issue Oct 26, 2017

jruby multi-arch
Not supporting i386+alpine yet since there seems to be an issue when
installing bundler: related to jruby/jruby#3409

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.