feat(compat.openssl): add Windows support via VC-WIN64A + nmake sourc… - #6
Open
FarnaHerry wants to merge 3 commits into
Open
feat(compat.openssl): add Windows support via VC-WIN64A + nmake sourc…#6FarnaHerry wants to merge 3 commits into
FarnaHerry wants to merge 3 commits into
Conversation
added 3 commits
August 16, 2026 14:54
…e build
The last major package still marked "windows deferred". Unblocks the
Windows leg of compat.libmysqlclient, whose mcpp.toml is already wired
for it; openssl was the only missing dependency there.
- xpm: add a windows entry reusing the shared source tarball (same sha256)
- mcpp: add windows ldflags. lld-link resolves `-lX` to `X.lib`, so the
MSVC-built static libs must be spelled `-llibssl`/`-llibcrypto`; the
static libcrypto system deps (ws2_32, crypt32, advapi32, user32) are
listed explicitly, the same way the linux leg lists -ldl/-lpthread.
- install(): route windows to _install_windows() instead of erroring out.
- _install_windows(): one generated .bat runs under a single vcvars64
invocation and does Configure VC-WIN64A no-shared no-dso no-tests
no-apps no-engine no-asm + nmake + install_sw, then verifies
libssl.lib/libcrypto.lib exist and writes the anchor TU. Helpers:
find_vcvars (vswhere, then known paths), resolve_perl_windows /
perl_usable_windows, win_dirname.
Pitfalls found on real hardware, baked into the implementation:
- the xpkg hook env on Windows has no os.rm (must be pcall'd) and no
path.dirname (hand-rolled win_dirname)
- OpenSSL Configure needs Locale::Maketext::Simple, which MSYS perl
(Git-for-Windows) lacks; the existing module probe would wrongly accept
it, so the windows check requires Strawberry Perl
- os.exec("bash -c ...") silently returns true WITHOUT running the command
in the Windows hook env, so the windows build drives
`cmd /c <bat> > <log> 2>&1` directly instead of reusing the shared run()
- vcvars (cmd /c "vcvars64.bat & set") works fine on Windows 11 + VS
2022/18; the old "takes the whole process chain down" note was a
hook-env artifact, not a property of Windows
compat.openssl now builds on Windows (VC-WIN64A + nmake), so the tests/examples/openssl member no longer has to be a no-op main() there. Declare the dependency and HAVE_OPENSSL on all three platforms; tls.cpp compiles its real TLS-context + SHA-256 checks on Windows as well. Verified on Windows (llvm/clang toolchain, MSVC-built libssl.lib + libcrypto.lib): `mcpp test -p openssl` → tls ... ok (1 passed, 0 failed).
Windows CI failed `mcpp test -p openssl` at install(): find_vcvars ran
vswhere through `os.exec("bash -c …")`, which this hook's Windows
environment silently swallows (returns true, runs nothing), so vswhere's
output file was never written. The search then fell back to hardcoded
vcvars64.bat paths that only covered Community editions — and GitHub
Actions runners carry VS **Enterprise**, so the toolset was never found.
- find_vcvars: drive vswhere through a generated .bat under `cmd /c`
(the same pattern _install_windows uses), which actually executes and
is edition-agnostic; keep the hardcoded fallback but expand it to
Enterprise/BuildTools across the 2022 (17) / 18 (2026) product lines.
- perl_usable_windows: the old probe ran perl via `bash -c`, which also
no-ops — it accepted ANY perl, including the MSYS perl that lacks
Locale::Maketext::Simple and dies inside Configure. Probe perl through
a generated .bat under `cmd /c` and require it to print a marker only
when the modules load; MSYS perl on PATH now correctly fails the probe.
Verified on hardware: the generated vswhere .bat returns the install
path (and the matching vcvars64.bat), and the perl probe prints `ok` for
Strawberry (scoop) perl while MSYS perl fails it with the missing-module
error. Descriptor still parses with the pinned CI client (2026.8.10.3).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…e build
The last major package still marked "windows deferred". Unblocks the Windows leg of compat.libmysqlclient, whose mcpp.toml is already wired for it; openssl was the only missing dependency there.
-lXtoX.lib, so the MSVC-built static libs must be spelled-llibssl/-llibcrypto; the static libcrypto system deps (ws2_32, crypt32, advapi32, user32) are listed explicitly, the same way the linux leg lists -ldl/-lpthread.Pitfalls found on real hardware, baked into the implementation:
cmd /c <bat> > <log> 2>&1directly instead of reusing the shared run()