Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1713610017, "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":"ad90fff4ea5a5922c61d792bccb46c76", "oid":{ "oid": "f28a45246e7ea479718ddba5e80deb355b23f5f3", "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 March - April 2020. 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\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\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\nUgh... I tried using prebuilts but it's unreliable and needs an unfeasible\namount of trust. So I recommend bite the bullet and build your own... that's\ntrivial on Linux but of course windows makes everything nasty.\n\nAt least hopefully all the \u0022research\u0022 is done and listed out here.\n\n#### OpenSSL build Prerequisite: install perl binary\n\nMove the git version of perl out of the way, it won't work for OpenSSL build\n\n```\nmv /usr/bin/perl /usr/bin/perl-git\n```\n\nFor windows, OpenSSL \u0022recommends\u0022 ActiveState perl but it doesn't work for me,\ncomplaining about stuff needed from cpan and then dying when it was installed.\n\u0022Strawberry Perl\u0022 is installed in `C:\u005cStrawberry` and worked out the box.\n\nhttp://strawberryperl.com/download/5.30.2.1/strawberry-perl-5.30.2.1-64bit.msi\n\nThe installer sets up `%PATH%` if you open a new cmd window. \n\n#### OpenSSL build Prerequisite: NASM\n\nGo here and click on the latest stable, download the win32 .exe\n\nhttps://nasm.us/\n\nJust install via the defaults. Then add it to the PATH temporarily...\n\n```\n$ set PATH\u003d%PATH%;C:\u005cProgram Files (x86)\u005cNASM\n```\n\n#### OpenSSL build setup: source VC env vars\n\nThese fix up the PATH and include dirs etc necessary for VC build in the cmd\nwindow.\n\n```\n$ call \u0022C:\u005cProgram Files (x86)\u005cMicrosoft Visual Studio\u005c2019\u005cCommunity\u005cVC\u005cAuxiliary\u005cBuild\u005cvcvarsall.bat\u0022 x86_amd64\n```\n\n### OpenSSL build:\n\nGrab openssl from git... assuming the prerequisites above went well it will\njust sit there building for 30 minutes or whatever.\n\n```\n$ git clone https://github.com/openssl/openssl\n$ cd openssl\n$ perl Configure VC-WIN64A\n$ nmake\n```\n\nAfterwards, open an Administrator mode cmd.exe, redo the msvc path and then\ninstall the build.\n\n```\n$ cd openssl\n$ call \u0022C:\u005cProgram Files (x86)\u005cMicrosoft Visual Studio\u005c2019\u005cCommunity\u005cVC\u005cAuxiliary\u005cBuild\u005cvcvarsall.bat\u0022 x86_amd64\n$ nmake install\n```\n\nOh another grindingly slow windows build action. Finally it's in there in\n`C:\u005cProgram Files\u005cOpenSSL`.\n\nlibraries are looking for a cert bundle at \u0022C:\u005cProgram Files\u005cCommon Files\u005cSSL\u005ccert.pem\u0022...\nit's not documented or included in the zip file from the above, so...\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\nThe cmake incantation to build against pthreads set up like that is\n\n```\n $ 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 -DLWS_WITH_MINIMAL_EXAMPLES\u003d1\n```\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 ..\n\u003e cmake --build . --config DEBUG\n```\n\nInstalling requires admin privs, I opened a second cmd window as admin and did it\nthere.\n\n```\n\u003e 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 an Admin cmd\nprompt to copy them into C:\u005cwindows\u005csystem32\n\n```\n$ cp \u0022C:\u005cProgram Files (x86)\u005cpthreads\u005cdll\u005cx64\u005cpthreadGC2.dll\u0022 \u0022C:\u005cProgram Files\u005cOpenSSL\u005cbin\u005clibcrypto-3.dll\u0022 \u0022C:\u005cProgram Files\u005cOpenSSL\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":1713610017,"u": 2092}} ],"g": 4038,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 1, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}