This is an automated email from the ASF dual-hosted git repository. leginee pushed a commit to branch bazel-migration in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 6035bc55d0d838c439c31cfe13cdba9226fba34e Author: Peter <[email protected]> AuthorDate: Thu Nov 5 05:48:53 2026 +0100 build: VS2008 and SDK v7.0 are no longer needed on the machine The VC9 toolchains were retired 2026-11-01, but their install was still read in four places. All now use the VS2019 toolset and the Windows 10 SDK that @vs_config already discovers: - scp2: the .scp preprocessor (cl /EP) is the VS2019 x64 cl.exe. All 94 .par files were byte-identical before and after. - RC.Exe genrules (msvcp90 x2, bridges x2, desktop, crashrep) run RC_EXE, a new @vs_config constant: the Win10 SDK rc.exe. crashrep takes its system includes from SDK10_INCLUDE + MSVC_INCLUDE. Every .res was byte-identical before and after. - The VC90 debug CRT is gone: @msvc_debug_crt, debug_crt_repo.bzl, the Microsoft.VC90.DebugCRT manifests and staging's dbg branch. It never matched a VS2019 /MDd binary, which imports ucrtbased/vcruntime140d; a debug soffice.exe now gets the release manifest. - vs_config_repo no longer reads VS_PATH/SDK_PATH and no longer emits VS, VC, SDK, DEBUG_CRT_DIR, LINK_WRAPPER (with msvc_link.bat) or PDB_LINK*, which nothing consumed. Left: winaccessibility's MIDL genrule still calls SDK v7.0 midl.exe; it only builds with --//build:atl_available=True. Co-Authored-By: Claude Opus 5.5 <[email protected]> --- MODULE.bazel | 2 - build/debug_crt_repo.bzl | 60 ---------- build/rules/scp2.bzl | 31 +++--- build/vs_config_repo.bzl | 154 ++++---------------------- main/bridges/BUILD.bazel | 5 +- main/crashrep/BUILD.bazel | 30 +++-- main/desktop/BUILD.bazel | 10 +- main/external/msvcp90/BUILD.bazel | 31 +----- main/external/msvcp90/vc90_debug_app.manifest | 17 --- main/staging/BUILD.bazel | 48 ++------ main/staging/Microsoft.VC90.DebugCRT.manifest | 8 -- main/staging/soffice.exe.manifest | 25 ----- 12 files changed, 76 insertions(+), 345 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 2e15f84d2b..24537e107e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -81,10 +81,8 @@ use_repo(java_toolchains, "remotejdk21_win") # --------------- build-time tools (not linked, not in registry) --------------- http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") vs_config_repo_rule = use_repo_rule("//build:vs_config_repo.bzl", "vs_config_repo") -msvc_debug_crt = use_repo_rule("//build:debug_crt_repo.bzl", "msvc_debug_crt_repo") vs_config_repo_rule(name = "vs_config") -msvc_debug_crt(name = "msvc_debug_crt") http_file( name = "apache_rat_jar", diff --git a/build/debug_crt_repo.bzl b/build/debug_crt_repo.bzl deleted file mode 100644 index 745fe4ee8e..0000000000 --- a/build/debug_crt_repo.bzl +++ /dev/null @@ -1,60 +0,0 @@ -"""VS2008 non-redistributable debug CRT repository rule. - -Stages MSVCR90D.dll and MSVCP90D.dll into a Bazel external repository so the -staging rule can include them alongside the application when building with ---compilation_mode=dbg (toolchain uses /MDd which requires the debug CRT). - -These DLLs are NOT in System32 and NOT part of any redistributable package; -they are only available on machines with a full VS2008 installation. - -The default path is derived from VS_PATH (same env var used by vs_config_repo). -Override per-machine in user.bazelrc: - build --repo_env=MSVC_DEBUG_CRT_PATH=C:\\path\\to\\Microsoft.VC90.DebugCRT - build --repo_env=VS_PATH=C:\\path\\to\\Microsoft Visual Studio 9.0 - -When MSVC_DEBUG_CRT_PATH is not set and the default path does not exist -(CI, release machines), this repository produces an empty 'dlls' filegroup -so non-debug builds are unaffected. -""" - -_DEFAULT_VS = "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0" - -_DLLS = ["msvcr90d.dll", "msvcp90d.dll", "msvcm90d.dll"] - -_BUILD_DLLS = """\ -filegroup( - name = "dlls", - srcs = glob(["*.dll"]), - visibility = ["//visibility:public"], -) -""" - -_BUILD_EMPTY = """\ -# MSVC_DEBUG_CRT_PATH not set / path not found; debug CRT DLLs unavailable. -# Add to user.bazelrc to enable: -# build --repo_env=MSVC_DEBUG_CRT_PATH=C:\\\\path\\\\to\\\\Microsoft.VC90.DebugCRT -filegroup( - name = "dlls", - srcs = [], - visibility = ["//visibility:public"], -) -""" - -def _msvc_debug_crt_impl(rctx): - vs = rctx.os.environ.get("VS_PATH", _DEFAULT_VS) - default_crt = vs + "\\VC\\redist\\Debug_NonRedist\\x86\\Microsoft.VC90.DebugCRT" - path = rctx.os.environ.get("MSVC_DEBUG_CRT_PATH", default_crt) - - for fname in _DLLS: - res = rctx.execute(["cmd", "/c", "copy", "/Y", path + "\\" + fname, fname]) - if res.return_code != 0: - # Path missing or inaccessible — produce empty repo so non-debug builds pass. - rctx.file("BUILD.bazel", _BUILD_EMPTY) - return - - rctx.file("BUILD.bazel", _BUILD_DLLS) - -msvc_debug_crt_repo = repository_rule( - implementation = _msvc_debug_crt_impl, - environ = ["MSVC_DEBUG_CRT_PATH", "VS_PATH"], -) diff --git a/build/rules/scp2.bzl b/build/rules/scp2.bzl index c0b8b7fca3..daa6fc6e83 100644 --- a/build/rules/scp2.bzl +++ b/build/rules/scp2.bzl @@ -11,29 +11,26 @@ Pipeline: cl.exe is invoked directly (not through a Perl wrapper) using /P /EP /Fi so that preprocessed output goes to a file without needing stdout capture. Perl and cl.exe paths come from @vs_config//:paths.bzl. + +cl.exe is only the C preprocessor here (/EP), so it is the modern toolset's, +the same one the win7-x64 toolchain compiles with: the host-native x64 cl.exe, +whose companions (c1.dll, mspdb140.dll, ...) sit in its own bin directory. The +.scp sources include nothing from the toolset or the SDK — only main/scp2/inc +and the generated langmacros.inc — so INCLUDE is set for completeness, not need. """ -load("@vs_config//:paths.bzl", "PERL", "SDK", "VC", "VS") +load("@vs_config//:paths.bzl", "MSVC_BIN", "MSVC_INCLUDE", "PERL", "SDK10_INCLUDE") # Absolute paths (forward slashes, constructed at load time from @vs_config). _PERL = PERL.replace("\\", "/") -_CL = VC.replace("\\", "/") + "/bin/cl.exe" +_CL = MSVC_BIN["x64"] + "/cl.exe" # INCLUDE semicolon-list for cl.exe (set as env var INCLUDE for the action). -_MSVC_INCLUDE = ( - VC.replace("\\", "/") + "/INCLUDE;" + - VC.replace("\\", "/") + "/ATLMFC/INCLUDE;" + - SDK.replace("\\", "/") + "/include" -) +_MSVC_INCLUDE = ";".join([MSVC_INCLUDE] + SDK10_INCLUDE) -# PATH for cl.exe actions — mirrors the toolchain's msvc_env_path so cl.exe -# finds mspdb90.dll (in Common7/IDE) and other VS companions at runtime. -_MSVC_ENV_PATH = ( - SDK.replace("\\", "/") + "/bin;" + - VS.replace("\\", "/") + "/Common7/IDE;" + - VC.replace("\\", "/") + "/bin;" + - VS.replace("\\", "/") + "/Common7/Tools" -) +# PATH for cl.exe actions: scp_preprocess.pl starts cl.exe by name through +# cmd.exe, and the toolset bin directory also carries its DLL companions. +_MSVC_ENV_PATH = MSVC_BIN["x64"] # Preprocessor defines (without -D prefix; the rule adds -D per entry). _SCPDEFS = [ @@ -165,8 +162,8 @@ def _scp_module_impl(ctx): # ── Step 1: scp_preprocess.pl → cl.exe /EP /Tc → .pre ──────────────── # The Perl wrapper invokes cl.exe by name (not full path) via cmd.exe, # sidestepping MSYS2 fork/exec failures for space-containing PE paths. - # PATH = _MSVC_ENV_PATH ensures cmd.exe finds cl.exe in VC\bin and - # that cl.exe's DLL companions (c1.dll, mspdb90.dll, etc.) are on PATH. + # PATH = _MSVC_ENV_PATH ensures cmd.exe finds cl.exe in the toolset bin + # directory, which also holds its DLL companions (c1.dll, mspdb140.dll). pre = ctx.actions.declare_file(stem + ".pre") ctx.actions.run( executable = ctx.attr.perl_exe, diff --git a/build/vs_config_repo.bzl b/build/vs_config_repo.bzl index c7edd098af..3d8ee3697d 100644 --- a/build/vs_config_repo.bzl +++ b/build/vs_config_repo.bzl @@ -1,10 +1,8 @@ -"""Repository rule that generates VS2008 / Windows SDK path constants. +"""Repository rule that generates MSVC toolset / Windows SDK path constants. Override per-machine in user.bazelrc (use forward slashes, double-quote the flag value so bazelrc doesn't strip backslashes): - build --repo_env="VS_PATH=C:/Program Files (x86)/Microsoft Visual Studio 9.0" - build --repo_env="SDK_PATH=C:/Program Files/Microsoft SDKs/Windows/v7.0" build --repo_env="MSVC_TMP=C:/Users/<you>/AppData/Local/Temp" build --repo_env="PERL_PATH=C:/msys64/usr/bin/perl.exe" build --repo_env="VS_MODERN_PATH=C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools" @@ -12,8 +10,13 @@ flag value so bazelrc doesn't strip backslashes): build --repo_env="MSVC_TOOLSET_VERSION=14.29.30133" # optional pin build --repo_env="WIN10_SDK_VERSION=10.0.19041.0" # optional pin -The generated @vs_config//:paths.bzl exposes VS, VC, SDK, MSVC_TMP, -PERL, DEBUG_CRT_DIR, LINK_WRAPPER, and PDB_LINK. +The generated @vs_config//:paths.bzl exposes MSVC_TMP and PERL, the toolset +constants (MSVC_*), the SDK constants (SDK10_*) and RC_EXE, below. + +VS2008 (VS_PATH) and SDK v7.0 (SDK_PATH) are no longer read. They outlived +the VC9 toolchains (retired 2026-11-01) as scp2's preprocessor, the VC90 debug +CRT, an mspdbsrv link wrapper and a hard-coded RC.Exe in a few genrules; all of +those now use the tools below. ## Modern toolchain discovery (win7 target, M1) @@ -33,7 +36,10 @@ overridable with an explicit version pin: bin\\<ver>\\<arch> (rc.exe, mt.exe) Exposed as SDK10_VER, SDK10_ROOT, SDK10_INCLUDE (list, in the order they - belong on INCLUDE), SDK10_LIB and SDK10_BIN (dicts keyed by arch). + belong on INCLUDE), SDK10_LIB and SDK10_BIN (dicts keyed by arch), and + RC_EXE: the host-native (x64) rc.exe, in backslash form so a genrule's + cmd_bat can run it as-is. rc.exe output does not depend on the target + arch, so there is one. Version selection is **newest-first by numeric component** (so 14.9 sorts below 14.29, which a plain string compare gets wrong), restricted to versions that are @@ -47,41 +53,15 @@ MODERN_MSVC_TOOLSET_NOT_FOUND / WIN10_SDK_NOT_FOUND rather than "" — an empty string silently degrades into a valid-looking relative path, while the sentinel puts its own name into the first compiler error. -PDB_LINK is a modern MSVC link.exe (auto-discovered under VS_MODERN_PATH). -The C++ toolchain routes generate_pdb (debug .pdb) links to it instead of -VC9 link.exe: the VC9 linker's single mspdbsrv cannot write PDBs in parallel -(LNK1318 0x6BA, no /FS), while a modern link.exe reads the VC9 /Z7 objects -natively and its mspdbsrv handles parallel PDB writes — so debug builds run -at full --jobs. (LLVM lld-link was evaluated and rejected: it cannot write -PDBs from VC9-era CodeView — "Stream too short".) Non-PDB links stay on VC9 -link.exe via LINK_WRAPPER, below, so shipped binaries are unchanged. - -LINK_WRAPPER is a generated batch file that wraps link.exe and gives every -link action its own _MSPDBSRV_ENDPOINT_ (derived from the unique per-target -linker param-file name). This stops concurrent /DEBUG links from sharing one -mspdbsrv.exe instance — the shared server falls over under parallelism with -LNK1318 RPC_S_SERVER_UNAVAILABLE (0x6BA), which is the only reason debug builds -ever needed --jobs=1. Routing all links through the wrapper lets debug builds -run fully parallel. VS2008/VC9 has no /FS flag (added in VS2013), so the -per-process endpoint is the only fix available here. - -Endpoint isolation prevents shared-server *corruption*, but each isolated link -must still spawn its own mspdbsrv.exe, and a wide parallel link phase can still -transiently lose the RPC handshake (LNK1318 0x6BA) when many servers start at -once. So the wrapper also retries link.exe on LNK1318 with a linear backoff, -handing each attempt a *fresh* endpoint (…_a1, _a2, …) so a retry never -reconnects to a half-dead server from the previous try. Non-PDB link errors -(unresolved externals, etc.) are detected and returned immediately without -wasting retries. Tunable via LINK_MAX_RETRY / LINK_RETRY_BASE_SEC env vars. +There is no link.exe wrapper. The VC9 toolchains needed one (LINK_WRAPPER: a +private mspdbsrv endpoint per link plus retry on LNK1318, because the VC9 linker +has one mspdbsrv and no /FS) and borrowed the modern link.exe for their PDB +links (PDB_LINK). The modern linker writes its own PDBs in parallel unaided. """ -_DEFAULT_VS = "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0" -_DEFAULT_SDK = "C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0" _DEFAULT_TMP = "C:\\Temp" _DEFAULT_PERL = "C:\\msys64\\usr\\bin\\perl.exe" -# Modern MSVC (VS2017+/BuildTools) install root. Two consumers: the win7 -# toolchain proper, and the newer link.exe the VC9 toolchains use for their -# generate_pdb path (see _find_msvc_toolset / _modern_link / PDB_LINK below). +# Modern MSVC (VS2017+/BuildTools) install root, for the win7 toolchain. _DEFAULT_VS_MODERN = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools" _DEFAULT_WIN10_SDK = "C:\\Program Files (x86)\\Windows Kits\\10" @@ -232,35 +212,15 @@ def _find_win10_sdk(rctx, sdk_root, pin): best_key = key return best -def _modern_link(toolset, target): - """The modern link.exe for `target`, used by the VC9 toolchains' generate_pdb path. - - The VC9 link.exe cannot write PDBs in parallel (single mspdbsrv, no /FS, the - LNK1318 bug); LLVM lld-link cannot write PDBs from VC9-era CodeView at all - ("Stream too short"). A modern MSVC link.exe reads the VC9 /Z7 objects natively - and its mspdbsrv handles parallel PDB writes, so the generate_pdb link path - uses it. Returns a placeholder if none is found (only breaks generate_pdb builds). - """ - if toolset == None: - return "modern_link_not_found.bat" - return toolset.bin[target] + "/link.exe" - def _vs_config_impl(rctx): - vs = rctx.os.environ.get("VS_PATH", _DEFAULT_VS) - sdk = rctx.os.environ.get("SDK_PATH", _DEFAULT_SDK) tmp = rctx.os.environ.get("MSVC_TMP", _DEFAULT_TMP) perl = rctx.os.environ.get("PERL_PATH", _DEFAULT_PERL) vs_modern = rctx.os.environ.get("VS_MODERN_PATH", _DEFAULT_VS_MODERN) sdk10 = rctx.os.environ.get("WIN10_SDK_PATH", _DEFAULT_WIN10_SDK) - vc = vs + "\\VC" toolset = _find_msvc_toolset(rctx, vs_modern, rctx.os.environ.get("MSVC_TOOLSET_VERSION")) sdk10_found = _find_win10_sdk(rctx, sdk10, rctx.os.environ.get("WIN10_SDK_VERSION")) - pdb_link = _modern_link(toolset, "x86") - pdb_link_x64 = _modern_link(toolset, "x64") - debug_crt = vc + "\\redist\\Debug_NonRedist\\x86\\Microsoft.VC90.DebugCRT" - def q(p): return p.replace("\\", "\\\\") @@ -270,69 +230,6 @@ def _vs_config_impl(rctx): def q_dict(d, value_fmt): return "{" + ", ".join(['"{}": {}'.format(k, value_fmt(d[k])) for k in sorted(d)]) + "}" - # link.exe wrapper: per-action _MSPDBSRV_ENDPOINT_ so concurrent /DEBUG links - # each get a private mspdbsrv.exe instead of sharing one (LNK1318 0x6BA), plus - # a bounded retry-with-backoff on LNK1318 (fresh endpoint per attempt) for the - # residual "server unavailable" that isolation alone can't prevent. - # The endpoint is derived from the linker @param-file name (unique per target, - # always on the command line); falls back to %RANDOM% if no @file is present. - # Output is captured so we can tell a transient PDB failure (retry) from a real - # link error (return immediately). Dynamic wait grows linearly per attempt. - link_exe = vc + "\\bin\\link.exe" - bat = "\r\n".join([ - "@echo off", - "setlocal enabledelayedexpansion", - # The action PATH is just VC\\bin; findstr/ping (used below for the LNK1318 - # retry classifier and its backoff) live in System32 — put it on PATH. - # Appended, so the VC9 toolchain binaries still take precedence. - "set \"PATH=%PATH%;%SystemRoot%\\System32\"", - "set \"ep=\"", - "for %%A in (%*) do (", - " set \"arg=%%A\"", - " if \"!arg:~0,1!\"==\"@\" set \"ep=!arg!\"", - ")", - "if not defined ep set \"ep=%RANDOM%%RANDOM%\"", - "set \"ep=!ep:@=!\"", - "set \"ep=!ep:\\=_!\"", - "set \"ep=!ep:/=_!\"", - "set \"ep=!ep:.=_!\"", - "set \"ep=!ep::=_!\"", - # Tunables (override via --action_env at build time), with sane defaults. - "if not defined LINK_MAX_RETRY set \"LINK_MAX_RETRY=5\"", - "if not defined LINK_RETRY_BASE_SEC set \"LINK_RETRY_BASE_SEC=2\"", - # Log name MUST be unique per concurrent link. %RANDOM% is clock-seeded, so - # links launched in the same tick (e.g. the 7 applauncher EXEs) collided on - # one log path → the second '>' redirect hit ERROR_SHARING_VIOLATION and the - # link never ran ("output X was not created"). !ep! is derived from the - # per-target @param-file name, so it is unique across concurrent targets. - "set \"log=%TEMP%\\bzl_link_!ep!.log\"", - "set \"n=0\"", - ":retry", - "set /a n+=1", - # Fresh endpoint each attempt so a retry spawns a brand-new mspdbsrv.exe - # instead of reconnecting to a hung/half-dead one from the previous try. - "set \"_MSPDBSRV_ENDPOINT_=bzl_!ep!_a!n!\"", - "\"" + link_exe + "\" %* > \"!log!\" 2>&1", - "set \"rc=!ERRORLEVEL!\"", - "if !rc! equ 0 goto done", - # Only LNK1318 (PDB RPC) is transient; anything else is a real failure. - "findstr /c:\"LNK1318\" \"!log!\" >nul", - "if errorlevel 1 goto done", - "if !n! geq !LINK_MAX_RETRY! goto done", - "set /a wait=!n!*!LINK_RETRY_BASE_SEC!", - "set /a pings=!wait!+1", - "echo [msvc_link] LNK1318 PDB RPC error; retry !n!/!LINK_MAX_RETRY! after !wait!s (endpoint bzl_!ep!_a!n!)>&2", - "ping -n !pings! 127.0.0.1 >nul", - "goto retry", - ":done", - "type \"!log!\"", - "del \"!log!\" >nul 2>&1", - "exit /b !rc!", - "", - ]) - rctx.file("msvc_link.bat", bat) - link_wrapper = str(rctx.path("msvc_link.bat")) - # ── modern MSVC toolset (win7 target) ─────────────────────────────────── if toolset != None: modern = [ @@ -348,8 +245,7 @@ def _vs_config_impl(rctx): else: modern = [ "# No modern MSVC toolset found under VS_MODERN_PATH — the win7 toolchain", - "# cannot resolve, and generate_pdb links on the VC9 toolchains fall back to", - "# a placeholder. Set --repo_env=VS_MODERN_PATH in user.bazelrc.", + "# cannot resolve. Set --repo_env=VS_MODERN_PATH in user.bazelrc.", 'MSVC_TOOLSET_VER = "{}"'.format(_NO_TOOLSET), 'MSVC_TOOLSET = "{}"'.format(_NO_TOOLSET), 'MSVC_HOST = "{}"'.format(_NO_TOOLSET), @@ -369,6 +265,7 @@ def _vs_config_impl(rctx): "SDK10_INCLUDE = {}".format(q_list(sdk10_found.include)), "SDK10_LIB = {}".format(q_dict(sdk10_found.lib, q_list)), "SDK10_BIN = {}".format(q_dict(sdk10_found.bin, lambda v: '"{}"'.format(q(v)))), + 'RC_EXE = "{}"'.format(q(sdk10_found.bin["x64"].replace("/", "\\") + "\\rc.exe")), ] else: kit = [ @@ -380,20 +277,15 @@ def _vs_config_impl(rctx): "SDK10_INCLUDE = {}".format(q_list([_NO_SDK10])), "SDK10_LIB = {}".format(q_dict({a: [_NO_SDK10] for a in _ARCHES}, q_list)), "SDK10_BIN = {}".format(q_dict({a: _NO_SDK10 for a in _ARCHES}, lambda v: '"{}"'.format(v))), + 'RC_EXE = "{}"'.format(_NO_SDK10), ] content = "\n".join([ "# Auto-generated by //build:vs_config_repo.bzl — do not edit.", - "# Set VS_PATH / SDK_PATH / MSVC_TMP / PERL_PATH via --repo_env in user.bazelrc.", - 'VS = "{}"'.format(q(vs)), - 'VC = "{}"'.format(q(vc)), - 'SDK = "{}"'.format(q(sdk)), + "# Set MSVC_TMP / PERL_PATH / VS_MODERN_PATH / WIN10_SDK_PATH via --repo_env", + "# in user.bazelrc.", 'MSVC_TMP = "{}"'.format(q(tmp)), 'PERL = "{}"'.format(q(perl)), - 'DEBUG_CRT_DIR = "{}"'.format(q(debug_crt)), - 'LINK_WRAPPER = "{}"'.format(q(link_wrapper)), - 'PDB_LINK = "{}"'.format(q(pdb_link)), - 'PDB_LINK_X64 = "{}"'.format(q(pdb_link_x64)), "", ] + modern + [""] + kit + [""]) rctx.file("paths.bzl", content) @@ -402,8 +294,6 @@ def _vs_config_impl(rctx): vs_config_repo = repository_rule( implementation = _vs_config_impl, environ = [ - "VS_PATH", - "SDK_PATH", "MSVC_TMP", "PERL_PATH", "VS_MODERN_PATH", diff --git a/main/bridges/BUILD.bazel b/main/bridges/BUILD.bazel index 971b5965fa..5aadd1dccd 100644 --- a/main/bridges/BUILD.bazel +++ b/main/bridges/BUILD.bazel @@ -7,6 +7,7 @@ load("//build/rules:idl_pipeline.bzl", "idl_library") load("//build/rules:java_pipeline.bzl", "javamaker_classes", "jar_from_directory", "uno_jar") load("//build/rules:native_lib_dir.bzl", "native_lib_dir") load("//build/rules:java_run_test.bzl", "staged_java_test") +load("@vs_config//:paths.bzl", "RC_EXE") _COPTS = [ "/Zm500", "/Zc:forScope", "/GR", "/nologo", "/Gs", @@ -470,7 +471,7 @@ genrule( ], outs = ["jni_test_launcher.res"], cmd_bat = ( - "set \"_RC=C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Bin\\RC.Exe\"&&" + + "set \"_RC=" + RC_EXE + "\"&&" + "\"!_RC!\" /nologo /I \"main/external/msvcp90\"" + " /fo \"$(OUTS)\" \"$(location test/jni_test_launcher.rc)\"" ), @@ -597,7 +598,7 @@ genrule( ], outs = ["transport_manifest.res"], cmd_bat = ( - "set \"_RC=C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Bin\\RC.Exe\"&&" + + "set \"_RC=" + RC_EXE + "\"&&" + "\"!_RC!\" /nologo /I \"main/external/msvcp90\"" + " /fo \"$(OUTS)\" \"$(location test/java_uno/any/transport.rc)\"" ), diff --git a/main/crashrep/BUILD.bazel b/main/crashrep/BUILD.bazel index cdb27e441e..6eeadeb7d2 100644 --- a/main/crashrep/BUILD.bazel +++ b/main/crashrep/BUILD.bazel @@ -3,6 +3,7 @@ package(default_visibility = ["//visibility:public"]) load("@rules_cc//cc:defs.bzl", "cc_binary") load("//build/rules:lngconvex_rule.bzl", "lngconvex_rc") load("@product_info//:defs.bzl", "SUPD_DEFINE") +load("@vs_config//:paths.bzl", "MSVC_INCLUDE", "RC_EXE", "SDK10_INCLUDE") # ── versionlist.hrc — parsed from version.lst ──────────────────────────────── # version.hrc (pulled into soreport.rc via rcheader.txt) does @@ -36,12 +37,22 @@ lngconvex_rc( ) # ── soreport.res — Windows resource binary compiled by RC.Exe ──────────────── -# RC.Exe needs three include directories: -# 1. Windows SDK Include — for <winresrc.h> and <winver.h> -# 2. main/solenv/inc — for version.hrc and verinfo.hrc -# 3. main/crashrep/source/win32 — for resource.h (quoted include in rcheader.txt) -# versionlist.hrc (generated above) is placed in $(RULEDIR) which is added last +# RC.Exe needs these include directories: +# 1. Windows SDK include trees — for <winresrc.h> and <winver.h> +# 2. the MSVC toolset include — for sal.h, which is not in the SDK (dmake +# inherited it through the INCLUDE that vcvarsall.bat set) +# 3. main/solenv/inc — for version.hrc and verinfo.hrc +# 4. main/crashrep/source/win32 — for resource.h (quoted include in rcheader.txt) +# versionlist.hrc (generated above) is placed in $(RULEDIR) which is added first # so it shadows the non-existent copy in solenv/inc that version.hrc looks for. +# rc.exe and the include trees are the Windows 10 SDK's and the VS2019 toolset's +# (@vs_config); the .res was byte-identical to the SDK v7.0 / VS2008 one when the +# switch was made. +_RC_SYS_INCLUDES = "".join([ + " /I \"" + d.replace("/", "\\") + "\"" + for d in SDK10_INCLUDE + [MSVC_INCLUDE] +]) + genrule( name = "soreport_res", srcs = [ @@ -53,19 +64,14 @@ genrule( ], outs = ["soreport.res"], cmd_bat = ( - "set \"_RC=C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Bin\\RC.Exe\"&&" + - "set \"_SDK_INC=C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Include\"&&" + - # sal.h lives in VC/include, not in the SDK — dmake inherited it via - # the INCLUDE env var set by vcvarsall.bat; pass it explicitly here. - "set \"_VC_INC=C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\include\"&&" + + "set \"_RC=" + RC_EXE + "\"&&" + "set \"_SOLENV=main/solenv/inc\"&&" + "set \"_CR_INC=main/crashrep/source/win32\"&&" + # versionlist.hrc lives in $(RULEDIR); RC.exe searches /I paths in order, # so list $(RULEDIR) before _SOLENV so it finds the generated file. "\"!_RC!\" /nologo /DWIN32" + " /I \"$(RULEDIR)\"" + - " /I \"!_SDK_INC!\"" + - " /I \"!_VC_INC!\"" + + _RC_SYS_INCLUDES + " /I \"!_SOLENV!\"" + " /I \"!_CR_INC!\"" + " /fo \"$(OUTS)\"" + diff --git a/main/desktop/BUILD.bazel b/main/desktop/BUILD.bazel index f9d245050a..e3c6041375 100644 --- a/main/desktop/BUILD.bazel +++ b/main/desktop/BUILD.bazel @@ -5,6 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") load("//build/rules:rsc_pipeline.bzl", "rsc_res") load("//build/rules:gtest_test.bzl", "gtest_test") load("@product_info//:defs.bzl", "SUPD_DEFINE") +load("@vs_config//:paths.bzl", "RC_EXE") # ── Common compile settings ─────────────────────────────────────────────────── _DEFINES = [ @@ -722,11 +723,12 @@ filegroup( # #include ooverinfo2.rc). # # fix_icon_rc.pl regenerates ooverinfo2.rc's entries with MS rc's required -# "<id> ICON" token order (the upstream "ICON <id>" form makes the strict v7.0 +# "<id> ICON" token order (the upstream "ICON <id>" form made the strict SDK v7.0 # rc.exe treat the .ico as RT_BITMAP -> RC2170) and skips its stale references to # renamed app icons (now ooo3_*_app.ico) that no longer exist. Original icons, -# no frame stripping — compiles on the configured v7.0 SDK. Icon "icons/<f>.ico" -# paths resolve via rc /I main/sysui/desktop. RC path mirrors crashrep. +# no frame stripping. Icon "icons/<f>.ico" paths resolve via rc /I +# main/sysui/desktop. rc.exe is the Windows 10 SDK's (RC_EXE, @vs_config); its +# .res was byte-identical to the SDK v7.0 one when the switch was made. genrule( name = "soffice_icon_res", srcs = [ @@ -740,7 +742,7 @@ genrule( " main/sysui/desktop/icons" + " \"$(execpath util/ooverinfo2.rc)\"" + " soffice_icons.rc&&" + - "set \"_RC=C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Bin\\RC.Exe\"&&" + + "set \"_RC=" + RC_EXE + "\"&&" + "\"!_RC!\" /nologo /DWIN32" + " /I \"main/sysui/desktop\"" + " /fo \"$(OUTS)\"" + diff --git a/main/external/msvcp90/BUILD.bazel b/main/external/msvcp90/BUILD.bazel index afba55a9e7..bf21a2c4e7 100644 --- a/main/external/msvcp90/BUILD.bazel +++ b/main/external/msvcp90/BUILD.bazel @@ -1,3 +1,5 @@ +load("@vs_config//:paths.bzl", "RC_EXE") + filegroup( name = "msvcp90", srcs = [":crt_dlls"], @@ -76,7 +78,7 @@ genrule( ], outs = ["vc90_app_manifest.res"], cmd_bat = ( - "set \"_RC=C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Bin\\RC.Exe\"&&" + + "set \"_RC=" + RC_EXE + "\"&&" + "\"!_RC!\" /nologo /I \"main/external/msvcp90\"" + " /fo \"$(OUTS)\" \"$(location :vc90_app_manifest_rc)\"" ), @@ -104,34 +106,9 @@ genrule( ], outs = ["vc90_dll_manifest.res"], cmd_bat = ( - "set \"_RC=C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Bin\\RC.Exe\"&&" + + "set \"_RC=" + RC_EXE + "\"&&" + "\"!_RC!\" /nologo /I \"main/external/msvcp90\"" + " /fo \"$(OUTS)\" \"$(location :vc90_dll_manifest_rc)\"" ), visibility = ["//visibility:public"], ) - -# ── Debug CRT (/MDd, --compilation_mode=dbg) ───────────────────────────────── -# The debug analog of crt_dlls. Under --compilation_mode=dbg the toolchain -# links /MDd, so binaries import MSVCR90D.dll / MSVCP90D.dll / MSVCM90D.dll, -# which are NOT in System32 or any redistributable. @msvc_debug_crt copies them -# from a VS2008 install (empty filegroup when unavailable — see -# build/debug_crt_repo.bzl). The private-assembly manifest lets the loader -# resolve them from the app dir instead of WinSxS. Mirrors the debug branch of -# //main/staging:all_files. -filegroup( - name = "debug_crt_dlls", - srcs = [ - "@msvc_debug_crt//:dlls", - "Microsoft.VC90.DebugCRT.manifest", - ], - visibility = ["//visibility:public"], -) - -# Debug analog of vc90_app_manifest: staged as <exe>.exe.manifest beside a /MDd -# EXE so it declares the Microsoft.VC90.DebugCRT private-assembly dependency. -filegroup( - name = "vc90_debug_app_manifest", - srcs = ["vc90_debug_app.manifest"], - visibility = ["//visibility:public"], -) diff --git a/main/external/msvcp90/vc90_debug_app.manifest b/main/external/msvcp90/vc90_debug_app.manifest deleted file mode 100644 index 0d2d292bf0..0000000000 --- a/main/external/msvcp90/vc90_debug_app.manifest +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> - <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> - <security> - <requestedPrivileges> - <requestedExecutionLevel level="asInvoker" uiAccess="false"/> - </requestedPrivileges> - </security> - </trustInfo> - <dependency> - <dependentAssembly> - <assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" - version="9.0.30729.1" processorArchitecture="x86" - publicKeyToken="1fc8b3b9a1e18e3b"/> - </dependentAssembly> - </dependency> -</assembly> diff --git a/main/staging/BUILD.bazel b/main/staging/BUILD.bazel index 6e73bd4f6f..842868b1e6 100644 --- a/main/staging/BUILD.bazel +++ b/main/staging/BUILD.bazel @@ -96,29 +96,6 @@ filegroup( ], ) -# ── Debug-mode application manifest ────────────────────────────────────────── -# When --compilation_mode=dbg, toolchain uses /MDd which requires MSVCR90D.dll. -# Without an EXE manifest, Windows can't activate the debug CRT SxS assembly -# and raises R6034. This manifest declares Microsoft.VC90.DebugCRT as a -# private assembly dependency so Windows resolves it from program/ instead of -# WinSxS (which doesn't carry the debug CRT on non-developer machines). -# Must be paired with Microsoft.VC90.DebugCRT.manifest (from @msvc_debug_crt). -# It ALSO declares Microsoft.Windows.Common-Controls 6.0.0.0 — same as the release -# manifest below — to enable visual styles; without it OpenThemeData() returns NULL, -# IsNativeControlSupported() is FALSE for all controls, and VCL silently uses bitmap -# radio/checkbox indicators (debug-only divergence from release). -filegroup( - name = "soffice_exe_manifest", - srcs = [ - # EXE application manifest — declares Microsoft.VC90.DebugCRT + - # Microsoft.Windows.Common-Controls (visual styles) dependencies. - "soffice.exe.manifest", - # Private SxS assembly manifest — tells Windows to resolve msvcr90d.dll - # and msvcp90d.dll from program\ rather than WinSxS. - "Microsoft.VC90.DebugCRT.manifest", - ], -) - # Release application manifest for soffice.exe — declares the Microsoft.VC90.CRT # dependency so Windows consults SxS/publisher-policy and loads MSVCR90.dll from # WinSxS with an activation context (no R6034). Wrapped in a filegroup because @@ -491,18 +468,8 @@ collect_outputs( "//main/extensions:oleautobridge.uno", ], "//conditions:default": [], - }) + select({ - # Debug CRT DLLs (MSVCR90D.dll, MSVCP90D.dll) and private-assembly - # manifest — required when the toolchain uses /MDd (--compilation_mode=dbg). - # The DLLs are not in System32; the manifest suppresses R6034 by - # activating Microsoft.VC90.DebugCRT as a private SxS assembly. - # Set MSVC_DEBUG_CRT_PATH in user.bazelrc if VS2008 is not at the - # default path (see //build:vs_paths.bzl). - "//build:dbg_build": [ - "@msvc_debug_crt//:dlls", - ":soffice_exe_manifest", - ], - # Release (/MD): do NOT bundle app-local CRT DLLs. Instead stage the + }) + [ + # Do NOT bundle app-local CRT DLLs. Instead stage the # application manifest so soffice.exe declares a Microsoft.VC90.CRT # 9.0.30729.1 dependency. That manifest is what makes Windows consult # SxS: the installed VC90 publisher policy @@ -517,10 +484,13 @@ collect_outputs( # machines lacking the VC9 redist would additionally ship the CRT as a # program\Microsoft.VC90.CRT\ subfolder private assembly + hash-free # manifest; on a dev box with the redist installed WinSxS covers it.) - "//conditions:default": [ - ":soffice_app_manifest", - ], - }) + select({ + # The same manifest serves --compilation_mode=dbg: the VS2008 debug CRT + # (MSVCR90D, Microsoft.VC90.DebugCRT) once staged for /MDd left with the + # VC9 toolchains; a /MDd build now imports the VS2019 debug runtime + # (ucrtbased, vcruntime140d), which needs no manifest. Keeping the + # release manifest also keeps Common-Controls 6 (visual styles) on. + ":soffice_app_manifest", + ] + select({ # C++/UNO bridge, loaded by name from CPPU_ENV: msci_uno.dll on x86, # mscx_uno.dll on x64. Each target is target_compatible_with its own # arch, so the unused one must not appear in the other arch's deps. diff --git a/main/staging/Microsoft.VC90.DebugCRT.manifest b/main/staging/Microsoft.VC90.DebugCRT.manifest deleted file mode 100644 index 31a781848a..0000000000 --- a/main/staging/Microsoft.VC90.DebugCRT.manifest +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> - <noInheritable></noInheritable> - <assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.30729.1" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity> - <file name="msvcr90d.dll" hashalg="SHA1" hash="77c2dcb12982a6855302844f8803e68ce360fcc9"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>WA59/AbhIDaZgmB1cN9MFlDi2g4=</dsig:DigestValue></asmv2 [...] - <file name="msvcp90d.dll" hashalg="SHA1" hash="b2fa2a05ee7e6a2595c16547246753a62e9bf398"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>Rxofhw9S95owIW2MDmCg2zStQgs=</dsig:DigestValue></asmv2 [...] - <file name="msvcm90d.dll" hashalg="SHA1" hash="6cfc0c6330724d86db3e2ef295d4e1d75a43514a"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>iOxEMZK3fufMDQFuKGZ4VdAYzWY=</dsig:DigestValue></asmv2 [...] -</assembly> diff --git a/main/staging/soffice.exe.manifest b/main/staging/soffice.exe.manifest deleted file mode 100644 index d60e50fe98..0000000000 --- a/main/staging/soffice.exe.manifest +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> - <assemblyIdentity version="1.0.0.0" processorArchitecture="x86" name="OpenOffice" type="win32" /> - <description>http://www.openoffice.org</description> - <!-- comctl32 v6: enables Windows visual styles for this process. Without it - OpenThemeData() returns NULL, IsNativeControlSupported() is FALSE for every - control, and VCL falls back to bitmap radio/checkbox indicators. The release - manifest (//main/desktop:util/soffice.exe.manifest) already declares this; the - debug manifest must too, or native theming is silently off in debug builds. --> - <dependency> - <dependentAssembly> - <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="x86"/> - </dependentAssembly> - </dependency> - <dependency> - <dependentAssembly> - <assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.30729.1" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/> - </dependentAssembly> - </dependency> - <dependency> - <dependentAssembly> - <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.9635" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/> - </dependentAssembly> - </dependency> -</assembly>
