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

Makefile: Set CGO_ENABLED=0 for runtimetest #442

Merged

Conversation

wking
Copy link
Contributor

@wking wking commented Aug 9, 2017

And also set -installsuffix cgo. runtimetest is designed to be run from inside a container, which may include a mount namespace that has no linker or dynamic libraries. These changes give us a static runtimetest binary which will work in those conditions.

The approach I'm using here follows this suggestion. RunC does things a bit differently (see opencontainers/runc#401), but I'm not familiar enough with Go to contrast the approaches.

And also set '-installsuffix cgo'.  runtimetest is designed to be run
from inside a container, which may include a mount namespace that has
no linker or dynamic libraries.  These changes give us a static
runtimetest binary [1,2] which will work in those conditions.

[1]: https://golang.org/cmd/cgo/#hdr-Using_cgo_with_the_go_command
[2]: golang/go#9344 (comment)
     Subject: cmd/go: With Go 1.4, cannot statically link a program
       which imports net

Signed-off-by: W. Trevor King <[email protected]>
@wking wking mentioned this pull request Aug 9, 2017
@Mashimiao
Copy link

Mashimiao commented Aug 14, 2017

LGTM

Approved with PullApprove

1 similar comment
@liangchenye
Copy link
Member

liangchenye commented Aug 17, 2017

LGTM

Approved with PullApprove

@liangchenye liangchenye merged commit b2d36fa into opencontainers:master Aug 17, 2017
@wking wking deleted the disable-cgo-for-runtimetest branch August 17, 2017 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants