Skip to content

Windows: stage1 build out/gen/main.w links libucrt.lib and ucrt.lib together (duplicate _invalid_parameter_noinfo, _wctype) — the selfhost-windows failure probe cannot build the compiler #1267

Closed

Description

@ehartford

Seen on the windows x86_64 lane of #1266 (run 35678311881, job 106589444511), step Stage diagnostics on failure, probe WITH_CODEGEN_UNITS=1 WITH_PROFILE=1 ./out/bootstrap/bin/with-stage1.exe build out/gen/main.w -O1 -o out/probe-single.exe:

lld-link: error: duplicate symbol: _invalid_parameter_noinfo
>>> defined at minkernel\crts\ucrt\src\appcrt\misc\invalid_parameter.cpp:129
>>>            libucrt.lib(invalid_parameter.obj)
>>> defined at ucrt.lib(api-ms-win-crt-runtime-l1-1-0.dll)
lld-link: error: duplicate symbol: _wctype
>>> defined at libucrt.lib(ctype.obj)
>>> defined at ucrt.lib(api-ms-win-crt-string-l1-1-0.dll)
error: build failed

The compiler's own build (build.w, :stage1/:stage2) links the LLVM SDK archives (built MultiThreaded, static UCRT) with a matching CRT choice; the user-program path with build file.w adds the dynamic ucrt.lib, so building the compiler through it mixes both CRTs on Windows. The probe in .github/workflows/selfhost-windows.yml ("Stage diagnostics on failure") therefore never produces a binary — it only adds link errors to a failing lane's log.

Fix direction: one CRT selection in Link.w for any link that pulls the LLVM/Clang archives (static UCRT, /NODEFAULTLIB:ucrt.lib or drop ucrt.lib when libucrt.lib is in), so the compiler builds identically through build.w and with build main.w; then the probe is meaningful. Link.w change → its own batch.

Activity

  1. ehartford commented on Oct 2, 2026

    @ehartford
    ContributorAuthor

    Fixed on main 1688728 — Windows is windows-gnu now (mingw-w64 UCRT via the SDK's own libc, #1931/#1937), so there is no libucrt.lib/ucrt.lib pair to mix; eb49da3 (#1329) had already made the CRT decision a single read of the link plan.

    Verified on native windows-x86_64 (win10, fresh clone W:\verify-1 at 1688728, pinned seed nightly-20260930-local-2-bd6e00d1dee6, src\main build green), the issue's probe command (the stage's embedding object supplied as the workflow step does since 9674163):

    > set WITH_CODEGEN_UNITS=1
    > set WITH_PROFILE=1
    > set WITH_COMPILER_EMBEDDED_OBJECT=W:\verify-1\out\stage\lib\embedded_objects.o
    > out\bootstrap\bin\with-stage1.exe build out/gen/main.w -O1 -o out/probe-single.exe
    probe rc=0
    > out\probe-single.exe build W:/hello.w -o W:/hello_probe.exe && W:\hello_probe.exe
    hello
    

    No lld-link: error: duplicate symbol lines; the probe image links and runs. (The probe still refuses to link a program that needs an embedded bundle because it is unstamped — that is #1330, fixed separately on branch fix-1330.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions