Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.UnsatisfiedLinkError when setting language #33

Open
PawanKartikS opened this issue Feb 25, 2024 · 2 comments
Open

java.lang.UnsatisfiedLinkError when setting language #33

PawanKartikS opened this issue Feb 25, 2024 · 2 comments

Comments

@PawanKartikS
Copy link

I was able to successfully build the dynamic library using:
./build.py -o libjava-tree-sitter ../tree-sitter-c-sharp-master.

I'm also able to load the library successfully. However, when I try to set the language to C# via parser.setLanguage(Languages.cSharp()), I get a linkage error:

Exception in thread "sbt-bg-threads-1" java.lang.UnsatisfiedLinkError: 'long ai.serenade.treesitter.Languages.cSharp()'
	at ai.serenade.treesitter.Languages.cSharp(Native Method)
	at astute.Main$package$.main(Main.scala:11)
	at astute.main.main(Main.scala:7)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at sbt.Run.invokeMain(Run.scala:144)
	at sbt.Run.execute$1(Run.scala:94)
	at sbt.Run.$anonfun$runWithLoader$5(Run.scala:121)
	at sbt.Run$.executeSuccess(Run.scala:187)
	at sbt.Run.runWithLoader(Run.scala:121)
	at sbt.Defaults$.$anonfun$bgRunTask$6(Defaults.scala:1988)
	at sbt.Defaults$.$anonfun$termWrapper$2(Defaults.scala:1927)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at scala.util.Try$.apply(Try.scala:213)
	at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:367)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

I was wondering if I could receive some help. And for note, I'm performing the above steps on an M1 Mac and yes, I did take a look at the in-progress PR. It was that PR that helped me successfully build the dynamic library.

@sogaiu
Copy link

sogaiu commented Feb 25, 2024

Sorry that this response is not an answer to your question.

I think it's worth considering the content starting here that mention a few other efforts toward using tree-sitter from Java (including a fork of this repository that might have the issue addressed).

@PawanKartikS
Copy link
Author

PawanKartikS commented Mar 2, 2024

I've tried what you've suggested and now I seem to be getting SIGSEGV when loading in the library:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001046f630c, pid=45986, tid=57199
#
# JRE version: Java(TM) SE Runtime Environment Oracle GraalVM 21.0.2+13.1 (21.0.2+13) (build 21.0.2+13-LTS-jvmci-23.1-b30)
# Java VM: Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.2+13.1 (21.0.2+13-LTS-jvmci-23.1-b30, mixed mode, sharing, tiered, jvmci, jvmci compiler, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# V  [libjvm.dylib+0x54e30c]  jni_GetFieldID+0x148
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

Edit: I've opened an issue here: seart-group/java-tree-sitter#138.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants