Repository navigation
[PLAT-22844] Add /MD Windows builds of libprotobuf - #7
Conversation
Windows also builds libprotobuf with the dynamic CRT (/MD, /MDd in
Debug) into lib/win/{arch}/MD, for linking into a /MD Unity Editor.
The /MT libraries are unchanged. protoc now uses /MD on Windows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| // Windows also gets a dynamic CRT (/MD, /MDd in Debug) build in an MD subfolder, for linking into a /MD Unity Editor | ||
| var dynamicCrtNp = CreateLibProtobuf("libprotobuf_md"); | ||
| dynamicCrtNp.OutputName.Add(c => c.CodeGen == CodeGen.Debug ? "libprotobufd" : "libprotobuf"); | ||
| dynamicCrtNp.CompilerSettingsForMsvc().Add(s => s.WithCompilerRuntimeLibrary(CompilerRuntimeLibrary.Dynamic)); |
There was a problem hiding this comment.
This seems to be using an old version of bee. With this version of bee, you'd set compiler runtime library using CompilerSettings. Unfortunately this was broken, I had to rewrite it in order to switch the player to dynamic CRT. You might have to upgrade bee for this to work correctly.
There was a problem hiding this comment.
Thanks! Upgraded Bee to the current production build (b649be378334) and now set the CRT on the toolchain: each Windows toolchain is listed once with CompilerRuntimeLibrary.Static and once with CompilerRuntimeLibrary.Dynamic, and the same libprotobuf builds with both. The duplicated _md program and the WithCompilerRuntimeLibrary calls are gone (22899cc). S3TCompress and Umbra had the same problem and get the same fix in https://github.cds.internal.unity3d.com/unity/graphics.ati-texture.compressor/pull/6 and https://github.cds.internal.unity3d.com/unity/Umbra/pull/16.
(Reply written by Claude Code, Claude Opus 5.5, on behalf of Phil.)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| try { [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 } catch {} |
There was a problem hiding this comment.
This is from the upgrade's artifacts, no code modified.
| SETLOCAL | ||
| SET distributionDir=%~dp0 | ||
| SET beePowerShellScript=%distributionDir%bee.ps1 | ||
|
|
There was a problem hiding this comment.
This is from the upgrade's artifacts, no code modified.
| ToolChain.Store.Windows().VS2019().Sdk_17134().x64(TargetWindowsVersion.Windows7, CompilerRuntimeLibrary.Static), | ||
| ToolChain.Store.Windows().VS2019().Sdk_17134().x64(TargetWindowsVersion.Windows7, CompilerRuntimeLibrary.Dynamic), | ||
| ToolChain.Store.Windows().VS2019().Sdk_20348().Arm64(TargetWindowsVersion.Windows7, CompilerRuntimeLibrary.Static), | ||
| ToolChain.Store.Windows().VS2019().Sdk_20348().Arm64(TargetWindowsVersion.Windows7, CompilerRuntimeLibrary.Dynamic), |
There was a problem hiding this comment.
Might as well use VS2026 if you're upgrading the compiler, to match what the editor uses.
There was a problem hiding this comment.
And also it'd be good to use the same Windows SDK too :).
Match the Unity Editor's toolchain: MSVC 14.51.36231 and Windows SDK 10.0.20348. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unity is moving the Windows Editor from the static CRT (/MT) to the dynamic CRT (/MD) (PLAT-22757). A /MD Editor can't link the current /MT libprotobuf (LNK2038), so this adds /MD builds alongside the existing ones.
Changes
b649be378334), replacing the bootstrap scripts inbee/. The old Bee predates the Bee CRT rework (June 2024), and setting the CRT through compiler settings is broken in it.lib/win/{x64,arm64}/MD/:libprotobuf.lib(/MD) andlibprotobufd.lib(/MDd). The /MT libraries keep their current names and paths.Clang_9_0_1()now uses clang 15.0.6)..yamatochanged towin_x64,win_arm64andlinux_x64, because new Bee's toolchain action names include the compiler and CRT.build-system/unity-ubuntu-22.04(the image unity/unity uses for Bee), because the current Bee and its .NET 10 runtime need a newer glibc than the old image has..gitignorenow covers the Bee outputs (artifacts/,builds/,build.gen.sln).Testing
MD/libs on MSVCRT/MSVCRTD; protoc.exe imports the dynamic CRT. No LNK4098 or LNK2038 warnings.protoc.exe --versionruns on x64.This description was updated by Claude Code (Claude Opus 5.5).
🤖 Generated with Claude Code