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

Fix cross-compilation #41

Merged
merged 1 commit into from
May 18, 2021
Merged

Conversation

abbec
Copy link
Contributor

@abbec abbec commented May 18, 2021

It seems like there has been a mixup on what the build, host and target platforms are. To
quote the Nixpkgs manual: "In summary, build is the platform on which a package is being
built, host is the platform on which it will run. The third attribute, target, is relevant
only for certain specific compilers and build tools."

This is what I think was intended and lets us successfully cross compile from linux and
macOS to WASI and Windows, something that was broken before where native dependencies would leak into the cross-compile.

Fixes #40

rust-overlay.nix Outdated Show resolved Hide resolved
rust-overlay.nix Outdated Show resolved Hide resolved
@oxalica
Copy link
Owner

oxalica commented May 18, 2021

Can you provide the shell.nix or flake.nix for you cross-compiling environment?

@abbec abbec force-pushed the cross-compile-fixes branch 2 times, most recently from 8b4f70a to 9c36018 Compare May 18, 2021 07:38
@abbec
Copy link
Contributor Author

abbec commented May 18, 2021

It is part of a larger Nix framework (that is not yet open source) so it is a little bit tricky

@abbec abbec force-pushed the cross-compile-fixes branch from 9c36018 to fafdc7f Compare May 18, 2021 07:47
@abbec
Copy link
Contributor Author

abbec commented May 18, 2021

Seems to work fine with just changing where the dependencies are specified, sorry for making more changes than needed

@abbec
Copy link
Contributor Author

abbec commented May 18, 2021

I can fix the commit message to better reflect the changes

@abbec abbec force-pushed the cross-compile-fixes branch from fafdc7f to 8d530ee Compare May 18, 2021 07:56
@abbec abbec requested a review from oxalica May 18, 2021 07:56
Dependencies were specified in `depsTargetTarget` which would make them end up in the
dependencies for the target platform when they are actually dependencies needed on the
buildPlatform using the rust package. I.e. they are target dependencies of the compiler
package but will be used as build platform dependencies when propagated.
@abbec abbec force-pushed the cross-compile-fixes branch from 8d530ee to 70fc350 Compare May 18, 2021 07:59
@abbec
Copy link
Contributor Author

abbec commented May 18, 2021

I also added a comment explaining WTH is going on :). Thanks for your time and sorry for being stubborn (and wrong)!

@oxalica oxalica merged commit 7b4688c into oxalica:master May 18, 2021
@oxalica
Copy link
Owner

oxalica commented May 18, 2021

Thanks!

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

Successfully merging this pull request may close these issues.

Rust-overlay seem to confuse $NIX_LDFLAGS when cross-compiling?
2 participants