Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to and GraalVM slack:
Huahai 2021-02-28T04:51:12.027300Z

That error indicate thats you are not compiling the native version of Datalevin, you are compiling the Java version that use JNR

Huahai 2021-02-28T04:51:57.027500Z

Native Datalevin does not use JNI at all, it uses the GraalVM SDK C API

Huahai 2021-02-28T04:57:14.027800Z

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

Huahai 2021-02-28T05:00:52.028Z

Maybe point me to your repo so I can take a look at how you are compiling native image?

Huahai 2021-02-28T05:06:32.028200Z

ok, i found your datalevin branch

Huahai 2021-02-28T05:07:32.028400Z

you are depending on datalevin 0.3.17, which is the release before the work on native compilation, of course it won’t work

Huahai 2021-02-28T05:08:55.028600Z

I am going to release v0.4.0 today, as I just finished the native command line shell for datalevin

Huahai 2021-02-28T05:09:21.028800Z

v0.4.0 should work

Huahai 2021-02-28T06:23:13.029Z

also, you are right, i should bundle the dtlv.a in the library

Huahai 2021-02-28T06:25:34.029200Z

i am new to this business of releasing native code, so allow me sometime to get up to speed

Huahai 2021-02-28T06:58:08.029400Z

Created PR

Huahai 2021-02-28T06:58:24.029700Z

It compiles to native just fine.

ericdallo 2021-02-28T12:46:19.029900Z

Oh that was fast haha! I'm new too don't worry ;)

ericdallo 2021-02-28T12:46:25.030100Z

Thank you for the quick response

ericdallo 2021-02-28T12:46:56.030300Z

I'll test it with the 0.4.0 as soon you release it, excited for that!

ericdallo 2021-02-28T13:25:41.030500Z

Thanks for the help @huahaiy, with your PR merged I'm getting a

java.lang.IllegalArgumentException: No method in multimethod 'open-kv' for dispatch value: :graal

ericdallo 2021-02-28T13:33:36.030700Z

Does the key-value store lmdb work with graal?

Huahai 2021-02-28T16:11:53.030900Z

you mean when you run the binary?

Huahai 2021-02-28T16:17:38.031100Z

it looks to me that the graal version of the LMDB binding is not compiled in, did you include datalevin’s reflect-config.json?

Huahai 2021-02-28T16:24:07.031300Z

ldd ./clojure-lsp (0x00007ffcc5ff9000) => /usr/lib/x86_64-linux-gnu/ (0x00007f57728c4000) => /lib/x86_64-linux-gnu/ (0x00007f57728a1000) => /lib/x86_64-linux-gnu/ (0x00007f577289b000) => /lib/x86_64-linux-gnu/ (0x00007f577287f000) => /lib/x86_64-linux-gnu/ (0x00007f577268d000) => /lib/x86_64-linux-gnu/ (0x00007f577253e000) /lib64/ (0x00007f57790e9000) => /lib/x86_64-linux-gnu/ (0x00007f5772521000)

Huahai 2021-02-28T16:24:40.031500Z

so is missing

ericdallo 2021-02-28T16:34:41.031700Z

Yes, I merged the reflect-config json with datalevin one

Huahai 2021-02-28T16:34:44.031900Z

ok, had this warning, so the release jar doesn’t include graal version

Huahai 2021-02-28T16:34:45.032100Z

WARNING: Could not resolve datalevin.binding.graal.LMDB for reflection configuration. Reason: java.lang.ClassNotFoundException: datalevin.binding.graal.LMDB.

ericdallo 2021-02-28T16:35:09.032300Z

BTW i'm having the same issue with a JVM version, not graal one but the defmethod warn about the :java one

Huahai 2021-02-28T16:35:11.032500Z

let me figure out how to include that jar

Huahai 2021-02-28T16:35:36.032800Z


ericdallo 2021-02-28T16:35:59.033Z

ericdallo 2021-02-28T16:36:55.033200Z

> WARNING: Could not resolve datalevin.binding.graal.LMDB for reflection configuration. Reason: java.lang.ClassNotFoundException: datalevin.binding.graal.LMDB. I had this one too

ericdallo 2021-02-28T16:37:28.033400Z

But right now the issue seems to be the defmethod not recognizing the defmulti implementations

Huahai 2021-02-28T16:38:30.033600Z

i think i know what’s wrong, hold on, let me fix it

Huahai 2021-02-28T17:18:23.033900Z

please test the updated PR, i tested locally, it seems to include now

ericdallo 2021-02-28T17:19:43.034100Z

Alright, testing it

ericdallo 2021-02-28T18:44:32.034300Z

Thanks for the help @huahaiy,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!

Huahai 2021-02-28T19:44:14.034500Z

Thanks for trying it out. You gave me some ideas on how to improve the packaging

ericdallo 2021-02-28T19:49:22.034700Z

Glad to hear 😄