Fork me on GitHub
Magnus Bareid12:08:13

hey hey! i'm having a problem with Clojure Language Server trying to start up, hoping someone here might know an answer 🙂 i'm working • in VSCode • remote-ssh'ed onto a Raspberry Pi 2 • Calva extension installed on the remote (also using leiningen &amp; OpenJDK 11.0.12 on the remote; all these mirror my local computer) • Clojure language server fails to start up, with output:

[Error - 12:46:36] Connection to server is erroring. Shutting down server.
/home/pi/.vscode-server/extensions/betterthantomorrow.calva-2.0.210/clojure-lsp: 1: /home/pi/.vscode-server/extensions/betterthantomorrow.calva-2.0.210/clojure-lsp: Syntax error: ")" unexpected
• only the language server fails; repls seem to work fine! has someone here encountered this before, perhaps? my googling has yielded little thus far. i'm happy to provide more output if desired!


You are using probably a wrong clojure-lsp binary, and there is no binary for aarch64 yet :/


Feel free to open an issue on clojure-lsp asking that support

Magnus Bareid12:08:29

ah, that would explain it, indeed - thanks!

Magnus Bareid12:08:07

technically, the Raspberry Pi 2 in question here is 32bit, but i'm guessing that there's even less demand for a clojure-lsp on that architecture 😛


There is a workaround for now, download the clojure-lsp file from, which is a embedded jar, so you just need java on PATH


then on calva settings point to that downloaded clojure-lsp

Magnus Bareid12:08:42

cool! but looking at the files, it looks like it's intended for 64-bit, right? i so it would probably not work like that, would it? i mean, i can try, of course, just want to cull my expectations


that embedded jar is a java jar in a executable file, so it should work in everything that runs java fine


it's not as fast as graalvm binary, but should be enough for you

Magnus Bareid12:08:53

awesome! going ahead with attempt now


graalvm doesn't support aarch64 32 bit, only 64bit

👍 1
Magnus Bareid13:08:07

oh, so basically, Calva's language server implementation relies specifically on graal?


Calva language server implementation = it generates native binaries for most used OS


Windows, Linux, MacOS ATM, if you don't use any of these, the embedded jar is the fallback

Magnus Bareid13:08:19

so, i've put both the clojure-lsp.jar into the folder where Calva expected to find it (and also its companion clojure-lsp binary file, just to be sure) then i have set the remote vscode's setting "calva.clojureLspPath": "~/.vscode-server/extensions/betterthantomorrow.calva-2.0.210/clojure-lsp.jar" , and i also previously have made sure that the system's path has a JAVA_HOME pointing to OpenJDK's java binary but still, it doesn't work :thinking_face: did i miss something?


you don't need the clojure-lsp.jar, the clojure-lsp one already has the jar embedded in the file.

Magnus Bareid13:08:17

right, i also tried using that in the settings, as well


you should set to somthing like: "calva.clojureLspPath": "/path/to/clojure-lsp"


can you try running clojure-lsp --version with tthat downloaded binary and check if it's working?

Magnus Bareid13:08:44

yeah, already tried that^ 😕

[Error - 14:39:39] Starting client failed
Launching server using command ~/.vscode-server/extensions/betterthantomorrow.calva-2.0.210/clojure-lsp failed.
and clojure-lsp --version only yields bash: clojure-lsp: command not found but if the binary is somehow made with graalvm, which requires 64-bit architecture- it would make sense that clojure-lsp can't function properly on a 32-bit system anyway, even with its jarfile included


why is this even a binary and not just a jar file?


for clj-kondo I offer an LSP server as a .jar file

Magnus Bareid13:08:43

that's what came with the vscode extension, so i've tried to use both, one at a time

Magnus Bareid13:08:56

calva, specifically


the vscode extension for clj-kondo should work independently from calva, it just uses java


but lsp is recommended of course


you could maybe download the jar file and then make a bash script which does java -jar the-jar.jar and then set that as the "lsp binary"

Magnus Bareid13:08:08

yeah, when i downloaded the source code of the binaries mentioned up above (simply called "clojure-lsp"), i saw that it even uses clj-kondo


#!/usr/env/bin bash java -jar the-jar.jar


the clojure-lsp from the releases, is a embedded jar, which means is a executable that calls a java -jar on its file, is just a easy way for you to doesn't need to java -jar


or you can download clojure-lsp.jar and do the java -jar yourself

Magnus Bareid13:08:50

then i noticed that you were the author of clj-kondo (@U04V15CAJ), so that was cool 😉 wouldn't it be easier, though, if i somehow just disabled Calva's lsp? and used clj-kondo instead?


is just that before graalvm everyone was using the clojure-lsp one as it's easy as ./clojure-lsp and you just need java installed


> if i somehow just disabled Calva's lsp? You will lose a lot of features, not sure it's possible as well on Calva


@UKFSJSM38 the bash script suggestion + downloaded jar should work right?

yes 1

perhaps this can be documented as a last resort option


> and `clojure-lsp --version` only yields > bash: clojure-lsp: command not found Is this the output of the downloaded clojure-lsp from the releases page?

Magnus Bareid13:08:37

hang on, i might have derped about which terminal/folder i was in when i tried that


yeah, this was never a issue since it's pretty simple 😅 but we can if is not clear

Magnus Bareid14:08:07

^ no, i was right, while in bash in the correct folder; i either get error from bash for alias not existing or permission denied if i try to run it as an executable


@UKFSJSM38 that's not what I meant


@U02AQ7MGEQ1 the docs say to chmod +x the downloaded clojure-lsp to avoid the permission error


a user should just be able to write a bash script and use the normal jar, no weird shit with embedded stuff, as that's what's likely causing the trouble


I agree if that is causing the issue, but I never saw an issue with the clojure-lsp embedded jar


have you ever tested it on aarch64 though?

Magnus Bareid14:08:03

regarding "place it in your $PATH with chmod 755"; do they mean to edit the /etc/environment file with sudo, or ... ?

Magnus Bareid14:08:26

however, the chmod +x (thanks for reminding me!) made the file executable, and so we got this instead


so it worked, but clojure-lsp jar uses 2G of ram


not enough for your device it seems :/

Magnus Bareid14:08:18

hahaha, i should have known!

Magnus Bareid14:08:37

ahhh, that's actually extremely funny to our project


that amount of memory is only needed for initial analysis though I think?


could it be less when the batch-size is less?


we already tried decreasing that without success even with the batch size

Magnus Bareid14:08:04

having discussed arm32 vs arm64 multiple times over and over, because graalvm was very attractive (but now apparently also the increased memory on each of the corresponding alternatives) could be attractive as well


I'm open to suggestions though

Magnus Bareid14:08:01

hey, crazy thought - could i use my local VSCode's resources to run the lsp, even though the codebase is on the remote?


I think the extensions always run on the remote machine


if you're using the ssh thing


but it's worth a try


what you could also do is open your project locally, but connect to a REPL on the machine


don't use the jack-in stuff


open the REPL on the machine and then connect to a remote running REPL from your local editor

☝️ 1

CIDER also has some stuff to translate remote paths to local paths


check their docs

Magnus Bareid14:08:25

thanks, it's worth a try indeed! :)