-
Notifications
You must be signed in to change notification settings - Fork 93
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 from Windows to Linux #33
Comments
Thanks to rust-lang/rust#40018 you can crosscompile Rust programs (on nightly) from Windows to Linux using the [target.x86_64-unknown-linux-musl]
rustflags = ["-Z", "linker-flavor=ld"] You can then (after |
That sounds awesome!!! Is there a similar linker that can be used to produce Windows binaries from Linux hosts? |
With rust-lang/rust#48125 LLD is now part of nightly, so there's no need to even install LLVM anymore. It can simply be used like this:
@mcandre: LLD is a cross-linker and can also link for Windows targets with |
Just for anyone that stumbles upon this today:
rust-lang/rust#52501 With these 3 things above i was able to cross compile from windows to centos7.
yey! |
Actually, [target.x86_64-unknown-linux-musl]
linker = "rust-lld" |
I'm too have problems to compile my project under windows 10 for linux. I tried target as "x86_64-unknown-linux-musl" and "x86_64-unknown-linux-gnu". With "gnu" its ask for "cc" and under "musl" its ask for "musl-gcc". I have cygwin installed. I have created in my project a folder named ".cargo" with file "config":
Compile with Result:
Whats my big mistake? |
WSL is not Visual Studio specific. It's like reverse Wine. |
I am successful with first installing LLVM for Windows from https://releases.llvm.org/download.html, making sure that I cross-compiled a binary to |
Because of work I needed to switch to a Windows laptop and now look into a good way to build linux executables on Windows 10. Basicall I'd like to build the binaries in IntelliJ (or Visual Studio), so on Windows itself and not in the Linux Subsystem (which I could but then I'd have the wrong "environment" in my IntelliJ and would get suggestions for Windows instead of Linux specific features)
Now, I'm stuck on the "C cross toolchain": I've looked into crosstool-ng but that seems linux only. It also supports cygwin but that sounds a) like a very old method and b) looking at this stackoverflow thread sounds that I need to compile in the cygwin environment
On the other hand I found targeting the windows subsystem for Linux from Visual Studio which looks like it's going into the right direction but it's Visual Studio specific.
Generally I'm a bit lost as cross compilers are new ground for me. If anybody could just give me some directions I could figure out the nitty gritty details myself.
The text was updated successfully, but these errors were encountered: