Skip to content

ci: force external linkmode for static MinGW link in Windows GUI builds#208

Merged
javi11 merged 1 commit intomainfrom
claude/gallant-liskov-dc8076
Apr 25, 2026
Merged

ci: force external linkmode for static MinGW link in Windows GUI builds#208
javi11 merged 1 commit intomainfrom
claude/gallant-liskov-dc8076

Conversation

@javi11
Copy link
Copy Markdown
Owner

@javi11 javi11 commented Apr 25, 2026

Summary

Fixes the verify-windows-gui-dlls CI failure where build/bin/postie.exe still imported libstdc++-6.dll and libwinpthread-1.dll despite the recent attempts at static linking (#204, #206).

Root cause

  • The Wails GUI build used -ldflags=\"-extldflags=-static\" without -linkmode external. Go silently ignores extldflags unless external linkmode is explicitly selected, so -static never reached the linker.
  • CGO_LDFLAGS ended with -Wl,-Bdynamic, which reverted the linker back to dynamic mode for any libs cgo/wails appended after -lpthread — including libstdc++ and libwinpthread.
  • The step ran under the default PowerShell shell instead of msys2 {0}, so gcc could resolve to a different toolchain than the MSYS2 mingw64 one set up earlier.

The CLI Windows build did not have this problem because it already passed -linkmode external -extldflags '-static' and ran under bash.

Changes

In both dev-build.yml and release.yml for the build-gui-windows job:

  • Add -linkmode external to wails ldflags so -extldflags=-static is honored.
  • Drop the -Wl,-Bstatic -lpthread -Wl,-Bdynamic dance from CGO_LDFLAGSgcc -static covers pthread already.
  • Run the build with shell: msys2 {0} so the MINGW64 toolchain is unambiguously on PATH.

Test plan

  • CI build-gui-windows succeeds.
  • verify-windows-gui-dlls shows no libgcc_s_seh-1.dll, libstdc++-6.dll, or libwinpthread-1.dll in the imports — only KERNEL32.dll and api-ms-win-crt-* remain.
  • Same verification passes in the release workflow on the next tagged build.

Without -linkmode external, Go silently ignored -extldflags=-static, so
the Wails GUI exe still imported libstdc++-6.dll and libwinpthread-1.dll
and failed verify-windows-gui-dlls. The trailing -Wl,-Bdynamic in
CGO_LDFLAGS also reverted later libs to dynamic linking. Run the build
under msys2 {0} so the MINGW64 gcc is unambiguously on PATH, mirroring
the working CLI build.
@javi11 javi11 merged commit 7331d17 into main Apr 25, 2026
3 of 5 checks passed
@javi11 javi11 deleted the claude/gallant-liskov-dc8076 branch April 25, 2026 14:24
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