Skip to content

Refactor binary generation options #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

atc0005
Copy link
Owner

@atc0005 atc0005 commented Oct 8, 2020

Overview

The previous release generated Windows binaries that were
broken (GH-53) and Linux binaries that were unintentionally
dynamic (GH-48).

This commit provides an updated Makefile and GitHub
workflow which provides multiple build options for both
dynamic and static linking, but defaults to the previous
dynamically linked behavior.

The Makefile build options now explicitly enable the
CGO_ENABLED environment variable so that all builds
have the required cgo functionality enabled.

A docker Makefile recipe is provided to generate
binaries using new Docker images from the atc0005/go-ci
project based on the official Golang Alpine Linux
image. The result is statically linked binaries based on
the musl C library instead of glibc. The intent is to
help prevent licensing issues surround the GNU C
library's LGPL licensing (which I do not fully understand).

Multiple build tags are specified for static builds which
enable Go-specific replacements for common glibc-provided
features:

  • osusergo
  • netgo

and a build tag specific to disabling SQLite extensions,
which we do not use with this specific project:

  • sqlite_omit_load_extension

Minor documentation updates have been included which update
the build requirements and specific steps for building
binaries for this project. Further updates are likely
needed to add polish.

A Docker Compose file has been included for kicking off
multiple static binary builds in parallel, but it may end
up getting tossed in a later PR if we don't make sufficient
use of it.

References

@atc0005 atc0005 added bug Something isn't working enhancement New feature or request CI dependencies labels Oct 8, 2020
@atc0005 atc0005 added this to the Next Release milestone Oct 8, 2020
@atc0005 atc0005 self-assigned this Oct 8, 2020
@atc0005 atc0005 force-pushed the rework-binary-generation-to-provide-multiple-build-options branch from 252323f to b4d96bf Compare October 8, 2020 21:50
@atc0005 atc0005 changed the title Rework binary generation to provide multiple build options Refactor binary generation options Oct 8, 2020
@atc0005 atc0005 marked this pull request as ready for review October 8, 2020 21:52
@atc0005 atc0005 force-pushed the rework-binary-generation-to-provide-multiple-build-options branch 3 times, most recently from bf9b80c to ea32c50 Compare October 8, 2020 22:17
The previous release generated Windows binaries that were
broken (GH-53) and Linux binaries that were unintentionally
dynamic (GH-48).

This commit provides an updated Makefile and GitHub
workflow which provides multiple build options for both
dynamic and static linking, but defaults to the previous
dynamically linked behavior.

The GitHub Workflow jobs based on the Makefile build
tasks use a 20 minute timeout vs the 10 minute timeout
used previously. Also, `CGO_ENABLED` has been explicitly
set in order to ensure that cgo support is enabled.

The Makefile build options now explicitly enable the
`CGO_ENABLED` environment variable so that all builds
have the required cgo functionality enabled.

A `docker` Makefile recipe is provided to generate
binaries using new Docker images from the `atc0005/go-ci`
project based on the official Golang Alpine Linux
image. The result is statically linked binaries based on
the musl C library instead of glibc. The intent is to
help prevent licensing issues surround the GNU C
library's LGPL licensing (which I do not fully understand).

Multiple build tags are specified for static builds which
enable Go-specific replacements for common glibc-provided
features:

- `osusergo`
- `netgo`

and a build tag specific to disabling SQLite extensions,
which we do not use with this specific project:

- `sqlite_omit_load_extension`

Minor documentation updates have been included which update
the build requirements and specific steps for building
binaries for this project. Further updates are likely
needed to add polish. Several reference links have also
been added.

A Docker Compose file has been included for kicking off
multiple static binary builds in parallel, but it may end
up getting tossed in a later PR if we don't make sufficient
use of it.

- refs GH-48
- refs golang/go 38789
- refs golang/go 26492

- refs atc0005/go-ci#85
@atc0005 atc0005 force-pushed the rework-binary-generation-to-provide-multiple-build-options branch from ea32c50 to a7adc49 Compare October 8, 2020 22:39
@atc0005 atc0005 added builds documentation Improvements or additions to documentation windows labels Oct 8, 2020
@atc0005 atc0005 merged commit d0742cd into master Oct 8, 2020
@atc0005 atc0005 deleted the rework-binary-generation-to-provide-multiple-build-options branch October 8, 2020 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working builds CI dependencies documentation Improvements or additions to documentation enhancement New feature or request windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows builds are broken for v0.1.0 release Makefile build options do not generate static binaries
1 participant