From b05539f86a276c39df63c4a4b15a594aa75e495d Mon Sep 17 00:00:00 2001 From: Stephen Dennis Date: Mon, 10 Aug 2026 20:39:31 -0600 Subject: [PATCH] fix(#2212): PCRE2 comes from vcpkg, like grpc The Windows build took PCRE2 from a hand-built out-of-tree directory reached through $(Pcre2Dir). engine.vcxproj honoured that property for its headers but hardcoded ..\..\src\pcre2\{Release,Debug} for its libraries, so -p:Pcre2Dir= applied to one half and not the other and the link failed with LNK1104 in any tree where PCRE2 was not at the default. Declare pcre2 in mux/vcpkg.json instead, alongside grpc and nlohmann-json, and point netmux, libmux and engine at $(VcpkgDir). All three now read include and library paths from the same place. Note vcpkg's layout is lib/ for release and debug/lib/ for debug, not Release/ and Debug/. PCRE2's JIT is required -- funceval2.cpp calls pcre2_jit_compile -- and comes automatically: the port's platform-default-features pulls in jit everywhere except emscripten and iOS. Ship mux/vcpkg.json in both source TOCs. It was in neither, so the source distribution carried no statement of its own dependencies; with PCRE2 moving to vcpkg, the file that declares it has to travel with the source or an unpacking reader is worse off than before. Unix is unaffected -- configure finds system PCRE2 via pkg-config. Verified on hatsuhara: Release and Debug both build clean with no hand-built PCRE2 present anywhere on the box. Co-Authored-By: Claude Opus 5 --- docs/building.md | 29 +++++++++++++++++++++++++++++ mux/libmux.vcxproj | 9 +++++---- mux/modules/engine/engine.vcxproj | 16 ++++++++++------ mux/netmux.vcxproj | 18 ++++++++++-------- mux/vcpkg.json | 3 ++- unix/TOC.patchable | 1 + win32/TOC.src.patchable | 1 + 7 files changed, 58 insertions(+), 19 deletions(-) diff --git a/docs/building.md b/docs/building.md index b4a25ca08..08dfd2086 100644 --- a/docs/building.md +++ b/docs/building.md @@ -60,6 +60,35 @@ without pkg-config metadata has to be pointed at by hand. MSVC via the `.vcxproj` files; there is no autotools path. See `CLAUDE.md` for the GANL test harness invocation. Note issue #1499 (`/utf-8`). +**Third-party dependencies come from vcpkg** (#2212). `mux/vcpkg.json` declares +them — currently `grpc`, `nlohmann-json` and `pcre2` — pinned to a +`builtin-baseline` commit: + +``` +git clone https://github.com/microsoft/vcpkg C:\vcpkg +C:\vcpkg\bootstrap-vcpkg.bat +cd mux && C:\vcpkg\vcpkg.exe install --triplet x64-windows +``` + +That materialises `mux/vcpkg_installed/x64-windows/` (gitignored), which every +project reads via `$(VcpkgDir)`. Release libraries land in `lib/` and debug in +`debug/lib/` — not `Release/` and `Debug/`, which is what the old hand-built +PCRE2 layout used. + +Two things that will waste your afternoon otherwise: + +- **Do not `git clone --depth 1`.** The pinned baseline commit is not in a + shallow clone and resolution fails with `failed to git show + versions/baseline.json`. Recover with + `git fetch --depth 1 origin `. +- **First run is slow** — grpc dominates, roughly an hour and ~11 GB. It is a + one-time cost: vcpkg's binary cache (`%LOCALAPPDATA%\vcpkg\archives`) makes + any later tree a few seconds. + +PCRE2's JIT is required (`funceval2.cpp` calls `pcre2_jit_compile`) and arrives +automatically — the port's `platform-default-features` pulls in `jit` on every +platform except emscripten and iOS, so a plain `"pcre2"` dependency is enough. + ## When you still need flags **`--enable-nls` on macOS.** GNU gettext ships no `.pc` file, so unlike PCRE2 diff --git a/mux/libmux.vcxproj b/mux/libmux.vcxproj index eca36fca8..00ddefb31 100644 --- a/mux/libmux.vcxproj +++ b/mux/libmux.vcxproj @@ -37,19 +37,20 @@ <_ProjectFileVersion>12.0.30501.0 - + $(MSBuildProjectDirectory) - $(MuxDir)\src\pcre2 + $(MuxDir)\vcpkg_installed\x64-windows .\bin_release\ $(Platform)\$(Configuration)\$(ProjectName)\ - $(MuxDir)\include;$(Pcre2Dir)\include;$(MuxDir)\sqlite;$(IncludePath) + $(MuxDir)\include;$(VcpkgDir)\include;$(MuxDir)\sqlite;$(IncludePath) .\bin_debug\ $(Platform)\$(Configuration)\$(ProjectName)\ - $(MuxDir)\include;$(Pcre2Dir)\include;$(MuxDir)\sqlite;$(IncludePath) + $(MuxDir)\include;$(VcpkgDir)\include;$(MuxDir)\sqlite;$(IncludePath) diff --git a/mux/modules/engine/engine.vcxproj b/mux/modules/engine/engine.vcxproj index cf17a7c0c..ef0147de5 100644 --- a/mux/modules/engine/engine.vcxproj +++ b/mux/modules/engine/engine.vcxproj @@ -37,19 +37,23 @@ <_ProjectFileVersion>12.0.30501.0 - + $(MSBuildProjectDirectory)\..\.. - $(MuxDir)\src\pcre2 + $(MuxDir)\vcpkg_installed\x64-windows ..\..\bin_release\ $(Platform)\$(Configuration)\$(ProjectName)\ - $(MuxDir)\include;$(MuxDir)\sqlite;$(MuxDir)\lua54;$(Pcre2Dir)\include;$(MuxDir)\ganl\include;$(IncludePath) + $(MuxDir)\include;$(MuxDir)\sqlite;$(MuxDir)\lua54;$(VcpkgDir)\include;$(MuxDir)\ganl\include;$(IncludePath) ..\..\bin_debug\ $(Platform)\$(Configuration)\$(ProjectName)\ - $(MuxDir)\include;$(MuxDir)\sqlite;$(MuxDir)\lua54;$(Pcre2Dir)\include;$(MuxDir)\ganl\include;$(IncludePath) + $(MuxDir)\include;$(MuxDir)\sqlite;$(MuxDir)\lua54;$(VcpkgDir)\include;$(MuxDir)\ganl\include;$(IncludePath) @@ -80,7 +84,7 @@ libmux.lib;ganl.lib;lua54.lib;pcre2-8.lib;ws2_32.lib;%(AdditionalDependencies) - ..\..\bin_release;..\..\src\pcre2\Release;%(AdditionalLibraryDirectories) + ..\..\bin_release;$(VcpkgDir)\lib;%(AdditionalLibraryDirectories) Windows true @@ -110,7 +114,7 @@ libmux.lib;ganl.lib;lua54.lib;pcre2-8d.lib;ws2_32.lib;%(AdditionalDependencies) - ..\..\bin_debug;..\..\src\pcre2\Debug;%(AdditionalLibraryDirectories) + ..\..\bin_debug;$(VcpkgDir)\debug\lib;%(AdditionalLibraryDirectories) Windows diff --git a/mux/netmux.vcxproj b/mux/netmux.vcxproj index 923af7b76..0e9055908 100644 --- a/mux/netmux.vcxproj +++ b/mux/netmux.vcxproj @@ -38,23 +38,25 @@ <_ProjectFileVersion>12.0.30501.0 + MSBuildProjectDirectory is the mux root for this tree. + #2212: PCRE2 comes from vcpkg now, the same way grpc does — declared + in mux\vcpkg.json, materialised by `vcpkg install` run from mux\. + vcpkg's layout puts release libs in lib\ and debug libs in + debug\lib\, not Release\ and Debug\. --> $(MSBuildProjectDirectory) - $(MuxDir)\src\pcre2 + $(MuxDir)\vcpkg_installed\x64-windows .\bin_debug\ $(Platform)\$(Configuration)\$(ProjectName)\ - $(MuxDir)\include;$(MuxDir)\ganl\include;$(Pcre2Dir)\include;$(MuxDir)\sqlite;$(IncludePath) - $(Pcre2Dir)\Debug;$(LibraryPath) + $(MuxDir)\include;$(MuxDir)\ganl\include;$(VcpkgDir)\include;$(MuxDir)\sqlite;$(IncludePath) + $(VcpkgDir)\debug\lib;$(LibraryPath) .\bin_release\ $(Platform)\$(Configuration)\$(ProjectName)\ - $(MuxDir)\include;$(MuxDir)\ganl\include;$(Pcre2Dir)\include;$(MuxDir)\sqlite;$(IncludePath) - $(Pcre2Dir)\Release;$(LibraryPath) + $(MuxDir)\include;$(MuxDir)\ganl\include;$(VcpkgDir)\include;$(MuxDir)\sqlite;$(IncludePath) + $(VcpkgDir)\lib;$(LibraryPath) diff --git a/mux/vcpkg.json b/mux/vcpkg.json index cc73c5abc..420cef630 100644 --- a/mux/vcpkg.json +++ b/mux/vcpkg.json @@ -4,6 +4,7 @@ "builtin-baseline": "544a4c5c297e60e4ac4a5a1810df66748d908869", "dependencies": [ "grpc", - "nlohmann-json" + "nlohmann-json", + "pcre2" ] } diff --git a/unix/TOC.patchable b/unix/TOC.patchable index e1ecad4b9..7187e8b25 100644 --- a/unix/TOC.patchable +++ b/unix/TOC.patchable @@ -402,3 +402,4 @@ src/websocket.cpp src/websocket.h SSL.md UPGRADING.md +vcpkg.json diff --git a/win32/TOC.src.patchable b/win32/TOC.src.patchable index 923bc3be4..52257d322 100644 --- a/win32/TOC.src.patchable +++ b/win32/TOC.src.patchable @@ -393,3 +393,4 @@ src/websocket.cpp src/websocket.h SSL.md UPGRADING.md +vcpkg.json