r/neovim•
Datsoon

Compiling treesitter parsers on wsl?

I have never worked in C, C++, or lua, so I'm way out of my element here, but I'm trying to get the treesitter parsers compiled and working on windows. I know there's some discussion about this on GitHub, but the pre-compiled parser artifacts from the old PR have expired.

I have treesitter working very well in my wsl install. Is there any way to compile the parsers on wsl for use in my windows install of neovim? I don't have admin rights on the windows box, but do have wsl privileges and root access in my wsl distros, so I can get whatever compilers I need in wsl.

Posted Jan 5, 2021, 10:03 PM UTC

37
thaHamsta•

WSL will compile Linux binaries. I just retriggered the pipeline of the PR you are referring to: https://github.com/nvim-treesitter/nvim-treesitter/actions/runs/464589381 It successfully compiled all Windows parsers. Let's hope it also produces artifacts.

Installation on Windows should be fairly easy. I would recommend to do it on a machine where you have privilege or to use github CI.

​

Edit: the artifacts https://github.com/nvim-treesitter/nvim-treesitter/suites/1773723159/artifacts/33869169 (Linux and Windows still work)

5
DatsoonOP•

Awesome, thank you! I will copy those over.

I tried building them on a machine where I had admin rights with plans to copy them over, but I must have messed something up. I ran the TSInstall command in nvim from "x86 Native Tools Command Prompt for VS 2019" where clang was available, with the require nvim-treesitter.install'.compilers = { "clang" } in my config. The parsers built successfully, but still produced "not a win32 application" errors.

I swear I had the parsers working once using this method after trying some magic combination of install and reboots, but then parsers installed after that didn't work, and I TSUninstall alled to try and reproduce the magic for all the parsers, but no dice. Like I said, I'm out of my element here.

1
DatsoonOP•

Welp, even the artifacts from your build aren't working on my machine. Same "not a valid win32 application" errors. Not sure what's different with my machine.

1
thaHamsta•

They are compiled using gcc. I can try a again using clang.

2
thaHamsta•

Please also make sure there are no other file (maybe hidden) files in that folder. I had a similar issue once were I copied an additional file in that folder. If you feel lucky you can try the compiled parsers again. They should be compiled now with clang.

2
DatsoonOP•

I downloaded and installed LLVM and used that to compile them instead of the clang available in the native tools for vs2019 command prompt. That appeared to work. Not sure what the difference between clang in the LLVM package and the vs2019 stuff, though.

1
lucastrvsn•

I don't know if it is even possible

1