scalacenter/bloop

IntelliJ - Sync Project - Can't load library

ranjitparva opened this issue · 9 comments

When I import the project the BSP sync fails with the following error

Starting the bsp launcher for bloop...

Opening a bsp server connection with 'bsp --protocol local --socket /var/folders/gk/qf77krkn0bzc8m9m694958km0000gn/T/bsp-launcher11793630431449622287/bsp.socket'...

Waiting for the bsp connection to come up...

[D] Waiting for a connection at local:///var/folders/gk/qf77krkn0bzc8m9m694958km0000gn/T/bsp-launcher11793630431449622287/bsp.socket...

The server is listening for incoming connections at local:///var/folders/gk/qf77krkn0bzc8m9m694958km0000gn/T/bsp-launcher11793630431449622287/bsp.socket...

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/gk/qf77krkn0bzc8m9m694958km0000gn/T/jna-715116677/jna793465489257984715.tmp

	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2633)

	at java.base/java.lang.Runtime.load0(Runtime.java:768)

	at java.base/java.lang.System.load(System.java:1837)

	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947)

	at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922)

	at com.sun.jna.Native.<clinit>(Native.java:190)

	at bloop.sockets.UnixDomainSocketLibrary.<clinit>(UnixDomainSocketLibrary.java:123)

	at bloop.sockets.UnixDomainSocket.<init>(UnixDomainSocket.java:51)

	at bloop.launcher.bsp.BspBridge.$anonfun$connectToOpenSession$1(BspBridge.scala:161)

	at scala.util.Try$.apply(Try.scala:213)

	at bloop.launcher.bsp.BspBridge.establishSocketConnection$1(BspBridge.scala:158)

	at bloop.launcher.bsp.BspBridge.connectToOpenSession(BspBridge.scala:166)

	at bloop.launcher.LauncherMain.openBspSocket$1(Launcher.scala:137)

	at bloop.launcher.LauncherMain.connectToBloopBspServer(Launcher.scala:167)

	at bloop.launcher.LauncherMain.runLauncher(Launcher.scala:100)

	at bloop.launcher.LauncherMain.cli(Launcher.scala:79)

	at bloop.launcher.LauncherMain.main(Launcher.scala:56)

	at bloop.launcher.Launcher.main(Launcher.scala)

Scala Version: 3.1.3
Gradle Bloop Version: gradle-bloop_2.13:1.5.4
Blop CLI version: 1.5.4
Java version: 1.8
System: Mac M1

Thanks for reporting! What is the java version and system that you are using?

Updated the comment

I tried vscode with scala metals plugin and everything works as expected. I really wish bloop works for intellij.

This looks like the JRE is only used for starting Bloop. Maybe you could adjust the project settings? Could you maybe raise an issue on jetbrains issue tracker?

Does it connect to Bloop from intellij when Bloop was already started by metals or via cli?

I started Bloop service using CLI and did the import in IntelliJ. Should I try killing the server and just doing a sync?

Looks like the bloop server runs on Java 11 while my project uses 1.8

bloop v1.5.4

Using Scala v2.12.15 and Zinc v1.6.0
Running on Java JDK v11.0.16.1 (/Users/parva/.asdf/installs/java/zulu-11.58.23/zulu-11.jdk/Contents/Home)
  -> Supports debugging user code, Java Debug Interface (JDI) is available.
Maintained by the Scala Center and the community.

You can specify the Bloop jvm to use in ~/.bloop/bloop.json, if it was run with metals then it would do it automatically based on the Metals java version.

I switched to VS code and much happier. Thanks for your help.

Actually made it work by downloading JDK from Amazon Semeru-1.8.