-
Notifications
You must be signed in to change notification settings - Fork 3
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
Cross compilation #147
Comments
This is definitely something I would like to add. At the moment, my understanding is that there's not a lot of need for this. I'd be curious if you could expand on your ideas here, in terms of how you'd use this? How you'd like to see it work? etc... My understanding is this:
My thought for this would be to do both. I had thought about adding a Zig buildpack as I'd heard the Zig toolset can be used to make cross-compiling Rust pretty easy (see here). Using cross would be interesting too. I do believe that #21 would at least allow you to install the cross cli tool. From there, I'm not sure. It would depend on how it's installing everything else that it needs to cross-compile. When building as buildpacks, you run as an unprivileged non-root user so you can't install packages. It would fail if it tried that. You're also running inside of a container already, so if it was trying to use Docker to run something in a container that would fail as well. At any rate, I'm optimistic that we can make something work for cross-compilation. It just may take some time. |
Basically my goal was to use Github Actions to use buildpack and compile on an amd64 runner but build an image which could run on my Raspberry Pi on arm64. I was not sure if buildpacks were meant for cross compiling.
|
It hasn't been a possibility to date. The upstream tools for buildpacks do not allow for setting alternative platforms. There's an assumption that the platform is the one on which you're building. So if you could run a build with an ARM64 container, then the tools should work there, but you can't run on x86 and build for ARM64. It's possibly something that may be available in the future, but that's more a question for https://github.com/buildpacks. If we can get some upstream support for it, so you can
I don't think so, for the reason of limited access. The only possible way this would work is if you had a stack image built that already had docker installed & it was configured so that the |
Cross compilation is currently not possible.
There would be two ways to do it AFAIK.
Both could be solved by #21.
Preference would be to have
cross
installed when using a target platform other than the host one installed.Tried to go with the first approach, but that failed as there is no linker for arm64 installed.
pack build image_name \ -b docker.io/paketocommunity/rust \ -B paketobuildpacks/builder:tiny \ -e BP_RUST_TOOLCHAIN=nightly \ -e BP_RUST_PROFILE=default \ -e BP_RUST_TARGET=aarch64-unknown-linux-musl \ -e BP_CARGO_INSTALL_ARGS='--target aarch64-unknown-linux-musl' \ -e CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-musl-gcc
Log
The text was updated successfully, but these errors were encountered: