Closed chrisnovakovic closed 7 months ago
This is a proposed solution to the problems faced in #62. Hopefully it'll be resolved officially in the Go toolchain when https://github.com/golang/go/issues/26492 is implemented, but until then, this seems to be the unofficial convention for getting external libraries linked statically.
@chrisnovakovic can you please modify the CI tests that they additionally test building with static linking?
I've started off with Ubuntu (tested locally in a Docker container similar to ubuntu-latest
on GHA). Could you approve the workflow run? If that works, I'll move on to Arch. Actually it looks like Arch doesn't package static libraries, so if the Ubuntu-based workflow works, there's nothing else to be done.
I think you had an overzealous copy/paste :D
There's a dangling env
in there, a remnant of an earlier attempt at defining the Go build flags. Thanks for fixing it 🙂
The latest failure is because the libxml2
package version in Arch is 2.12.6 - changing line 61 to
pacman -S --noconfirm 'libxml2>=2.12.0'
ought to do it, given that you just want something with at least libxml2's 2.12 API.
Ah, I just made it 2.12.6, but I guess I should have looked closer. Meh, I'll fix that when it breaks again in the future.
Thanks for your PR! will merge now
There's an unofficial convention in the Go ecosystem that the
static_build
tag indicates a desire to link statically to external libraries detected with pkg-config - examples include:Support this convention by invoking pkg-config with the
--static
option if thestatic_build
tag is defined, or without if it isn't.