This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-27
Channels
- # announcements (13)
- # babashka (59)
- # beginners (58)
- # bitcoin (3)
- # calva (7)
- # cider (2)
- # cljsrn (4)
- # clojure (41)
- # clojure-dev (18)
- # clojure-germany (1)
- # clojurescript (14)
- # conjure (7)
- # cursive (5)
- # datahike (1)
- # graalvm (44)
- # jobs-discuss (3)
- # kaocha (19)
- # lsp (109)
- # luminus (3)
- # off-topic (8)
- # pathom (32)
- # re-frame (4)
- # reveal (3)
- # shadow-cljs (16)
- # spacemacs (5)
- # sql (18)
- # vim (13)
I'll doing a POC on clojure-lsp
to use datalevin
, it worked really well, but having issues compiling the clojure-lsp native-image, should I manually compile the datalevin/native/src
libs manually? I thought we could have the libs compiled in the classpath just like https://github.com/xerial/sqlite-jdbc/blob/master/src/main/resources/org/sqlite/native/Linux/x86_64/libsqlitejdbc.so
Otherwise should I need to compile it like https://github.com/juji-io/datalevin/blob/master/native/script/compile#L19-L21 besides the need to install liblmdb-dev
?
I mean, I can copy the c files to clojure-lsp, manually gcc them during CI but it seems odd to me, it'd be great to have those libs from datalevin somehow
com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine PosixJavaThreads.java: 192
com.oracle.svm.core.thread.JavaThreads.threadStartRoutine JavaThreads.java: 519
java.lang.Thread.run Thread.java: 834
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 628
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1128
java.util.concurrent.FutureTask.run FutureTask.java: 264
java.util.concurrent.Executors$RunnableAdapter.call Executors.java: 515
org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run ConcurrentMessageProcessor.java: 113
org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen StreamMessageProducer.java: 94
org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage StreamMessageProducer.java: 194
org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume RemoteEndpoint.java: 190
org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest RemoteEndpoint.java: 261
org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request GenericEndpoint.java: 120
org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0 GenericEndpoint.java: 65
...
clojure_lsp.main.proxy$clojure_lsp.ClojureExtensions$LanguageServer$c8d5825a.initialize
clojure-lsp.main/fn/fn main.clj: 288
...
clojure-lsp.handlers/initialize handlers.clj: 39
clojure-lsp.crawler/initialize-project crawler.clj: 197
clojure-lsp.crawler/analyze-project crawler.clj: 192
clojure-lsp.crawler/analyze-classpath crawler.clj: 170
clojure-lsp.db/read-deps db.clj: 39
clojure-lsp.db/make-db db.clj: 25
datalevin.lmdb/open-lmdb lmdb.clj: 841
datalevin.lmdb/open-lmdb lmdb.clj: 851
org.lmdbjava.Env$Builder.open Env.java: 512
org.lmdbjava.Env$Builder.open Env.java: 486
org.lmdbjava.Library$Lmdb$jnr$ffi$0.mdb_env_create
com.kenai.jffi.Invoker.invokeN1 Invoker.java: 997
com.kenai.jffi.Foreign.invokeN1O1 Foreign.java
com.oracle.svm.jni.JNIGeneratedMethodSupport.nativeCallAddress JNIGeneratedMethodSupport.java: 57
com.oracle.svm.jni.access.JNINativeLinkage.getOrFindEntryPoint JNINativeLinkage.java: 153
java.lang.UnsatisfiedLinkError: com.kenai.jffi.Foreign.invokeN1O1(JJJLjava/lang/Object;III)J [symbol: Java_com_kenai_jffi_Foreign_invokeN1O1 or Java_com_kenai_jffi_Foreign_invokeN1O1__JJJLjava_lang_Object_2III]
That error indicate thats you are not compiling the native version of Datalevin, you are compiling the Java version that use JNR
The decision on which version to use is made in Datalevin using a multimethod, which check whether or not it is running inside a GraalVM image. Even at the image build time, the code should be in GraalVM image so the native binding should be chosen, but somehow, yours is running in regular Java mode
Maybe point me to your repo so I can take a look at how you are compiling native image?
you are depending on datalevin 0.3.17, which is the release before the work on native compilation, of course it won’t work
I am going to release v0.4.0 today, as I just finished the native command line shell for datalevin
i am new to this business of releasing native code, so allow me sometime to get up to speed
Thanks for the help @U0A74MRCJ, with your PR merged I'm getting a
java.lang.IllegalArgumentException: No method in multimethod 'open-kv' for dispatch value: :graal
it looks to me that the graal version of the LMDB binding is not compiled in, did you include datalevin’s reflect-config.json?
ldd ./clojure-lsp linux-vdso.so.1 (0x00007ffcc5ff9000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f57728c4000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f57728a1000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f577289b000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f577287f000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f577268d000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f577253e000) /lib64/ld-linux-x86-64.so.2 (0x00007f57790e9000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5772521000)
WARNING: Could not resolve datalevin.binding.graal.LMDB for reflection configuration. Reason: java.lang.ClassNotFoundException: datalevin.binding.graal.LMDB.
BTW i'm having the same issue with a JVM version, not graal one but the defmethod warn about the :java
one
> WARNING: Could not resolve datalevin.binding.graal.LMDB for reflection configuration. Reason: java.lang.ClassNotFoundException: datalevin.binding.graal.LMDB. I had this one too
But right now the issue seems to be the defmethod not recognizing the defmulti implementations
Thanks for the help @U0A74MRCJ,the issue is fixed and it seems to work properly 🙂
I just needed to add the require [datalevin.binding.graal]
as well.
But probably clojure-lsp will follow a simpler way persisting the db with spit
as we just need to persist things and read on time when clojure-lsp initializes.
Anyway, thanks for helping on this POC, datalevin seems really cool!