Skip to content

GLIBC compatibility with RHEL/CentOS 7 and JRuby 9.4.0.0 #7579

@li-afaris

Description

@li-afaris

Hi. It appears the JNI bindings for JRuby 9.4.0.0 were built with GLIBC 2.27. RHEL/CentOS 7 ships with GLIBC 2.17. Is it possible to support older builds of GLIBC with future builds of JRuby 9.4? It would be great to use the features of MRI Ruby 3.1.

Thanks

Environment Information

afaris:jruby-9.4.0.0 $ ./bin/jruby --version
jruby 9.4.0.0 (3.1.0) 2022-11-23 95c0ec159f OpenJDK 64-Bit Server VM 11.0.8+10-20200812 on 11.0.8+10-20200812 +jit [x86_64-linux]

afaris:jruby-9.4.0.0 $ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

afaris:jruby-9.4.0.0 $ rpm -q glibc
glibc-2.17-326.el7_9.i686
glibc-2.17-326.el7_9.x86_64

Expected Behavior
JRuby would not throw an exception when using JNI bindings.

# executed on a fedora host with GLIBC 2.35
$  ./bin/jruby -Xnative.verbose -w -d --dev -e 'system "date"' 
Successfully loaded native POSIX impl.
Thu Jan 12 02:12:32 PM PST 2023

Actual Behavior
When running jruby 9.4.0.0 on centos 7 I get a glibc exception.

afaris:jruby-9.4.0.0 $  ./bin/jruby -Xnative.verbose -w -d --dev -e 'system "date"' 
Failed to load native POSIX impl; falling back on Java impl. Stacktrace follows.
java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
	at org.jruby.dist/jnr.ffi.provider.InvalidProvider$1.loadLibrary(InvalidProvider.java:49)
	at org.jruby.dist/jnr.ffi.LibraryLoader.load(LibraryLoader.java:420)
	at org.jruby.dist/jnr.posix.POSIXFactory$DefaultLibCProvider$SingletonHolder.<clinit>(POSIXFactory.java:307)
	at org.jruby.dist/jnr.posix.POSIXFactory$DefaultLibCProvider.getLibC(POSIXFactory.java:335)
	at org.jruby.dist/jnr.posix.BaseNativePOSIX.<init>(BaseNativePOSIX.java:41)
	at org.jruby.dist/jnr.posix.LinuxPOSIX.<init>(LinuxPOSIX.java:23)
	at org.jruby.dist/jnr.posix.POSIXFactory.loadLinuxPOSIX(POSIXFactory.java:149)
	at org.jruby.dist/jnr.posix.POSIXFactory.loadNativePOSIX(POSIXFactory.java:124)
	at org.jruby.dist/jnr.posix.POSIXFactory.loadPOSIX(POSIXFactory.java:93)
	at org.jruby.dist/jnr.posix.LazyPOSIX.loadPOSIX(LazyPOSIX.java:40)
	at org.jruby.dist/jnr.posix.LazyPOSIX.posix(LazyPOSIX.java:34)
	at org.jruby.dist/jnr.posix.LazyPOSIX.isNative(LazyPOSIX.java:404)
	at org.jruby.dist/org.jruby.util.io.FilenoUtil.<init>(FilenoUtil.java:43)
	at org.jruby.dist/org.jruby.Ruby.<init>(Ruby.java:298)
	at org.jruby.dist/org.jruby.Ruby.newInstance(Ruby.java:730)
	at org.jruby.dist/org.jruby.Main.internalRun(Main.java:266)
	at org.jruby.dist/org.jruby.Main.run(Main.java:227)
	at org.jruby.dist/org.jruby.Main.main(Main.java:199)
Caused by: java.lang.UnsatisfiedLinkError: could not get native definition for type `POINTER`, original error message follows: java.lang.UnsatisfiedLinkError: Unable to execute or load jffi binary stub from `/tmp`. Set `TMPDIR` or Java property `java.io.tmpdir` to a read/write path that is not mounted "noexec".
/home/afaris/jruby/jruby-9.4.0.0/jffi10117070039016966684.so: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by /home/afaris/jruby/jruby-9.4.0.0/jffi10117070039016966684.so)
	at org.jruby.dist/com.kenai.jffi.internal.StubLoader.tempLoadError(StubLoader.java:555)
	at org.jruby.dist/com.kenai.jffi.internal.StubLoader.loadFromJar(StubLoader.java:454)
	at org.jruby.dist/com.kenai.jffi.internal.StubLoader.load(StubLoader.java:330)
...

This is confirmed by the ldd command on centos 7.

afaris:jruby-9.4.0.0 $ ldd lib/jni/x86_64-Linux/libjffi-1.2.so
ldd: warning: you do not have execution permission for `lib/jni/x86_64-Linux/libjffi-1.2.so'
lib/jni/x86_64-Linux/libjffi-1.2.so: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by lib/jni/x86_64-Linux/libjffi-1.2.so)
	linux-vdso.so.1 =>  (0x00007f413175b000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f413116e000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f413153c000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions