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

Support cross compiling #79

Closed
expipiplus1 opened this issue Feb 26, 2020 · 9 comments · Fixed by #256
Closed

Support cross compiling #79

expipiplus1 opened this issue Feb 26, 2020 · 9 comments · Fixed by #256
Labels

Comments

@expipiplus1
Copy link

I guess this would involve using rustc.nativeDrv instead of rustc and changing some of the info passed to cargo. I'm no rust expert and wasn't able to get this working in a few minutes of trying.

@nmattia
Copy link
Collaborator

nmattia commented Feb 28, 2020

Hey @expipiplus1 , can you clarify what you mean by "cross compiling"? I've meant to add wasm and musl builds to naersk, just haven't found the time yet. I'll also need to write a guide on how I do it at $WORK. Do you mean more cross compilation targets?

@giodamelio
Copy link

Just running into this now. Wanting to do a x86_64-unknown-linux-musl build to be deployed to AWS Lambda. I will tinker with this a bit the next few days, but I am a total Nix beginner.

@nmattia
Copy link
Collaborator

nmattia commented Mar 23, 2020

Let me get started on this, I have the code lying around, just need to integrate it. First I want to extend the test suite to run on multiple nixpkgs versions, otherwise it's going to be hell to debug.

@nmattia
Copy link
Collaborator

nmattia commented Mar 23, 2020

#88

@nmattia nmattia added the musl label Mar 24, 2020
@giodamelio
Copy link

Thanks so much! I gave it a shot, but it was a little much for my novice Nix skills.

If you need any help testing let me know, I can at least be a beta tester.

@nmattia
Copy link
Collaborator

nmattia commented Mar 25, 2020

Thanks! I've created a bunch of tickets: https://github.com/nmattia/naersk/issues?q=+is%3Aissue+label%3Amusl+

Last night I added a definition for rustc with a wasm32 and a musl target (#90). The next step is to actually provide a way of using it (#93). After that, you can knock yourself out :)

@angerman
Copy link
Contributor

angerman commented May 4, 2020

hooray, I've just bumped into this as well. Looking at #98, and specifically at

https://github.com/nmattia/naersk/pull/98/files#diff-6938ea327f87ba609b4fafc30775f3e9R38-R39

I'm left to believe that cross compilation should be as easy as setting a different
CARGO_BUILD_TARGET? How does that inherit the toolchain? And what about rust libraries that link against system libraries and would expect those to be cross compiled as well?

@cpick
Copy link

cpick commented Sep 20, 2023

There's now an example for building against musl.

@expipiplus1
Copy link
Author

Thank you! If only I could remember what I initially needed this for!

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

Successfully merging a pull request may close this issue.

5 participants