termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.06k stars 3k forks source link

[Bug]: openjdk sqlite minecraft server issue #18580

Closed F1reP0wer12345 closed 10 months ago

F1reP0wer12345 commented 10 months ago

Problem description

I hope this description is more helpful then the title. Hi! I'm trying to run a Minecraft papermc server from my phone because, why not? Everything in a vanilla Minecraft server works, but when i try to install certain plugins that save configs to an SQLite db file, it has trouble doing so. Because I think the fork of openjdk-17 is doing this i thought I'd share it here. The only reason i think this is because it does work on my computer. Correct me if I'm wrong. The two plugins I can confirm have this behavior are: XConomy Itemjoin

The following error code occurs for Xconomy:

[20:43:39] [Server thread/WARN]: [XConomy] Unable to connect to database -----
[20:43:39] [Server thread/WARN]: java.sql.SQLException: Error opening connection
[20:43:39] [Server thread/WARN]:    at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:239)
[20:43:39] [Server thread/WARN]:    at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:61)
[20:43:39] [Server thread/WARN]:    at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
[20:43:39] [Server thread/WARN]:    at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:21)
[20:43:39] [Server thread/WARN]:    at org.sqlite.JDBC.createConnection(JDBC.java:115)
[20:43:39] [Server thread/WARN]:    at org.sqlite.JDBC.connect(JDBC.java:90)
[20:43:39] [Server thread/WARN]:    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
[20:43:39] [Server thread/WARN]:    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:252)
[20:43:39] [Server thread/WARN]:    at me.yic.xconomy.utils.DatabaseConnection.setGlobalConnection(DatabaseConnection.java:114)
[20:43:39] [Server thread/WARN]:    at me.yic.xconomy.data.sql.SQL.con(SQL.java:49)
[20:43:39] [Server thread/WARN]:    at me.yic.xconomy.data.DataLink.create(DataLink.java:59)
[20:43:39] [Server thread/WARN]:    at me.yic.xconomy.XConomy.onEnable(XConomy.java:103)
[20:43:39] [Server thread/WARN]:    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)
[20:43:39] [Server thread/WARN]:    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370)
[20:43:39] [Server thread/WARN]:    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500)
[20:43:39] [Server thread/WARN]:    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518)
[20:43:39] [Server thread/WARN]:    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432)
[20:43:39] [Server thread/WARN]:    at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:270)
[20:43:39] [Server thread/WARN]:    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074)
[20:43:39] [Server thread/WARN]:    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291)
[20:43:39] [Server thread/WARN]:    at java.base/java.lang.Thread.run(Thread.java:833)
[20:43:39] [Server thread/WARN]: Caused by: java.lang.Exception: No native library found for os.name=Linux, os.arch=aarch64, paths=[/org/sqlite/native/Linux/aarch64:/data/data/com.termux/files/usr/java/packages/lib:/data/data/com.termux/files/usr/lib]
[20:43:39] [Server thread/WARN]:    at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:367)
[20:43:39] [Server thread/WARN]:    at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:67)
[20:43:39] [Server thread/WARN]:    at org.sqlite.core.NativeDB.load(NativeDB.java:63)
[20:43:39] [Server thread/WARN]:    at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:235)
[20:43:39] [Server thread/WARN]:    ... 20 more

I've also found some codesnippets from these plugins, and because they're opensource, I thought sharing what code triggers this might help. A simple search for sqlite inside of the repo for XConomy might also help. Here are some code snippets that trigger this behavior: https://github.com/YiC200333/XConomy/blob/e57b9c8b3c4b21eb5f0da829b1baee5e312eab5e/XConomy-Core/src/main/java/me/yic/xconomy/utils/DatabaseConnection.java#L119 https://github.com/YiC200333/XConomy/blob/e57b9c8b3c4b21eb5f0da829b1baee5e312eab5e/XConomy-Core/src/main/java/me/yic/xconomy/data/sql/SQL.java#L50 https://github.com/YiC200333/XConomy/blob/e57b9c8b3c4b21eb5f0da829b1baee5e312eab5e/XConomy-Core/src/main/java/me/yic/xconomy/data/DataLink.java#L43

Correct me if it's not the openjdk fork, but if it is, could you please fix it? Otherwise could you try to give me some pointers of what else could be going wrong here? I honestly don't know where else to ask.

What steps will reproduce the bug?

  1. run pkg install openjdk-17
  2. download any version of papermc. I use 1.16.5.
  3. Download the latest version of XConomy.jar and place it inside the plugins folder
  4. Run the following command to start the minecraft server: java -Xmx3G -DPaper.IgnoreJavaVersion=true -jar server.jar nogui (change the first parameter to change how much ram it is allowed to use. I prefer 3GB)
  5. Watch the plugin fail to start, because of the error mentioned above.

What is the expected behavior?

No response

System information

termux-info:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=9195
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirrors.pku.edu.cn/termux/termux-main/ stable main
# x11-repo (sources.list.d/x11.list)
deb https://mirrors.pku.edu.cn/termux/termux-x11/ x11 main
Updatable packages:
abseil-cpp/stable 20230802.1 aarch64 [upgradable from: 20230125.3]
android-tools/stable 34.0.4-3 aarch64 [upgradable from: 34.0.4]
apt/stable 2.7.6 aarch64 [upgradable from: 2.7.3]
brotli/stable 1.1.0 aarch64 [upgradable from: 1.0.9-1]
c-ares/stable 1.22.1 aarch64 [upgradable from: 1.19.1]
command-not-found/stable 2.3.0-12 aarch64 [upgradable from: 2.2.0-13]
coreutils/stable 9.4 aarch64 [upgradable from: 9.3]
curl/stable 8.4.0 aarch64 [upgradable from: 8.2.1]
debianutils/stable 5.14 aarch64 [upgradable from: 5.8]
dos2unix/stable 7.5.1 aarch64 [upgradable from: 7.5.0]
dpkg/stable 1.22.1-1 aarch64 [upgradable from: 1.21.22]
ffmpeg/stable 6.1-1 aarch64 [upgradable from: 6.0-6]
freetype/stable 2.13.2 aarch64 [upgradable from: 2.13.1]
gawk/stable 5.3.0 aarch64 [upgradable from: 5.2.2]
glib/stable 2.78.1-1 aarch64 [upgradable from: 2.76.3]
harfbuzz/stable 7.3.0-1 aarch64 [upgradable from: 7.3.0]
libaom/stable 3.7.0-1 aarch64 [upgradable from: 3.6.1]
libc++/stable 26b aarch64 [upgradable from: 25c]
libcairo/stable 1.18.0 aarch64 [upgradable from: 1.17.8]
libcurl/stable 8.4.0 aarch64 [upgradable from: 8.2.1]
libdav1d/stable 1.3.0 aarch64 [upgradable from: 1.2.1]
libgmp/stable 6.3.0 aarch64 [upgradable from: 6.2.1-2]
libgnutls/stable 3.8.2 aarch64 [upgradable from: 3.8.0-1]
libicu/stable 74.1+real74.1 aarch64 [upgradable from: 73.2]
libjpeg-turbo/stable 3.0.1 aarch64 [upgradable from: 3.0.0]
libltdl/stable 2.4.7-1 aarch64 [upgradable from: 2.4.7]
liblzma/stable 5.4.5 aarch64 [upgradable from: 5.4.4]
libmpfr/stable 4.2.1 aarch64 [upgradable from: 4.2.0-p9-0]
libnghttp2/stable 1.58.0 aarch64 [upgradable from: 1.55.1]
libprotobuf/stable 2:22.4-2 aarch64 [upgradable from: 2:22.4]
libsmartcols/stable 2.39.2-1 aarch64 [upgradable from: 2.39.2]
libsrt/stable 1.5.3 aarch64 [upgradable from: 1.5.2]
libtiff/stable 4.6.0 aarch64 [upgradable from: 4.5.1-1]
libtirpc/stable 1.3.4 aarch64 [upgradable from: 1.3.3]
libunbound/stable 1.19.0 aarch64 [upgradable from: 1.17.1-2]
libuuid/stable 2.39.2-1 aarch64 [upgradable from: 2.39.2]
libvpx/stable 1:1.13.1 aarch64 [upgradable from: 1:1.13.0]
libwebp/stable 1.3.2 aarch64 [upgradable from: 1.3.1-2]
libx11/stable 1.8.7 aarch64 [upgradable from: 1.8.6]
libxcb/stable 1.16 aarch64 [upgradable from: 1.15]
libxml2/stable 2.12.1 aarch64 [upgradable from: 2.11.4-2]
libxslt/stable 1.1.39 aarch64 [upgradable from: 1.1.38-1]
lsof/stable 4.99.0 aarch64 [upgradable from: 4.98.0]
ncurses-ui-libs/stable 6.4.20231001-3 aarch64 [upgradable from: 6.4.20230527]
ncurses-utils/stable 6.4.20231001-3 aarch64 [upgradable from: 6.4.20230527]
ncurses/stable 6.4.20231001-3 aarch64 [upgradable from: 6.4.20230527]
ndk-sysroot/stable 26b aarch64 [upgradable from: 25c]
nodejs/stable 20.2.0-1 aarch64 [upgradable from: 20.2.0]
ocl-icd/stable 2.3.2 aarch64 [upgradable from: 2.3.1-3]
openssl/stable 1:3.1.4 aarch64 [upgradable from: 1:3.1.2]
procps/stable 3.3.17-5 aarch64 [upgradable from: 3.3.17-2]
proot-distro/stable 4.3.1 all [upgradable from: 3.18.1]
proot/stable 5.1.107-62 aarch64 [upgradable from: 5.1.107-60]
psmisc/stable 23.6-2 aarch64 [upgradable from: 23.6-1]
pulseaudio/stable 16.99.1-1 aarch64 [upgradable from: 16.1-4]
python-ensurepip-wheels/stable 3.11.6-1 all [upgradable from: 3.11.4-2]
python-pip/stable 23.3.1 all [upgradable from: 23.2.1]
python/stable 3.11.6-1 aarch64 [upgradable from: 3.11.4-2]
termux-am/stable 0.6.0 all [upgradable from: 0.4]
termux-tools/stable 1.39.5 all [upgradable from: 1.38.5]
unbound/stable 1.19.0 aarch64 [upgradable from: 1.17.1-2]
util-linux/stable 2.39.2-1 aarch64 [upgradable from: 2.39.2]
xkeyboard-config/x11 2.40 all [upgradable from: 2.39]
xz-utils/stable 5.4.5 aarch64 [upgradable from: 5.4.4]
termux-tools version:
1.38.5
Android version:
13
Kernel build information:
Linux localhost 5.4.210-qgki-g49ab1df3c394 #1 SMP PREEMPT Wed Oct 11 03:57:41 UTC 2023 f2fs-hash:abab6eaaf2 aarch64 Android
Device manufacturer:
Xiaomi
Device model:
2203129G
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.window versionCode:15
com.termux.widget versionCode:13
com.termux.x11 versionCode:14
com.termux.api versionCode:51
com.termux.tasker versionCode:6
com.termux.styling versionCode:30
sylirre commented 10 months ago

This is issue of your minecraft server jar file. It doesn't include .so file(s) for your CPU architecture.

Considering that it looks number of paths including /data/data/com.termux/files/usr/lib, you may try to run

pkg install libsqlite

though I won't guarantee that it would work properly (https://wiki.termux.com/wiki/Differences_from_Linux).

I'm closing this ticket as issue neither bug of openjdk-17 nor of Termux environment.