Building and running on Windows
August 8, 2026 · View on GitHub
The Makefile supports Windows out of the box: it detects the platform and builds
profanity2.exe. What it cannot do for you is provide a compiler and the OpenCL
headers/libraries — bare g++ from cmd.exe/Git Bash without them fails with
errors like CL/cl.h: No such file or directory. The easiest way to get a complete
toolchain is the MSYS2 environment, which provides g++,
make and prebuilt OpenCL packages.
Option A (recommended): MSYS2 / MinGW-w64
1. Install MSYS2
Download and install from msys2.org, then open the "MSYS2 UCRT64" shell (not the plain "MSYS2 MSYS" one).
2. Install the toolchain and OpenCL packages
pacman -Syu
pacman -S --needed make mingw-w64-ucrt-x86_64-gcc \
mingw-w64-ucrt-x86_64-opencl-headers \
mingw-w64-ucrt-x86_64-opencl-icd
opencl-headersprovidesCL/cl.h;opencl-icdprovides the import library forOpenCL.dll, the system OpenCL loader that dispatches to your GPU driver at runtime.
3. Build
From the repository root inside the UCRT64 shell:
make
The Makefile detects Windows automatically (via the OS=Windows_NT environment
variable) and produces bin\profanity2.exe, with the two OpenCL kernels copied
next to it. The MinGW runtimes (libstdc++, libgcc,
winpthread) are linked statically, so the resulting exe is self-contained and
runs outside the MSYS2 shell — only OpenCL.dll is loaded dynamically, and that
one ships with your GPU driver.
If you prefer to build without make, the equivalent direct command is:
mkdir -p bin
g++ -std=c++11 -Wall -O2 src/Dispatcher.cpp src/Mode.cpp src/precomp.cpp src/profanity.cpp src/SpeedSample.cpp \
-static -l:libOpenCL.dll.a -lws2_32 -o bin/profanity2.exe
cp kernels/keccak.cl kernels/profanity.cl bin/
(-l:libOpenCL.dll.a names the OpenCL import library explicitly because with
-static the linker would otherwise skip .dll.a files when resolving -lOpenCL.)
4. Run
Your GPU driver must be installed (NVIDIA and AMD drivers include the OpenCL runtime on Windows). Then:
./bin/profanity2.exe --leading 0 -z HEX_PUBLIC_KEY_128_CHARS_LONG
The executable is statically linked against the MinGW runtimes, so it can be
launched from anywhere (Explorer, cmd.exe, PowerShell) — no extra DLLs needed.
If you built with a custom command without -static and get missing-DLL errors
outside the MSYS2 shell, either add -static or copy libstdc++-6.dll,
libgcc_s_seh-1.dll and libwinpthread-1.dll from C:\msys64\ucrt64\bin next
to the executable.
5. Generating the seed public key for -z
Windows does not ship openssl, and the key-generation one-liners in the
README also need
xxd and sed, so run them from a Unix-like shell:
-
MSYS2 (same shell you build in): install the missing tools first —
pacman -S --needed openssl vim # vim provides xxd -
Git Bash (Git for Windows):
openssl,xxdandsedare already bundled, the README commands work as-is.
As always: generate the key locally, never share the private key and never use online key generators or calculators.
Option B: linking against a vendor OpenCL SDK
If you prefer not to install the MSYS2 OpenCL packages, any vendor OpenCL SDK works, e.g. the CUDA Toolkit (NVIDIA) or the OpenCL SDK (any vendor). Point the compiler at the SDK's include and library directories:
g++ -std=c++11 -Wall -O2 \
-I"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/include" \
-L"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/lib/x64" \
src/Dispatcher.cpp src/Mode.cpp src/precomp.cpp src/profanity.cpp src/SpeedSample.cpp \
-lOpenCL -lws2_32 -o bin/profanity2.exe
The same works through make:
make CDEFINES='-I"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/include"' \
LDFLAGS='-s -L"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/lib/x64" -lOpenCL -lws2_32'
What about WSL2?
Building under WSL2 works (follow the Ubuntu instructions), but GPU OpenCL devices are generally not available inside WSL2 — the GPU paravirtualization exposes CUDA/DirectML but not a full OpenCL stack, so profanity2 will print an empty device list. Build natively with MSYS2 instead.
Troubleshooting
| Symptom | Fix | Seen in |
|---|---|---|
fatal error: CL/cl.h: No such file or directory | OpenCL headers not installed / not in include path — see steps above | #31, #27, #23, #20 |
process_begin: CreateProcess(NULL, uname -s, ...) failed | You are on an old checkout whose Makefile called uname on Windows — update to latest master | #26, #21 |
cannot find -lOpenCL | Install mingw-w64-ucrt-x86_64-opencl-icd or pass -L<path to OpenCL.lib/libOpenCL.dll.a> | |
Output stops after Devices: (empty list) | Install/update your GPU driver; don't run under WSL2 | #17 |