Windows MSVC: headerless bootstrap UCRT mock duplicates __acrt_iob_func at link

Open
#32,703 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
12/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
c, shell
Domain
testing-qa

Research direction

Start with vlib/v/gen/c/bootstrap_windows_helpers_test.v, specifically test_bootstrap_windows_streams_reuse_crt_owned_file_objects and bootstrap_windows_run_c, then reproduce the LNK2005 link failure for the ucrt variant on native Windows with the LLVM clang.exe link line. Done means the mock __acrt_iob_func receives the calls in all four CRT modes, the test passes via ./v -silent, and ./v self and the formatter still pass without weakening the assertion.

Written by the indexing model from the issue text.

Description

Executed master CI failure

Master d8083d40873efc7689abdb15f4ca21b4f5d59f4a Windows MSVC selftest shard 3/4 job 136897142690, completed 2026-11-21 16:34Z after 437 passing tests / 163 skipped, ran vlib/v/gen/c/bootstrap_windows_helpers_test.v. The test test_bootstrap_windows_streams_reuse_crt_owned_file_objects calls bootstrap_windows_run_c() for four CRT variants; the ucrt case defines void* __acrt_iob_func(unsigned int) in the probe. The nested Visual Studio LLVM Clang links against libucrt.lib, which also defines __acrt_iob_func: LNK2005 ... already defined in probe-*.o, then LNK1169 and Clang exits 1169. The assertion expects the C mock to compile and run; failure is at native link, not a V Cgen parser error, and not a GitHub job timeout.

At failing SHA and current master c5d66aae3bc4865f2d18c6c225fc94e2ac374606, bootstrap_windows_helpers_test.v is blob 104cadf5ced05b3e1e707d953f335c508944ead7. Its test of all UCRT/TCC64/TCC32 DLL/CRT variants intentionally asserts 100,000×3 reads use the mock-owned stream address. Do not weaken/remove it or accept a link that binds to the actual CRT instead.

Next fix experiment

Reproduce on native Windows with the exact LLVM clang.exe path and clang -v link line; distinguish explicit UCRT library insertion from compiler default CRT selection. Test a hermetic no-CRT C probe harness or a safe symbol remapping that preserves the generated headerless helper body's ABI and all four mock modes; separately test MinGW GCC as a compatible C compiler. Confirm the actual mock function receives the calls (not just exit 0) and run the original ./v -silent vlib/v/gen/c/bootstrap_windows_helpers_test.v, ./v self, and formatter before claiming validation. UNRESOLVED, no native Windows V available locally; this is a real but distinct issue from Windows tests choosing MSVC-target Clang when requiring MinGW programs.

[!NOTE]
You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Dominant language
V
Stars
38.1k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
682

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vlang/v

All issues in vlang/v

Similar issues

More Testing & QA issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.