Re: Fwd: Java core dump on freeBSD 12.2

From: Michael Osipov <1983-01-06_at_gmx.net>
Date: Mon, 12 Jul 2021 20:11:42 UTC
Am 2021-07-12 um 21:39 schrieb Simeo Reig:
>> If you don't know how to do the above, let me know I can compile the
>> shim for you for amd64.
>
> It would be very kind of yo. Thanks

General instructions for everyone:
> $ git clone https://github.com/xerial/sqlite-jdbc.git
> $ cd sqlite-jdbc
> $ export JAVA_HOME=/usr/local/openjdk8
> $ gmake native SQLITE_HEADER=/usr/local/include/sqlite3.h SQLITE_OBJ=/usr/local/lib/libsqlite3.so
> "$JAVA_HOME/bin/javac"  -d target/common-lib -sourcepath src/main/java -h target/common-lib src/main/java/org/sqlite/core/NativeDB.java
> Note: Some input files use or override a deprecated API.
> Note: Recompile with -Xlint:deprecation for details.
> Note: src/main/java/org/sqlite/jdbc3/JDBC3Connection.java uses unchecked or unsafe operations.
> Note: Recompile with -Xlint:unchecked for details.
> mv target/common-lib/org_sqlite_core_NativeDB.h target/common-lib/NativeDB.h
> cc -Itarget/sqlite-3.36.0-FreeBSD-x86_64 -I/usr/local/include -I/usr/local/openjdk8/include -Ilib/inc_linux -Os -fPIC -fvisibility=hidden   -I"/usr/local/openjdk8/include" -I"/usr/local/openjdk8/include/freebsd" -I target/common-lib -c -o target/sqlite-3.36.0-FreeBSD-x86_64/NativeDB.o src/main/java/org/sqlite/core/NativeDB.c
> cc -Itarget/sqlite-3.36.0-FreeBSD-x86_64 -I/usr/local/include -I/usr/local/openjdk8/include -Ilib/inc_linux -Os -fPIC -fvisibility=hidden   -I"/usr/local/openjdk8/include" -I"/usr/local/openjdk8/include/freebsd" -o target/sqlite-3.36.0-FreeBSD-x86_64/libsqlitejdbc.so target/sqlite-3.36.0-FreeBSD-x86_64/NativeDB.o /usr/local/lib/libsqlite3.so -shared
> cp target/sqlite-3.36.0-FreeBSD-x86_64/libsqlitejdbc.so /tmp/libsqlitejdbc.so
> strip /tmp/libsqlitejdbc.so
> cp /tmp/libsqlitejdbc.so target/sqlite-3.36.0-FreeBSD-x86_64/libsqlitejdbc.so
> cp target/sqlite-3.36.0-FreeBSD-x86_64/libsqlitejdbc.so src/main/resources/org/sqlite/native/FreeBSD/x86_64/libsqlitejdbc.so
> cp target/sqlite-3.36.0-FreeBSD-x86_64/libsqlitejdbc.so target/classes/org/sqlite/native/FreeBSD/x86_64/libsqlitejdbc.so
> $ ldd target/sqlite-3.36.0-FreeBSD-x86_64/libsqlitejdbc.so
> target/sqlite-3.36.0-FreeBSD-x86_64/libsqlitejdbc.so:
>         libsqlite3.so.0 => /usr/local/lib/libsqlite3.so.0 (0x800e00000)
>         libc.so.7 => /lib/libc.so.7 (0x80024e000)
>         libz.so.6 => /lib/libz.so.6 (0x800677000)
>         libm.so.5 => /lib/libm.so.5 (0x800693000)
>         libthr.so.3 => /lib/libthr.so.3 (0x8006c9000)
> $ readelf -aW target/sqlite-3.36.0-FreeBSD-x86_64/libsqlitejdbc.so | grep limit
> 000000000000a1e8  0000002e00000007 R_X86_64_JUMP_SLOT     0000000000000000 sqlite3_limit + 0
>     46: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND sqlite3_limit
>     77: 0000000000006fce    81 FUNC    GLOBAL DEFAULT   12 Java_org_sqlite_core_NativeDB_limit

Now you have two options:
* Install the JNI lib to /usr/local/lib and the loader will find it
automatically,
* or put in a directory of your choice and supply
-Dorg.sqlite.lib.path=... to the JVM when starting Wildfly.

As a precaution I would recommend to remove all native libs from the JAR
with the zip(1) command.

You can make sure by running "gmake test" and should see this failure at
most:
> Failed tests:   version(org.sqlite.DBMetaDataTest): db version expected:<3.3[6.0]> but was:<3.3[5.5]>

Because the SQLite 3 port isn't up to date.

http://home.apache.org/~michaelo/freebsd/libsqlitejdbc.so
> $ sha256 target/sqlite-3.36.0-FreeBSD-x86_64/libsqlitejdbc.so
> SHA256 (target/sqlite-3.36.0-FreeBSD-x86_64/libsqlitejdbc.so) = 871b4bf681c40de7a283a7ecbc7bd6da0995f03cc7b54a8b55d0bf8aed87992e


Good luck,

Michael