xerial / snappy-java

Snappy compressor/decompressor for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libsnappyjava.so unusable on FreeBSD 12/13

michael-o opened this issue · comments

I have at hand: 12.4-RELEASE-p7 and 13.3-PRERELEASE
Snappy from https://repo1.maven.org/maven2/org/xerial/snappy/snappy-java/1.1.9.1/snappy-java-1.1.9.1.jar

When trying to load the native library it does not work and here is the reason:

/tmp/snappy/org/xerial/snappy/native/FreeBSD/x86_64
$ ldd ./libsnappyjava.so
./libsnappyjava.so:
        libstdc++.so.6 => not found (0)
        libm.so.5 => /lib/libm.so.5 (0x82ed4a000)
        libc.so.7 => /lib/libc.so.7 (0x8214b6000)

libstdc++.so.6 is available in https://www.freshports.org/misc/compat9x/, quite old.

Compiling myself works if you patch the Makefile to use LLVM and not GCC:

$ git diff -U0
diff --git a/Makefile.common b/Makefile.common
index 9eba009..3ac5676 100755
--- a/Makefile.common
+++ b/Makefile.common
@@ -272 +272 @@ Mac-aarch64_LIBNAME   := libsnappyjava.dylib
-FreeBSD-x86_64_CXX          := $(CROSS_PREFIX)g++
+FreeBSD-x86_64_CXX          := $(CROSS_PREFIX)c++

Output:

$ ldd target/classes/org/xerial/snappy/native/FreeBSD/x86_64/libsnappyjava.so   target/classes/org/xerial/snappy/native/FreeBSD/x86_64/libsnappyjava.so:
        libc++.so.1 => /usr/lib/libc++.so.1 (0x333c081da000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x333c086cc000)
        libm.so.5 => /lib/libm.so.5 (0x333c09ca0000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x333c0a98a000)
        libc.so.7 => /lib/libc.so.7 (0x333c051d5000)

Note: I don't use Snappy, but noticed this when analyzing test failures for Apache Flink: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225203

Installed misc/compat9x:

$ ldd org/xerial/snappy/native/FreeBSD/x86_64/libsnappyjava.so
org/xerial/snappy/native/FreeBSD/x86_64/libsnappyjava.so:
        libstdc++.so.6 => /usr/local/lib/compat/libstdc++.so.6 (0x1b4017dd4000)
        libm.so.5 => /lib/libm.so.5 (0x1b401a158000)
        libc.so.7 => /lib/libc.so.7 (0x1b401446a000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x1b4018fbe000)

FreeBSD support is not actively maintained as it needs an environment to build a native library. If you can submit a PR containing libsnappyjava.so for FreeBSD, I'd be happy to merge it to the main branch.

Will try to provide for x86 and amd64 from a 12.4-RELEASE jail. That should suffice for a long time...

@xerial PR provided as a courtesy for the great work on the SQLite JDBC driver which I also use at work.