Skip to content

with get writes the import libraries a Windows package needs (ruling A); the raylib spiral links on Windows with no Visual Studio (#1915) - #1932

Merged
ehartford merged 3 commits into
win-own-sdkfrom
win-app-import-libs
Sep 30, 2026
Merged

ehartford merged 3 commits into
win-own-sdkfrom
win-app-import-libs

Conversation

@ehartford

@ehartford ehartford commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Eric's ruling (2026-09-30, "A"): with get generates the import libraries of the in-box DLLs a package links (gdi32, winmm, opengl32, …) from mingw-w64's .def files with the SDK's llvm-dlltool; the SDK carries only what With itself links. Also: the Windows link probes symbols with the SDK's llvm-nm; :no-host-toolchain reads Windows link records and gains a Windows half (hi.w, a stdio c_import, a gdi32/winmm/opengl32 program build and run with PATH holding only the Windows directories).

Verified on win10 with no VS/Kits: with get c.raylib + the spiral fixture builds (not run), importing only in-box DLLs. Draft until the stack battery is green.

Eric Hartford added 3 commits September 30, 2026 04:57
`with build` of the raylib spiral on win10, in a shell whose PATH holds
only the Windows directories, warned "could not probe
.../spiral-pre.exe.o for undefined symbols with 'llvm-nm.exe' (exit -2);
linking every embedded bundle": with no linker record beside the
compiler, the probe looked for llvm-nm.exe on PATH, a host tool. It now
takes llvm-nm from beside the lld the link runs, as
link_stage_llvm_ld_path resolves it (the record, or the SDK
WITH_LLVM_LD / LLVM_LD / LLVM_PREFIX names). The same build no longer
warns.
…1915)

The record half of :no-host-toolchain (build/host_toolchain.w
ht_record_problems) found a path by its first '/': on Windows every
drive-lettered path ("C:/src/...", "/libpath:C:/...") had a prefix it did
not call path-like and was never checked, while every lld-link option
("/alternatename:with_llvm_outs=with_alloc", "/include:_Z10clang_main...")
was reported as a path outside the repository. On win10 the check
reported 60 such options across the six records and would have passed
a record naming D:/elsewhere or E:\vs\kernel32.lib.

On Windows a path is now the drive-lettered one a token names, alone or
after an option (/libpath:, -L, -Wl,), compared with '\' as '/' and case
folded; a token that is only an option names no path. Checked on the
cases above: the two foreign paths are found, the options are not, and
the win10 records pass.
…kage links (#1915)

Eric, 2026-09-30 (ruling A): `with get` generates the import libraries a
package needs for in-box DLLs (gdi32, opengl32, winmm, ...) from
mingw-w64's .def files, as it writes Apple framework stubs on macOS; the
SDK carries only what With itself links.

compiler.WindowsImportLibs: for each library a package names that neither
its own lib directories nor the SDK's C runtime provide, the .def is
found as mingw-w64-crt's Makefile.am finds it (the architecture's
directory, then lib-common; a .def.in through the SDK's clang
preprocessor, a lib-common one losing its i386 @n decorations, as
build/sdk.w sdk_mingw_def does), and the SDK's llvm-dlltool writes
<package>/windows-libs/lib<name>.a, which metadata.json adds to the
package's lib_paths. The definitions come from the mingw-w64 release the
SDK's C runtime was built from: its libc/windows/PROVENANCE names the
archive and its sha256, and only mingw-w64-crt's definition directories
are unpacked (TarExtract gains a keep-list), once, into the user's cache
(LOCALAPPDATA when a Windows shell sets no HOME). A name with no
definition is left to the link, which names it. `with __windows-import-libs
<dir> <dll>...` runs the step alone.

Evidence on win10, with no Visual Studio or Windows Kits and PATH holding
only C:\Windows\System32 and C:\Windows:
- before: `with get c.raylib` then `with build` of the raylib spiral UAT
  fixture (uat/fixtures/raylib_spiral_main.w) failed with lld-link:
  "could not open 'winmm.lib'", "'gdi32.lib'", "'opengl32.lib'".
- after: the same steps build out/bin/spiral-post.exe (not run); raylib,
  glfw and opengl/system each carry windows-libs/, and the binary imports
  only in-box DLLs (GDI32, USER32, WINMM, KERNEL32, SHELL32, ADVAPI32,
  WS2_32, dbghelp and the api-ms-win-crt sets).
- `with __windows-import-libs C:/src/il gdi32 opengl32 winmm user32`
  writes the four libraries (user32 from a .def.in); an unknown name
  fails with "mingw-w64 has no import definitions for
  no_such_dll_1915.dll".

The test does not depend on raylib: :no-host-toolchain gains its Windows
half. hi.w, cimport_stdio.w and a new test/host_toolchain/
windows_dll_project (a dependency whose metadata links gdi32, opengl32
and winmm from import libraries `with __windows-import-libs` writes; the
program calls GetStockObject, timeGetTime and wglGetCurrentContext) are
built and run with PATH holding only the Windows directories and every
Visual Studio / Windows SDK variable emptied. On win10 all three build
and run.
@ehartford
ehartford added this pull request to stack #1928 September 30, 2026 08:57
@ehartford ehartford changed the title win app import libs with get writes the import libraries a Windows package needs (ruling A); the raylib spiral links on Windows with no Visual Studio (#1915) Sep 30, 2026
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on bdf58fe (#1931 + #1932 on main 55d094b).

  • gate rc=0 1077 s (every test ran fresh: behavior 1520, native-compile-error 1560, native-spec 210, native-phase 69, internals 57, codegen 17, comptime-diff 6, lexer 7, parser 9); battery-checks rc=0 151 s (verdicts from the gate's runs of this compiler).
  • fixpoint: stage2 == stage3 over all 16 units; drop-audit, move-audit, :no-host-toolchain green.
  • The pinned Windows seed (nightly-20260930-local-1-6cd934e82b4d) and windows-gnu SDK (nightly-sdk-20260930-6cd934e82b4d) are published; seed-driver agrees with the pins.

Wall 20.5 min: the gate ran alongside two agents' builds on the same Mac (the previous battery's gate took 548 s).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant