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

Go 1.15 based cross compilation fails with "copy_file_range: operation not permitted" #75

Closed
m90 opened this issue Aug 19, 2020 · 4 comments

Comments

@m90
Copy link

m90 commented Aug 19, 2020

I'm cross compiling an app using this Docker image for a while now (thank you for maintaining the fork!). I just tried upgrading to Go 1.15 (techknowlogick/xgo:go-1.15.x) which made compilation fail for reasons I do not fully understand. The error message I am seeing is:

Compiling for linux/amd64...

... modules being downloaded...

# github.com/offen/offen/server/cmd/offen
/usr/local/go/pkg/tool/linux_amd64/link: cannot write /tmp/go-link-617276537/000004.o: write /tmp/go-link-617276537/000004.o: copy_file_range: operation not permitted
/usr/local/go/pkg/tool/linux_amd64/link: cannot write /tmp/go-link-617276537/000023.o: write /tmp/go-link-617276537/000023.o: copy_file_range: operation not permitted
2020/08/19 16:33:27 Failed to cross compile package: exit status 2.

This builds as expected with techknowlogick/xgo:go-1.14.x.

The build command I am running is:

RUN xgo --targets=linux/amd64,windows/amd64 --tags 'osusergo netgo static_build sqlite_omit_load_extension' --ldflags="-linkmode external -extldflags '-static' -s -w -X github.com/offen/offen/server/config.Revision=$GIT_REVISION" github.com/offen/offen/server/cmd/offen

Digging through the Go 1.15 release notes I cannot find anything that could be causing this or build flags I would need to adjust, so I am kind of stumped on how to debug this further. Did anyone else encounter this since upgrading? Do you have any pointer about what might be causing this?


You can find the full build output here: https://app.circleci.com/pipelines/github/offen/offen/2614/workflows/ef98696e-244b-4ab0-9879-8cf22d3fde37/jobs/17686

@m90
Copy link
Author

m90 commented Aug 20, 2020

This seems to describe the root cause: golang/go#40893

There's probably nothing actionable in here.

@techknowlogick
Copy link
Owner

Thanks for raising this upstream :)

I'll keep this open until 1.15.1 is released and you can see if the build works then. I have opened a PR to maybe upgrade the underlying image to be based on ubuntu:20.04, however as 18.04 is still oldest LTS I am keen to keep that until EOL as last ubuntu upgrade it increased the minimal kernel version required (to something released many years ago, but people love to use old hardware, and so I would like to try my hardest to have the generated binaries from xgo work on their systems as long as it also works on newer systems too).

@m90
Copy link
Author

m90 commented Aug 20, 2020

I'll keep this open until 1.15.1 is released and you can see if the build works then.

I can build (in Docker) fine now using the 1.15.0 image if I make sure the Docker version is recent (apparently CircleCI by default allocates a 17.x version which does not build).

@techknowlogick
Copy link
Owner

Ah, ok. Thanks for clarifying. I'll then close this.

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

No branches or pull requests

2 participants