ci: force external linkmode for static MinGW link in Windows GUI builds#208
Merged
ci: force external linkmode for static MinGW link in Windows GUI builds#208
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
verify-windows-gui-dllsCI failure wherebuild/bin/postie.exestill importedlibstdc++-6.dllandlibwinpthread-1.dlldespite the recent attempts at static linking (#204, #206).Root cause
-ldflags=\"-extldflags=-static\"without-linkmode external. Go silently ignoresextldflagsunless external linkmode is explicitly selected, so-staticnever reached the linker.CGO_LDFLAGSended with-Wl,-Bdynamic, which reverted the linker back to dynamic mode for any libs cgo/wails appended after-lpthread— includinglibstdc++andlibwinpthread.msys2 {0}, sogcccould 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 underbash.Changes
In both
dev-build.ymlandrelease.ymlfor thebuild-gui-windowsjob:-linkmode externalto wails ldflags so-extldflags=-staticis honored.-Wl,-Bstatic -lpthread -Wl,-Bdynamicdance fromCGO_LDFLAGS—gcc -staticcovers pthread already.shell: msys2 {0}so the MINGW64 toolchain is unambiguously on PATH.Test plan
build-gui-windowssucceeds.verify-windows-gui-dllsshows nolibgcc_s_seh-1.dll,libstdc++-6.dll, orlibwinpthread-1.dllin the imports — onlyKERNEL32.dllandapi-ms-win-crt-*remain.