Comments (7)
@Emilgardis If what I said made you feeling offensive, please accept my apologize here.
Maybe I didn't express well what I mean. Let me try to explain it in another way:
If a user known there is a thing called "cross-compiling", and known that it will let him/her compile a binary on one platform which will finally run on another platform, but known nothing about the whole process, what tool is needed, and what result could be got, then when they read this document, they feel depressed.
Basically here I think we could add some detailed tutorial for the user, for example:
If you want to cross-compile your rust program from Win32 to Win64, or vise versa, then do the following steps:
- ...
- ...
- ...
After these steps, usually you will get an executable which runs on Win32/Win64 platforms! However, some other points might need be aware:- ...
- ...
- ...
I think this is helpful for newbies (like me).
from rust-cross.
Cross compiling for i686-pc-windows-msvc from x86_64-pc-windows-msvc should be done just as any other cross compilation.
Assuming rustup is installed (highly recommended)
rustup target add i686-pc-windows-msvc
cargo build --target=i686-pc-windows-msvc
from rust-cross.
@Emilgardis Yeah, but what I asked is adding this kind of thing, or this link, to the document.
from rust-cross.
https://github.com/japaric/rust-cross#the-target-triple
https://github.com/japaric/rust-cross#cross-compiling-with-rustc
https://github.com/japaric/rust-cross#cross-compiling-with-cargo
How do those not explain how to cross-compile for different targets? (I am sorry if I sound rude, I'm just trying to understand what you want to improve on)
from rust-cross.
That does seem like something that is missing. Maybe a more general example could be done or the TL;DR could be generalized for any (supported) target.
from rust-cross.
Cross compiling from Win32 to Win64 (or vise versa) is easy, to some extent:
- rustup target add i686-pc-windows-msvc/x86_64-pc-windows-msvc
- cargo build --target i686-pc-windows-msvc/x86_64-pc-windows-msvc
- Done!
Sometimes you may need to check the portability of your binary if some asm/C/C++ code is involved, in other situations these steps just work. However, in Linux/macOS world, things may different.
Maybe a hello world example (.Net Core uses this example to show its cross-compiling ability) is enough? I don't sure about this.
from rust-cross.
When I run rustup on Windows it warns that I need to install C++ build tools, which I might get from Visual Studio. When I install Visual Studio, I can choose 2 packages: Windows development with C++ and Linux development with C++. If I install both, would it be possible to build binaries for linux on windows?
from rust-cross.
Related Issues (20)
- read-only file system HOT 1
- Cross compiling from Windows to Linux HOT 8
- Remove references to deprecated multirust
- missing gcc-multilib HOT 2
- <3 HOT 1
- cross compilation from ubuntu linux to s390 HOT 2
- Confusion with https://github.com/japaric/cross
- Instructions for armv6 (Raspberry Pi 1 / Zero) HOT 3
- Target triple for Windows
- Tier 1 link in README doesn't go anywhere
- Missing header files when cross compiling to windows
- CloudABI support
- Update qemu to 2.12.0
- rust cross compile to riscv64gc
- Fix if example code isn't woking
- Build Failed: openssl-sys
- x86_64-unknown-linux-musl does not always produce statically linked binaries
- Best practices for testing cross-compiled targets?
- conttributing
- Cross compile fatal error: 'bits/libc-header-start.h' file not found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-cross.