lz4 / lz4-java

LZ4 compression for Java
Apache License 2.0
1.1k stars 253 forks source link

Add minimum glibc version to each release #160

Closed patelh closed 3 years ago

patelh commented 4 years ago

Useful to add minimum glibc version to each release so we can easily verify if the right version is installed on the OS.

odaira commented 4 years ago

I don't have experience to test software across different glibc versions, but how would you figure out the minimum version with which a library is supposed to work? Lz4-java is loaded into a JVM, and I guess the JVM has stricter dependencies on a specific glibc version, so I am wondering how meaningful it is to declare a minimum glibc version for lz4-java itself.

patelh commented 4 years ago

The minimum glibc version is defined at compile time of the libraries embedded in the jar. For example 1.4.0 has a different minimum glibc version then 1.5.1. It's the OS used to compile your jar which defines the minimum glibc version. IIRC.

e.g. check under /lib64/lib-c*.so

patelh commented 4 years ago

Otherwise, we see this error which is eaten up and defaults to the Unsafe/Safe java version:

java.lang.UnsatisfiedLinkError: /tmp/liblz4-java-882887096802214809.so: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /tmp/liblz4-java-882887096802214809.so)
  at java.lang.ClassLoader$NativeLibrary.load(Native Method)
  at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
  at java.lang.Runtime.load0(Runtime.java:809)
  at java.lang.System.load(System.java:1086)
  at net.jpountz.util.Native.load(Native.java:135)
odaira commented 4 years ago

ok, I've just learned I can use ldd -v to know the dependent glibc version.

$ ldd -v src/resources/net/jpountz/util/linux/amd64/liblz4-java.so
    linux-vdso.so.1 (0x00007ffd14ffa000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f243f1cb000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f243f7ec000)

    Version information:
    src/resources/net/jpountz/util/linux/amd64/liblz4-java.so:
        libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
        libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6
        libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
    /lib/x86_64-linux-gnu/libc.so.6:
        ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
        ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2

In this example, 2.2.5 is the minimum version...? I'll document these in the release note. Thanks for the suggestion.

patelh commented 4 years ago

No, minimum required is still 2.14 in your example.

Here is ldd output on a centos 6.9 image for 1.4.0 and 1.5.1, where 1.4.0 will work and 1.5.1 does not due to missing required lib:

[root@d7a5a938ee73 amd64]# ldd -v liblz4-java.so 
ldd: warning: you do not have execution permission for `./liblz4-java.so'
    linux-vdso.so.1 =>  (0x00007ffc491d8000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f659964d000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f6599bee000)

    Version information:
    ./liblz4-java.so:
        libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
    /lib64/libc.so.6:
        ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
        ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
[root@d7a5a938ee73 amd64]# ldd -v liblz4-java.so 
ldd: warning: you do not have execution permission for `./liblz4-java.so'
./liblz4-java.so: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./liblz4-java.so)
    linux-vdso.so.1 =>  (0x00007fff61b25000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f0416bd6000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f041719a000)

    Version information:
    ./liblz4-java.so:
        libc.so.6 (GLIBC_2.14) => not found
        libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
        libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
    /lib64/libc.so.6:
        ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
        ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
odaira commented 4 years ago

I see, I need more study. I'll check with a centos 6.9 image.

    src/resources/net/jpountz/util/linux/amd64/liblz4-java.so:
        libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
        libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6
        libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
  1. In the example above, among GLIBC_2.14, GLIBC_2.4, and GLIBC_2.2.5, GLIBC_2.14 is the highest version, correct?
  2. If so, is the highest dependent version the minimum required version...?
patelh commented 4 years ago
  1. Yes.
  2. Yes.
odaira commented 3 years ago

Added minimum glibc versions to https://github.com/lz4/lz4-java/blob/1.8.0/CHANGES.md Thanks for your help!