-
Notifications
You must be signed in to change notification settings - Fork 51
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
Cannot cross-build images for a foreign architecture #138
Comments
Thank you for the report. I agree with your proposal and contributions would be welcome ;) |
After reviewing the source code, I can see that this is an issue all across the board and not just isolated to We could do the following:
For reference, I implemented proper splicing/cross-compilation support in crane recently: ipetkov/crane#652 The alternative approach would be reviewing the source code and replacing certain instances of @nlewo Which approach would you prefer? Both of these would be fully backwards compatible. I think the splicing approach would be nicer to work with, but it would be a larger change, cause big merge conflicts with open PRs and more difficult to review. Though the project has a pretty decent test coverage so we can be fairly certain we haven't broken something. |
I opened a PoC PR in #139 to show what I mean. |
Why not just make it an
|
I prepared another PR. It's so stupid, but it works. And it works similarly to |
It's a good start, but not really cross-compilation aware. That's fine though since it at least allows you to wire that up yourself. With But yeah I think it makes sense to start with being able to at least override the |
It's currently not possible to cross-build images for a foreign architecture. Using
nix2container
onnixpkgs
with a foreigncrossSystem
will attempt to build thenix2container-bin
andjq
binaries for the foreign system and then try to execute them at build time. You can work around this issue by usingnix2container-bin
based onpkgs.pkgsBuildHost
. However this doesn't work correctly either, becausearch
is hardcoded toruntime.GOARCH
.You can work around both of these issues with a small wrapper:
Ideally this workaround wouldn't be necessary. We could fix this by:
nix2container-bin
based onpkgs.pkgsBuildHost
(this is equivalent topkgs
whencrossSystem
is not set).buildImage
pass a (new)--arch
argument tonix2container-bin
based onpkgs.go.GOARCH
.The text was updated successfully, but these errors were encountered: