libwebsockets
Lightweight C library for HTML5 websockets
|
This was how I compiled libwebsockets starting from a blank windows install in June 2025. Doing this on a linux distro is way simpler and quicker than all this!
For building you'll need 40GB+ available for the guest storage.
Assuming like me the first thing you do with a new laptop is install Linux over the windows it came with, you can recover your 'windows tax' windows product key from your device typically using sudo strings /sys/firmware/acpi/tables/MSDM
, and use that for your VM install.
Note: I wasn't able to get this to work on Windows 11
To have shared clipboard, and for windows video driver to match your vm window resolution, you must install spice guest tools inside the windows VM. It also installs some virtio pieces you will want.
https://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe
https://www.mozilla.org/en-US/exp/firefox/
When it's up, add-ons: ublock origin, privacy badger, noscript, disable search bar prediction
Note: I wasn't able to get this to work on Windows 11.
This is a hack on cmd.exe that lets it understand Ctrl-R and fixup unix-style slashes automagically.
https://github.com/mridgers/clink/releases/download/0.4.9/clink_0.4.9_setup.exe
If you're usually using *nix, you definitely need this to keep your sanity.
CMake have a windows installer thing downloadable from here
after that you can use cmake
from the terminal OK.
Visit the canonical git site to download their windows installer thing
Select the install option for "extra unix commands" so you can get ls -l
, cp
, mv
and suchlike working in cmd.exe... that's awesome, thanks git!
Afterwards you can just use git
as normal from cmd.exe as well.
You can do this through "windows store" by searching for "visual studio"
I installed as little as possible, we just want the C "C++" tools... 7GB :-)
It still wouldn't link without the "mt" helper tool from the huge windows SDK, so you have to install GB of that as well.
They don't mention it during the install, but after 30 days this "free" "community" edition demands you open a microsoft account or it stops working. In the install they give you the option to add a microsoft account and the alternative is, "not now, maybe later". Compare and contrast to gcc or git or the other FOSS projects.
Since I last did this, vcpkg has essentially wrapped the complicated build process.
It took 30 minutes to build the thing apparently in the same way that was previously described here manually.
CMake wants it and the version that comes with windows is too old to have pwsh.exe.
You can get a trusted cert bundle from here
Save it into C:\Program Files\Common Files\SSL\cert.pem
where openssl will be able to see it.
It's amazing but after all these years windows doesn't offer pthreads compatibility itself. Just like the many other missing POSIX bits like fork().
I downloaded the latest (2012) zip release of pthreads-win32 from here
ftp://sourceware.org/pub/pthreads-win32
Then I created a dir "C:\Program Files (x86)\pthreads", and copied the dll
, include
and lib
subdirs from the prebuilt
folder in the zip there.
We'll clone libwebsockets then use cmake to build via vs tools
Installing:
The libs we built against aren't visible in the system, I don't know what Real Windows Programmers are supposed to do about that, but I used sudo prompt to copy them into C:\windows\system32
After that you can run the test apps OK, eg