Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1757922777, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"776ea67d1ebbe49fd155cd21cb1d2e28", "oid":{ "oid": "ade91d83455bd6a551fa9b4ad06de75f879d8142", "alias": [ "refs/heads/main"]},"blobname": "READMEs/README.build-windows.md", "blob": "# Some notes for the windows jungle\n\nThis was how I compiled libwebsockets starting from a blank windows install\nin June 2025. Doing this on a linux distro is way simpler and quicker\nthan all this!\n\n## Notes on vm installation\n\n### Disk size\n\nFor building you'll need 40GB+ available for the guest storage.\n\n### Required: Windows product key\n\nAssuming like me the first thing you do with a new laptop is install Linux over\nthe windows it came with, you can recover your 'windows tax' windows product key\nfrom your device typically using `sudo strings /sys/firmware/acpi/tables/MSDM`,\nand use that for your VM install.\n\n### Required: Spice guest\n\nNote: I wasn't able to get this to work on Windows 11\n\nTo have shared clipboard, and for windows video driver to match your vm window\nresolution, you must install spice guest tools inside the windows VM. It also\ninstalls some virtio pieces you will want.\n\nhttps://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe\n\n### Blood-pressure reduction: Firefox\n\nhttps://www.mozilla.org/en-US/exp/firefox/\n\nWhen it's up, add-ons: ublock origin, privacy badger, noscript, disable search\nbar prediction\n\n### Blood-pressure reduction: Clink\n\nNote: I wasn't able to get this to work on Windows 11.\n\nThis is a hack on cmd.exe that lets it understand Ctrl-R and fixup unix-style\nslashes automagically.\n\nhttps://github.com/mridgers/clink/releases/download/0.4.9/clink_0.4.9_setup.exe\n\nIf you're usually using *nix, you definitely need this to keep your sanity.\n\n### Required: cmake\n\nCMake have a windows installer thing downloadable from here\n\n[cmake](https://cmake.org/download/)\n\nafter that you can use `cmake` from the terminal OK.\n\n### Required: git\n\nVisit the canonical git site to download their windows installer thing\n\n[git](https://git-scm.com/download/win)\n\n**Select the install option for \u0022extra unix commands\u0022** so you can get `ls -l`,\n`cp`, `mv` and suchlike working in cmd.exe... that's awesome, thanks git!\n\nAfterwards you can just use `git` as normal from cmd.exe as well.\n\n### Required: Install the \u0022free\u0022 \u0022community\u0022 visual studio\n\nYou can do this through \u0022windows store\u0022 by searching for \u0022visual studio\u0022\n\nI installed as little as possible, we just want the C \u0022C++\u0022 tools... 7GB :-)\n\nIt still wouldn't link without the \u0022mt\u0022 helper tool from the\nhuge windows SDK, so you have to install GB of that as well.\n\nThey don't mention it during the install, but after 30 days this \u0022free\u0022\n\u0022community\u0022 edition demands you open a microsoft account or it stops working.\nIn the install they give you the option to add a microsoft account and the\nalternative is, \u0022not now, maybe later\u0022. Compare and contrast to gcc or git or\nthe other FOSS projects.\n\n### Required: OpenSSL\n\nSince I last did this, vcpkg has essentially wrapped the complicated build process.\n\n```\n\u003e git clone https://github.com/microsoft/vcpkg\n\u003e vcpkg integrate install\n\u003e vcpkg install openssl:x64-windows \n```\n\nIt took 30 minutes to build the thing apparently in the same way that was previously\ndescribed here manually.\n\n### Powershell\n\nCMake wants it and the version that comes with windows is too old to have pwsh.exe.\n\n```\n\u003e sudo winget install --id Microsoft.PowerShell --source winget\n```\n\n#### Installing a cert bundle\n\nYou can get a trusted cert bundle from here\n\n[drwetter/testssl cert bundle](https://raw.githubusercontent.com/drwetter/testssl.sh/3.1dev/etc/Microsoft.pem)\n\nSave it into `C:\u005cProgram Files\u005cCommon Files\u005cSSL\u005ccert.pem` where openssl will be able to see it.\n\n## Required: pthreads\n\nIt's amazing but after all these years windows doesn't offer pthreads compatibility\nitself. Just like the many other missing POSIX bits like fork().\n\nI downloaded the latest (2012) zip release of pthreads-win32 from here\n\nftp://sourceware.org/pub/pthreads-win32\n\nThen I created a dir \u0022C:\u005cProgram Files (x86)\u005cpthreads\u0022, and copied the `dll`,\n`include` and `lib` subdirs from the `prebuilt` folder in the zip there.\n\n## Building libwebsockets\n\nWe'll clone libwebsockets then use cmake to build via vs tools\n\n```\n\u003e git clone https://libwebsockets.org/repo/libwebsockets\n\u003e cd libwebsockets\n\u003e mkdir build\n\u003e cd build\n\u003e cmake .. -DLWS_HAVE_PTHREAD_H\u003d1 -DLWS_EXT_PTHREAD_INCLUDE_DIR\u003d\u0022C:\u005cProgram Files (x86)\u005cpthreads\u005cinclude\u0022 -DLWS_EXT_PTHREAD_LIBRARIES\u003d\u0022C:\u005cProgram Files (x86)\u005cpthreads\u005clib\u005cx64\u005clibpthreadGC2.a\u0022 -DOPENSSL_ROOT_DIR\u003d\u0022c:\u005cUsers\u005c\u003cuser\u003e\u005cvcpkg\u005cpackages\u005copenssl_x64-windows\u0022\n\u003e cmake --build . -j 4 --config DEBUG\n```\n\nInstalling:\n\n```\n\u003e sudo cmake --install . --config DEBUG\n```\n\n### Hack the libs into view\n\nThe libs we built against aren't visible in the system, I don't know what\nReal Windows Programmers are supposed to do about that, but I used sudo\nprompt to copy them into C:\u005cwindows\u005csystem32\n\n```\n\u003e sudo copy \u0022C:\u005cProgram Files (x86)\u005cpthreads\u005cdll\u005cx64\u005cpthreadGC2.dll\u0022 C:\u005cWindows\u005csystem32\n\u003e sudo copy \u0022c:\u005cUsers\u005c\u003cuser\u003e\u005cvcpkg\u005cpackages\u005copenssl_x64-windows\u005cbin\u005clibcrypto-3.dll\u0022 C:\u005cWindows\u005csystem32\n\u003e sudo copy \u0022c:\u005cUsers\u005c\u003cuser\u003e\u005cvcpkg\u005cpackages\u005copenssl_x64-windows\u005cbin\u005clibssl-3.dll\u0022 C:\u005cWindows\u005csystem32\n```\n\nAfter that you can run the test apps OK, eg\n\n```\n$ libwebsockets-test-server.exe -s\n```\n\n## Note about using paths with spaces in with cmake\n\n\n","s":{"c":1757922777,"u": 313}} ],"g": 3309,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 1, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}