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

libcontainer cannot be build due to runc-dmz (as a Go library for third party projects) : dmz_linux.go:21:12: pattern runc-dmz: no matching files found #4096

Closed
mythi opened this issue Oct 26, 2023 · 5 comments · Fixed by #4101

Comments

@mythi
Copy link
Contributor

mythi commented Oct 26, 2023

Description

With the latest main, projects using libcontainer cannot build unless they set -tags runc_nodmz flag.

Steps to reproduce the issue

  1. pull latest go get github.com/opencontainers/runc@main
  2. build

Describe the results you received and expected

Result:
../../../../../pkg/mod/github.com/opencontainers/runc@v1.1.1-0.20231025141802-edd00eb3cbd2/libcontainer/dmz/dmz_linux.go:21:12: pattern runc-dmz: no matching files found

This can work when adding runc_nodmz to build flags but is it expected that all libcontainer consumers do this?

What version of runc are you using?

github.com/opencontainers/runc v1.1.1-0.20231025141802-edd00eb3cbd2

Host OS information

No response

Host kernel information

No response

mythi added a commit to mythi/cadvisor that referenced this issue Oct 26, 2023
@AkihiroSuda
Copy link
Member

AkihiroSuda commented Oct 26, 2023

What's your arch?

Also, please make sure to use make, not go build (go install)

@mythi
Copy link
Contributor Author

mythi commented Oct 26, 2023

What's your arch?

GOARCH="amd64"

Also, please make sure to use make, not go build (go install)

I'm not building runc but trying to update libcontainer to cAdvisor.

@AkihiroSuda AkihiroSuda changed the title libcontainer cannot be build due to runc-dmz libcontainer cannot be build due to runc-dmz (as a Go library for third party projects) : dmz_linux.go:21:12: pattern runc-dmz: no matching files found Oct 26, 2023
@zhujintao
Copy link

alpine linux same problem。

@cyphar
Copy link
Member

cyphar commented Oct 30, 2023

This can work when adding runc_nodmz to build flags but is it expected that all libcontainer consumers do this?

It should be noted that libcontainer is not meant to be used outside of runc, so while we do try to avoid causing issues if necessary, if there isn't a workable solution outside of build-tags then we will have to go with those. That being said, if there is a nice solution that makes everyone happy, great.

The core issue is that go:embed doesn't have a way to allow an empty set (no files matching the pattern) to be allowed. The "simple" solution -- which I tried when I was working on #3987 -- would be to check in an empty file called runc-dmz into git, which will be pulled in by go get. Unfortunately, this would also mean that git commit -a would automatically include the binary file once we build it (you cannot .gitignore a tracked path AFAIK) which would make development more annoying and so is a no-go.

The other alternative is to create an empty file with a different name, and then to use go:embed runc-dmz dummy-file.txt (or something similar). This would work AFAICS, but it might look a bit ugly. I'll give this a shot.

@cyphar
Copy link
Member

cyphar commented Oct 30, 2023

Does #4101 fix the issue for you?

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

Successfully merging a pull request may close this issue.

4 participants