Skip to content
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

Fixing static binary build using container #670

Closed
wants to merge 2 commits into from

Conversation

vijaySamanuri
Copy link

  1. LookupId panics on Linux+glibc static build (os/user: LookupId panics on Linux+glibc static build golang/go#24787)
  2. Updated go version to 1.11.0 in Dockerfile.build
  3. added go build tags netgo osusergo in static binary

@rhatdan
Copy link
Member

rhatdan commented Jun 11, 2019

LGTM

@rhatdan
Copy link
Member

rhatdan commented Jun 11, 2019

@vijaySamanuri You need to sign your commit.

git commit -a -s --amend
git push --force

@@ -59,7 +59,7 @@ LOCAL_BUILD_TAGS = $(BTRFS_BUILD_TAG) $(LIBDM_BUILD_TAG) $(OSTREE_BUILD_TAG) $(D
BUILDTAGS += $(LOCAL_BUILD_TAGS)

ifeq ($(DISABLE_CGO), 1)
override BUILDTAGS = containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp
override BUILDTAGS = netgo osusergo containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

  • netgo bypasses NSS, including the glibc resolver (per https://golang.org/pkg/net/ , e.g. breaking .local names.
  • osusergo bypasses NSS as well, breaking e.g. LDAP uses.

Yes, I realize that these downsides are fundamentally necessary to make static builds work at all, but they are significant downsides.

I’m sorely tempted to just remove any mention of statically-linked or non-CGo builds from the repository (@rhatdan WDYT?).

If not that, at the very least README should document these downsides of a static build as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would hate to remove them, since it seems many in the GO world seem to want/require them. I guess Documenting the shortcomings is the best solution.

The NSS stuff is only important for rootless container/storage I believe?

 1. LookupId panics on Linux+glibc static build (golang/go#24787)
 2. Updated go version to 1.11.0 in Dockerfile.build
 3. added go build tags netgo osusergo in static binary

Signed-off-by: vijaysamanuri <vijay.samanuri@wavemaker.com>
@rhatdan
Copy link
Member

rhatdan commented Jul 17, 2019

@vijaySamanuri Are you still interested in completing this?

@rhatdan
Copy link
Member

rhatdan commented Aug 2, 2019

I think we should move forward with this and just document the shortcomings of a static built version of skopeo.

@rhatdan
Copy link
Member

rhatdan commented Oct 31, 2019

@vrothberg Worth taking this over, or should we just close it?

@vrothberg
Copy link
Member

@vrothberg Worth taking this over, or should we just close it?

I have a tendency to close. I'm skeptical toward static when it's not fully supported - shall we drop the make target?

@mtrmac
Copy link
Contributor

mtrmac commented Oct 31, 2019

Ideally, I’d prefer dropping both statically-linked builds for Linux (which are unreliable and functionally restricted) and in-container builds (which are a good idea in theory, but keep breaking because we don’t use them, and don’t work with dynamically-linked builds).

Dropping the statically-linked targets would be a good first step — though this PR suggests that the in-container builds might also be broken, independently.

@vrothberg
Copy link
Member

+1, I'll create an issue for it.

@vrothberg
Copy link
Member

#755

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants