Fork me on GitHub

I was trying to make SQLITE to work inside my native build, but I had no luck. First, I noticed that I was missing some JNI support and then I created this file:

[ {
    "name" : "org.sqlite.core.DB",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.core.DB$ProgressObserver",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.core.NativeDB",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.BusyHandler",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.Function",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.Function$Aggregate",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.Function$Window",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "java.lang.Throwable",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.ProgressHandler",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true


I was including each class that was raised as error when I tried to execute my code


following this approach, as the error was changing, I thought I was making progress.. but the last error msg I got was this one:


[ [ SubstrateSegfaultHandler caught signal 11 ] ]

General Purpose Register Set Values: 

  RAX 000055988aad3000
  RBX 0000000000000005
  RCX 0000000000000006
  RDX 0000000000000000
  RBP 000055988cb90eb0
  RSI 000000030097f298
  RDI 000055988cb90eb0
  RSP 00007fff9dd8b318
  R8 0000000000000026
  R9 0000000000000010
  R10 00007f43ef2cb368
  R11 0000559889ce3a10
  R12 0000000000000004
  R13 0000000000000046
  R14 000055988aad3000
  R15 000055988cb90eb0
  EFL 0000000000010206
  RIP 0000000000962eae

JavaFrameAnchor dump:

  Anchor 00007fff9dd8b3b0 LastJavaSP 00007fff9dd8b360 LastJavaIP 000055988a5e21d4
TopFrame info:

  Does not look like a Java Frame. Use JavaFrameAnchors to find LastJavaSP:
  Found matching Anchor:00007fff9dd8b3b0
  LastJavaSP 00007fff9dd8b360
  LastJavaIP 000055988a5e21d4
VMThreads info:

  VMThread 00007f43e8000b60  STATUS_IN_NATIVE  java.lang.Thread@0x7f43f4cb7cd8
  VMThread 00007f43f0000b60  STATUS_IN_NATIVE  java.lang.Thread@0x7f43f5e03398
  VMThread 000055988cb90eb0  STATUS_IN_JAVA (safepoints disabled)  java.lang.Thread@0x55988c20b950
VM Thread State for current thread 000055988cb90eb0:

  0 (8 bytes): = (bytes) 
    000055988cb90eb0: 000055988b44a210
  8 (32 bytes): = (bytes) 
    000055988cb90eb8: 00007f43ef200000 00007f43ef300000
    000055988cb90ec8: 00007f43ef2cb398 00007f43f537e000
  40 (8 bytes): = (Object) null
  48 (8 bytes): = (Object) java.util.SplittableRandom  00007f43f50e7fc0
  56 (8 bytes): = (Object) null
  64 (8 bytes): = (Object) java.lang.Thread  000055988c20b950
  72 (8 bytes): = (Object) null
  80 (8 bytes): = (Object)  00007f43f5e01520
  88 (8 bytes): = (Object) java.lang.NoSuchMethodError  00007f43ef2c8e38
  96 (8 bytes): = (Object) null
  104 (8 bytes): = (Object) null
  112 (8 bytes): = (Word) 0  0000000000000000
  120 (8 bytes): = (Word) 140735833272320  00007fff9d597000
  128 (8 bytes): = (Word) 140735841612720  00007fff9dd8b3b0
  136 (8 bytes): = (Word) 94113649995776  000055988aad3000
  144 (8 bytes): = (Word) 139929890987264  00007f43f7721d00
  152 (8 bytes): = (Word) 139929890987264  00007f43f7721d00
  160 (8 bytes): = (Word) 0  0000000000000000
  168 (4 bytes): = (int) 1  00000001
  172 (4 bytes): = (int) 0  00000000
  176 (4 bytes): = (int) 2125651433  7eb2dde9
  180 (4 bytes): = (int) 0  00000000
  184 (4 bytes):$StatusSupport.safepointsDisabledTL = (int) 1  00000001
  188 (4 bytes):$StatusSupport.statusTL = (int) 1  00000001
VMOperation dump:

  No VMOperation in progress
Dump Counters:

Raw Stacktrace:

  00007fff9dd8b318: 00007f43eef31d8e 0000001000000001
  00007fff9dd8b328: 000055988b23f360 000000000097f298
  00007fff9dd8b338: 0000000001738950 000000000000002a
  00007fff9dd8b348: 000055988a5e21d4 00007fff9dd8b3b0
  00007fff9dd8b358: 000055988a5e21ea 0000000000000024
  00007fff9dd8b368: 000055988a152efd 000055988aad3000
  00007fff9dd8b378: 00007f43ef2c5e10 00007f43ef2c5ca0
  00007fff9dd8b388: 0000000000000005 0000000000000004
  00007fff9dd8b398: 000055988cb90eb0 00007f43eef31d5a
  00007fff9dd8b3a8: 0000004600000001 000055988a5e21d4
  00007fff9dd8b3b8: 00007fff9dd8b360 0000000000000000
  00007fff9dd8b3c8: 000055988a5e2097 000000028b23c3a8
  00007fff9dd8b3d8: 0000559889bd7222 00007f43ef2c5ca0
  00007fff9dd8b3e8: 00007f43ef2b81c8 00000046ef2c5ca0
  00007fff9dd8b3f8: 000055988a5e0d5e 00007f43ef2b8238
  00007fff9dd8b408: 000055988b2699c0 000000018b268bb0
  00007fff9dd8b418: 000055988a5e616e 00007f43ef2b81c8
  00007fff9dd8b428: 00007f43ef2c5ca0 000000468b2488c0
  00007fff9dd8b438: 000055988a5d4b30 0000000000000010
  00007fff9dd8b448: 000055988a1580a1 0000000000000026
  00007fff9dd8b458: 00007f43ef2b48c0 00007f43ef2b82c0
  00007fff9dd8b468: 00007f43ef2b8238 00007f43ef2b4a60
  00007fff9dd8b478: 00007f43ef2c5ca0 00007f43ef2b81c8
  00007fff9dd8b488: 00007f43ef2b4248 00007f43ef2b48a8
  00007fff9dd8b498: 00007f43ef2a1618 3f400000ef2b48a8
  00007fff9dd8b4a8: 000055988a5d216f 0000000c00000012
  00007fff9dd8b4b8: 000055988a15789b 00000000ef2b47f0
  00007fff9dd8b4c8: 000055988a5cfeea 00007f43ef2b48a8
  00007fff9dd8b4d8: 00007f43ef2a1618 00007f43ef2b48f8
  00007fff9dd8b4e8: 000055988a5cfe00 000000028b5482f0
  00007fff9dd8b4f8: 00007f43ef2b48f8 00007f43ef2a1618
  00007fff9dd8b508: 00007f43ef2b4248 00007f43ef2a1618
  00007fff9dd8b518: 000055988a2ab7c4 0000559889c36b30
  00007fff9dd8b528: 000055988c1e8c68 00007fff9dd8b538
  00007fff9dd8b538: 00007f43ef2b4848 000055988b24b168
  00007fff9dd8b548: 00007f43ef2b4790 000055988c20ed18
  00007fff9dd8b558: 000055988b420f58 000055988b42ee90
  00007fff9dd8b568: 000055988b2f1de0 000055988b430630
  00007fff9dd8b578: 000055988c20a9c0 00007f43ef2b4248
  00007fff9dd8b588: 00007f43ef2a1618 000000018c2ace10
  00007fff9dd8b598: 000055988a2aafa6 000055988c2acdc0
  00007fff9dd8b5a8: 00007f43ef2b4248 000055988c207290
  00007fff9dd8b5b8: 00007f43ef2b4248 00007f43ef2a1618
  00007fff9dd8b5c8: 000055988a5a352d 000055988b425948
  00007fff9dd8b5d8: 000055988c2ad068 00007f43ef2b4248
  00007fff9dd8b5e8: 000055988c207290 00007f43ef2a1618
  00007fff9dd8b5f8: 000055988a5a69fe 000000018aad3080
  00007fff9dd8b608: 0000559889ac97cd 000055988aad3000
  00007fff9dd8b618: 000055988a5a35f6 000055988b5482f0
  00007fff9dd8b628: 000055988c2acd78 000055988c2ad068
  00007fff9dd8b638: 00000000017d9d78 000055988c207290
  00007fff9dd8b648: 000055988a5a315f 000055988b2673d0
  00007fff9dd8b658: 00007f43ef2a17e8 000055988c214950
  00007fff9dd8b668: 000055988a5aa282 000055988b425948
  00007fff9dd8b678: 000055988c2aecf0 000055988c207290
  00007fff9dd8b688: 00007f43ef2a17e8 000055988c214950
  00007fff9dd8b698: 000055988a5c25b4 000055988b2c1ce8
  00007fff9dd8b6a8: 000055988b2c08c0 000055988c207290
  00007fff9dd8b6b8: 00007f43ef2a1618 000055988c207290
  00007fff9dd8b6c8: 00007f43ef282aa0 000055988c2aecf0
  00007fff9dd8b6d8: 000055988a5c24d2 00007f43ef2ac2d0
  00007fff9dd8b6e8: 000055988c2aea48 000055988b267560
  00007fff9dd8b6f8: 00007f43ef2a17e8 000055988c214910
  00007fff9dd8b708: 000055988a5ab3f1 000055988b425948
Stacktrace Stage0:

  Segmentation fault (core dumped)


I have no previous experience with java, can you help me understand what is happening?


@iagwanderson I've tried this before, but I've had no luck with this. There might be a couple of issues mentioning sqlite at the graalvm repo


do you know other alternative for database that is current supported?


my cli is basically a inventory management for my personal books šŸ˜ƒ


I need some form of storage


@iagwanderson for clj-kondo I just use transit files to store data


but you can also shell out to the sqlite cli


oh yes, I like the idea of using shell to do that


I'm sorry, I don't know clj-kondo that much, but what kind of data are you storing?


in transit files


you can even write this in babashka as you can see, no need for intermediate GraalVM compilation and still fast


in clj-kondo I'm storing var information like arities


I see, I have some relationships within my data. I think babashka and sqlite will save me here o/


as I said before, my java experience is very limited, what are the main pain points that make native builds has so many edge cases?


it's not a trivial problem to solve I guess


I imagine, never had seem a seg fault while working with clojure


remembered my fortran jobs in 2012 =P


Iā€™m sorry did you mean 1972? šŸ˜…


hahaha I wish! Academic projects are full of this guy still

šŸ˜• 4