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

Cross compiling support #33

Open
DieracDelta opened this issue May 16, 2021 · 3 comments
Open

Cross compiling support #33

DieracDelta opened this issue May 16, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@DieracDelta
Copy link

DieracDelta commented May 16, 2021

How hard would it be to generate a cross compiler toolchain to allow users to cross compile to targets? For example, this would let me build defaultPackage.x86_64-darwin on linux. Or really any of the generated targets.. Doesn't seem like this is how things work right now. I see a bunch of targets generated, but I get errors when trying to cross compile to them. Would probably just be a nixpkgs override with cross system to generate different package sets for each target based on the host system. What do you guys think of this?

@DieracDelta DieracDelta added the enhancement New feature or request label May 16, 2021
@zimbatm
Copy link
Member

zimbatm commented May 18, 2021

I don't really see how this would fit this project. The hardest part with pkgsCross in nixpkgs is that not everything builds cleanly. Derivations usually have to be patched to make things work. Which requires a good understanding of each package's inner build system.

In general, it's easier to use remote builders and build natively on all the arches.

@psionic-k
Copy link

Building for musl is a good example of a cross build that's not really any better on a remote builder

@exarkun
Copy link

exarkun commented Dec 7, 2022

Something that flake-utils could offer here is an alternative to eachSystem or a helper to go along with it.

As eachSystem systems builder calls builder with values from systems and then builds its own return value out of the results with a certain shape applied, a hypothetical new eachSystemAndCross systems crossSystems builder could call builder with values from systems and crossSystems and then build its own return value out of the results - perhaps with a shape mirroring that of nixpkgs (where cross results are available somewhere beneath pkgsCross).

eachSystemAndCross might not be the right name/shape for this but I think it's an example of how flake-utils could offer an API that helps set up cross-compilation without concerning itself with whether any particular packages in nixpkgs can successfully be cross-compiled for a given system or not (that remains the flake author's problem to solve).

In general, it's easier to use remote builders and build natively on all the arches.

Building for musl is a good example of a cross build that's not really any better on a remote builder

Similarly, builds against Bionic (another alternate C library) for Android (I don't imagine setting up and using a remote Android builder would be much fun, even if it is probably not technically impossible).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants