Fix Windows build: patch marisa-trie to remove VERSION file#1084
Merged
Fix Windows build: patch marisa-trie to remove VERSION file#1084
Conversation
On Windows (case-insensitive filesystem), MSVC's resolution of
`#include <version>` matches the literal file named `VERSION` at the
root of the marisa-trie external repo, because Bazel adds the repo root
to compiler include paths (`-Iexternal/marisa-trie+`) so that headers
like `marisa/trie.h` can be found. The preprocessor reads `VERSION`
(containing only `0.3.1`) as C++ and fails:
external\marisa-trie+\version(1): error C2059: syntax error: 'constant'
On Linux/macOS the filesystem is case-sensitive, so `<version>` never
matches `VERSION` and the real standard header is found normally.
Fix: add a `single_version_override` patch that deletes the `VERSION`
file from the marisa-trie source tree before Bazel uses the repo.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 tasks
…sion-file-windows
UebelAndre
pushed a commit
to bazelbuild/bazel-central-registry
that referenced
this pull request
Apr 14, 2026
## Summary - Add `marisa-trie@0.3.1.bcr.1` with a patch that removes the `VERSION` file from the source tree - Fixes Windows build failure where MSVC's `#include <version>` (C++ standard header) resolves to the `VERSION` data file on case-insensitive filesystems ### Problem On Windows, any target that depends on `marisa-trie` fails to compile with: ``` external\marisa-trie+\version(1): error C2059: syntax error: 'constant' ``` ### Root cause marisa-trie ships a file named `VERSION` (containing only `0.3.1`) at its repo root. Bazel adds the external repo root to the compiler's include search path (`-Iexternal/marisa-trie+`) so that headers like `marisa/trie.h` can be found. On Windows, the filesystem is **case-insensitive**. When MSVC resolves `#include <version>` (a C++17/20 standard header included transitively by other standard headers), it searches the include paths and matches the `VERSION` data file instead of the real `<version>` standard header. The preprocessor then reads `0.3.1` as C++ source and fails to parse it. On Linux and macOS the filesystem is **case-sensitive**, so `<version>` never matches `VERSION` and the real standard header is found normally. This is why the bug only manifests on Windows. ### Fix Add a patch that deletes the `VERSION` file from the marisa-trie source tree before Bazel uses the repo. With the file gone, MSVC's `#include <version>` lookup correctly finds the standard library header. See BYVoid/OpenCC#1084 for the original report and rationale. @bazel-io skip_check unstable_url ## Test plan - [x] `bazel run //tools:bcr_validation -- --check marisa-trie@0.3.1.bcr.1` passes - [x] BCR presubmit CI passes on all platforms (debian10, ubuntu2004, macos, macos_arm64, windows) × (bazel 7.x, 8.x, 9.x)
3 tasks
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.
Problem
On Windows, any target that depends on
marisa-triefailed to compile with:Root cause
marisa-trie ships a file named
VERSION(containing only0.3.1) at its repo root. Bazel adds the external repo root to the compiler's include search path (-Iexternal/marisa-trie+) so that headers likemarisa/trie.hcan be found.On Windows, the filesystem is case-insensitive. When MSVC resolves
#include <version>(a C++17/20 standard header included transitively by other standard headers), it searches the include paths and matches theVERSIONdata file instead of the real<version>standard header. The preprocessor then reads0.3.1as C++ source and fails to parse it.On Linux and macOS the filesystem is case-sensitive, so
<version>never matchesVERSIONand the real standard header is found normally. This is why the bug only manifests on Windows.Fix
Add a
single_version_overridepatch inMODULE.bazelthat deletes theVERSIONfile from the marisa-trie source tree before Bazel uses the repo. With the file gone, MSVC's#include <version>lookup correctly finds the standard library header.Test plan
bazel build //...succeeds on Windows (no moreerror C2059from marisa-trie)🤖 Generated with Claude Code