Compiling from terminal takes a long time

Feeling a bit adventurous so I wanted to try and compile a sketch from the terminal.

Followed Kaleidoscope/README.md at master · keyboardio/Kaleidoscope · GitHub almost completely. Differences were: using WSL on Windows. Directories were a little different; the git repo were under /mnt/c/Users/

Doing ‘make compile’ takes an obscene amount of time. I didn’t time it, but over an hour I would guess. Resolving libraries especially took a long time.

Well, ok, some code just takes a long time compiling… but then I ran ‘make flash’ not sure it would work with the usb/serial under WSL, but only one way to find out. It starts with the whole resolving libraries again!!! I must be doing something wrong. I shouldn’t have to wait more than an hour every time I want to compile or flash.

Any ideas?

I’m by no means an expert here, but compiling definitely didn’t take that long under native Linux. It took under 5min IIRC, certainly under 10.

This is an WSL2 issue. WSL2 has a know performance issue when working with files mounted on /mnt, for the details see this issue [wsl2] filesystem performance is much slower than wsl1 in /mnt · Issue #4197 · microsoft/WSL · GitHub
The ticket was open 4 years ago and is still not resolved!

If you want to speed up the compile time you need to clone the repo into the WSL home folder e.g.
cd ~
git clone xxxx
and then compile the firmware

If you also wants to flash the keyboard from WSL you need to look into usb passthrough for WSL, here is a link to an MS guide Connect USB devices | Microsoft Learn

Just be aware that if you are running Windows 10 it can be a bit of a hassle, supposedly it should be better under Windows 11.

If you want to compile and flash from a Windows terminal, I suggest you look into using the arduino-cli for Windows, last time I used it for compiling and flashing my keyboard, it was quite easy getting to work.

Thanks. That makes some sense. I will try that.