Support compile static linux with GraalVM

オープン
#584 コメント 15 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
20/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java, sqlite
領域
backend, databases

調査の方向性

Start with the linked native library directory, src/main/resources/org/sqlite/native/Linux/x86_64, and the GraalVM compile example linked in the issue. Investigate how that Linux library is built and why the static binary cannot load it; the issue gives a runtime error but no build steps or test to run. Done means a statically compiled Linux binary can load sqlite-jdbc and open a connection.

索引モデルが issue の本文から書いたものです。

説明

enhancement:build

ref

@xerial I could make my Clojure app using sqlite compile with Graalvm for Windows/Linux/MacOS successfully here, but when compiling a Linux static binary, it doesn't work, it seems that the shipped sqlite lib is not static linked, but dynamic linked.
Running the static binary I get:

Failed to load native library:sqlite-unknown-5db626ec-518e-4fc0-a5f6-a21818a0c5c8-libsqlitejdbc.so. osinfo: Linux/x86_64
java.lang.UnsatisfiedLinkError: Can't load library: /tmp/sqlite-unknown-5db626ec-518e-4fc0-a5f6-a21818a0c5c8-libsqlitejdbc.so
Exception in thread "main" java.sql.SQLException: Error opening connection
        at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:239)
        at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:61)
        at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
        at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:21)
        at org.sqlite.JDBC.createConnection(JDBC.java:115)
        at org.sqlite.JDBC.connect(JDBC.java:90)
        at java.sql.DriverManager.getConnection(DriverManager.java:677)
        at java.sql.DriverManager.getConnection(DriverManager.java:189)
        at next.jdbc.connection$get_driver_connection.invokeStatic(connection.clj:141)
        at next.jdbc.connection$url_PLUS_etc$reify__747.getConnection(connection.clj:357)
        at next.jdbc.connection$make_connection.invokeStatic(connection.clj:385)
        at next.jdbc.connection$fn__760.invokeStatic(connection.clj:406)
        at next.jdbc.connection$fn__760.invoke(connection.clj:406)
        at next.jdbc.protocols$fn__563$G__558__570.invoke(protocols.clj:24)
        at next.jdbc.connection$fn__764.invokeStatic(connection.clj:415)
        at next.jdbc.connection$fn__764.invoke(connection.clj:406)
        at next.jdbc.protocols$fn__563$G__558__570.invoke(protocols.clj:24)
        at next.jdbc$get_connection.invokeStatic(jdbc.clj:155)
        at sqlite_graalvm_sample.core$insert.invokeStatic(core.clj:15)
        at sqlite_graalvm_sample.core$_main.invokeStatic(core.clj:36)
        at sqlite_graalvm_sample.core$_main.doInvoke(core.clj:36)
        at clojure.lang.RestFn.invoke(RestFn.java:397)
        at clojure.lang.AFn.applyToHelper(AFn.java:152)
        at clojure.lang.RestFn.applyTo(RestFn.java:132)
        at sqlite_graalvm_sample.core.main(Unknown Source)
Caused by: java.lang.Exception: No native library found for os.name=Linux, os.arch=x86_64, paths=[/org/sqlite/native/Linux/x86_64]
        at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:367)
        at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:67)
        at org.sqlite.core.NativeDB.load(NativeDB.java:63)
        at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:235)
        ... 24 more

Is that possible to build this lib statically to make that work?

主要言語
Java
スター
3.3k
フォーク
676
平均マージ
1日 15時間
マージ済み PR(30日)
18

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

xerial/sqlite-jdbc のほかの issue

xerial/sqlite-jdbc の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。