1
1
# Some notes for the windows jungle
2
2
3
3
This was how I compiled libwebsockets starting from a blank windows install
4
- in March - April 2020 . Doing this on a linux distro is way simpler and quicker
4
+ in June 2025 . Doing this on a linux distro is way simpler and quicker
5
5
than all this!
6
6
7
7
## Notes on vm installation
@@ -17,7 +17,9 @@ the windows it came with, you can recover your 'windows tax' windows product key
17
17
from your device typically using ` sudo strings /sys/firmware/acpi/tables/MSDM ` ,
18
18
and use that for your VM install.
19
19
20
- ### Required: Spice guest
20
+ ### Required: Spice guest
21
+
22
+ Note: I wasn't able to get this to work on Windows 11
21
23
22
24
To have shared clipboard, and for windows video driver to match your vm window
23
25
resolution, you must install spice guest tools inside the windows VM. It also
@@ -34,6 +36,8 @@ bar prediction
34
36
35
37
### Blood-pressure reduction: Clink
36
38
39
+ Note: I wasn't able to get this to work on Windows 11.
40
+
37
41
This is a hack on cmd.exe that lets it understand Ctrl-R and fixup unix-style
38
42
slashes automagically.
39
43
@@ -77,76 +81,25 @@ the other FOSS projects.
77
81
78
82
### Required: OpenSSL
79
83
80
- Ugh... I tried using prebuilts but it's unreliable and needs an unfeasible
81
- amount of trust. So I recommend bite the bullet and build your own... that's
82
- trivial on Linux but of course windows makes everything nasty.
83
-
84
- At least hopefully all the "research" is done and listed out here.
85
-
86
- #### OpenSSL build Prerequisite: install perl binary
87
-
88
- Move the git version of perl out of the way, it won't work for OpenSSL build
84
+ Since I last did this, vcpkg has essentially wrapped the complicated build process.
89
85
90
86
```
91
- mv /usr/bin/perl /usr/bin/perl-git
87
+ > git clone https://github.com/microsoft/vcpkg
88
+ > vcpkg integrate install
89
+ > vcpkg install openssl:x64-windows
92
90
```
93
91
94
- For windows, OpenSSL "recommends" ActiveState perl but it doesn't work for me,
95
- complaining about stuff needed from cpan and then dying when it was installed.
96
- "Strawberry Perl" is installed in ` C:\Strawberry ` and worked out the box.
97
-
98
- http://strawberryperl.com/download/5.30.2.1/strawberry-perl-5.30.2.1-64bit.msi
99
-
100
- The installer sets up ` %PATH% ` if you open a new cmd window.
101
-
102
- #### OpenSSL build Prerequisite: NASM
92
+ It took 30 minutes to build the thing apparently in the same way that was previously
93
+ described here manually.
103
94
104
- Go here and click on the latest stable, download the win32 .exe
95
+ ### Powershell
105
96
106
- https://nasm.us/
107
-
108
- Just install via the defaults. Then add it to the PATH temporarily...
97
+ CMake wants it and the version that comes with windows is too old to have pwsh.exe.
109
98
110
99
```
111
- $ set PATH=%PATH%;C:\Program Files (x86)\NASM
100
+ > sudo winget install --id Microsoft.PowerShell --source winget
112
101
```
113
102
114
- #### OpenSSL build setup: source VC env vars
115
-
116
- These fix up the PATH and include dirs etc necessary for VC build in the cmd
117
- window.
118
-
119
- ```
120
- $ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
121
- ```
122
-
123
- ### OpenSSL build:
124
-
125
- Grab openssl from git... assuming the prerequisites above went well it will
126
- just sit there building for 30 minutes or whatever.
127
-
128
- ```
129
- $ git clone https://github.com/openssl/openssl
130
- $ cd openssl
131
- $ perl Configure VC-WIN64A
132
- $ nmake
133
- ```
134
-
135
- Afterwards, open an Administrator mode cmd.exe, redo the msvc path and then
136
- install the build.
137
-
138
- ```
139
- $ cd openssl
140
- $ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
141
- $ nmake install
142
- ```
143
-
144
- Oh another grindingly slow windows build action. Finally it's in there in
145
- ` C:\Program Files\OpenSSL ` .
146
-
147
- libraries are looking for a cert bundle at "C:\Program Files\Common Files\SSL\cert.pem"...
148
- it's not documented or included in the zip file from the above, so...
149
-
150
103
#### Installing a cert bundle
151
104
152
105
You can get a trusted cert bundle from here
@@ -167,12 +120,6 @@ ftp://sourceware.org/pub/pthreads-win32
167
120
Then I created a dir "C:\Program Files (x86)\pthreads", and copied the ` dll ` ,
168
121
` include ` and ` lib ` subdirs from the ` prebuilt ` folder in the zip there.
169
122
170
- The cmake incantation to build against pthreads set up like that is
171
-
172
- ```
173
- $ cmake .. -DLWS_HAVE_PTHREAD_H=1 -DLWS_EXT_PTHREAD_INCLUDE_DIR="C:\Program Files (x86)\pthreads\include" -DLWS_EXT_PTHREAD_LIBRARIES="C:\Program Files (x86)\pthreads\lib\x64\libpthreadGC2.a" -DLWS_WITH_MINIMAL_EXAMPLES=1
174
- ```
175
-
176
123
## Building libwebsockets
177
124
178
125
We'll clone libwebsockets then use cmake to build via vs tools
@@ -182,25 +129,26 @@ We'll clone libwebsockets then use cmake to build via vs tools
182
129
> cd libwebsockets
183
130
> mkdir build
184
131
> cd build
185
- > cmake ..
186
- > cmake --build . --config DEBUG
132
+ > cmake .. -DLWS_HAVE_PTHREAD_H=1 -DLWS_EXT_PTHREAD_INCLUDE_DIR="C:\Program Files (x86)\pthreads\include" -DLWS_EXT_PTHREAD_LIBRARIES="C:\Program Files (x86)\pthreads\lib\x64\libpthreadGC2.a" -DOPENSSL_ROOT_DIR="c:\Users\<user>\vcpkg\packages\openssl_x64-windows"
133
+ > cmake --build . -j 4 - -config DEBUG
187
134
```
188
135
189
- Installing requires admin privs, I opened a second cmd window as admin and did it
190
- there.
136
+ Installing:
191
137
192
138
```
193
- > cmake --install . --config DEBUG
139
+ > sudo cmake --install . --config DEBUG
194
140
```
195
141
196
142
### Hack the libs into view
197
143
198
144
The libs we built against aren't visible in the system, I don't know what
199
- Real Windows Programmers are supposed to do about that, but I used an Admin cmd
145
+ Real Windows Programmers are supposed to do about that, but I used sudo
200
146
prompt to copy them into C:\windows\system32
201
147
202
148
```
203
- $ cp "C:\Program Files (x86)\pthreads\dll\x64\pthreadGC2.dll" "C:\Program Files\OpenSSL\bin\libcrypto-3.dll" "C:\Program Files\OpenSSL\bin\libssl-3.dll" C:\Windows\system32
149
+ > sudo copy "C:\Program Files (x86)\pthreads\dll\x64\pthreadGC2.dll" C:\Windows\system32
150
+ > sudo copy "c:\Users\<user>\vcpkg\packages\openssl_x64-windows\bin\libcrypto-3.dll" C:\Windows\system32
151
+ > sudo copy "c:\Users\<user>\vcpkg\packages\openssl_x64-windows\bin\libssl-3.dll" C:\Windows\system32
204
152
```
205
153
206
154
After that you can run the test apps OK, eg
0 commit comments