From c7f5cfce34b98cec7e836b7f863518160095e416 Mon Sep 17 00:00:00 2001 From: javi11 Date: Sat, 25 Apr 2026 16:08:01 +0200 Subject: [PATCH] ci: force external linkmode for static MinGW link in Windows GUI builds 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. --- .github/workflows/dev-build.yml | 5 +++-- .github/workflows/release.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 7aad0fe..068db8d 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -96,11 +96,12 @@ jobs: run: npm install -g bun - name: Build Windows GUI - run: wails build -platform windows/amd64 -ldflags="-extldflags=-static" + shell: msys2 {0} + run: wails build -platform windows/amd64 -ldflags="-linkmode external -extldflags=-static" env: CGO_ENABLED: 1 CC: gcc - CGO_LDFLAGS: '-static-libgcc -static-libstdc++ -Wl,-Bstatic -lpthread -Wl,-Bdynamic' + CGO_LDFLAGS: '-static-libgcc -static-libstdc++' - name: Verify no MinGW runtime DLL dependencies uses: ./.github/actions/verify-windows-gui-dlls diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ffb1714..b54554b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -410,11 +410,12 @@ jobs: # Build Windows GUI using Wails config - name: Build Windows GUI - run: wails build -platform windows/amd64 -ldflags="-extldflags=-static" + shell: msys2 {0} + run: wails build -platform windows/amd64 -ldflags="-linkmode external -extldflags=-static" env: CGO_ENABLED: 1 CC: gcc - CGO_LDFLAGS: '-static-libgcc -static-libstdc++ -Wl,-Bstatic -lpthread -Wl,-Bdynamic' + CGO_LDFLAGS: '-static-libgcc -static-libstdc++' # Verify the built exe doesn't dynamically depend on MinGW runtime DLLs - name: Verify no MinGW runtime DLL dependencies