Building kak-lsp for Cygwin/Msys2

At work I’m using Kakoune on Msys2 (based on Cygwin).
Cygwin/Msys2 can’t run Unix binaries as-is; I’ve tried with kak-lsp.

I tried compiling kak-lsp on the Windows native Rust toolchain, and it failed (which I should have expected).
The failed crate was “daemonize”, and gave several error messages, such as error[E0433]: failed to resolve: could not find 'unix' in 'os'

The next step I plan to try is to build rust/cargo targeting the Cygwin runtime, and then see if kak-lsp will compile.

I’m very new to Rust, so I wanted to check here to see if anyone knows of a solution, before I potentially waste a bunch of time trying to figure out how to build Rust on Cygwin.


I’m about to go on the same journey. I’m trying to get kakoune lsp to work on Cygwin. Any tips?


Sorry, I haven’t figured it out yet.
AFAIK, the easiest way to use kak-lsp on Windows is to use WSL instead of Cygwin, since WSL has ABI compatibility with Linux. Then you can just use the binaries hosted on github, or use an existing rust installation (either in WSL, or native Windows cross-compiling for Linux – haven’t tried) to build kak-lsp.

If you’re set on using Cygwin, then you’ll need a way to compile rust programs with Cygwin as the target platform, because Cygwin is not ABI compatible with Linux.
AFAIK, there are two ways to go about this:

  1. Use rust within Cygwin, and hope the Linux target will end up really targeting Cygwin. Cygwin doesn’t appear to have a rust package in their repo, so you’ll have to try to build it from source. I haven’t got around to attempting that yet, so I can’t say how it’ll work out. I found this post, which may help.
  2. Edit rust’s source to make a Cygwin cross-compile target. Then build that version of rustc for windows and build kak-lsp. I have no idea how difficult or feasible this would be.

Unless you’re used to hacking rustc, I’d say number 1 sounds easier.


Installing it using WSL is exactly what I ended up doing. And you’re correct, it’s vastly easier. Thank you for the feedback. I’d considered going back and trying to get it to work on Cygwin since it’s more what I’m used to, but given what you’ve said I think you’d have to be a special kind of crazy to fight with it.

Ya, I’m using WSL now too, since my work computer just got upgraded from Win7 to Win10. Before, I had sorta given up on trying to get it to work on Cygwin.

And I’ve been promised to soon get a RHEL installation to dual boot with, and then I’ll finally be (mostly) free from Windows BS™ :smile:

I had a lot of issues with RHEL (CentOS acutally) that were related to outdated packages, and I rely on the most recent ones a lot. Useful tools like formatters, compilers, checkers are outdated there and thus work bit differently from recent versions. clang-format for instance doesn’t include some rules, which our project uses.