cargo-zigbuild
msvc-wine-rust
cargo-zigbuild | msvc-wine-rust | |
---|---|---|
19 | 3 | |
1,240 | 60 | |
7.9% | - | |
8.6 | 0.0 | |
30 days ago | over 2 years ago | |
Rust | Shell | |
MIT License | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
cargo-zigbuild
-
Show HN: macOS-cross-compiler ā Compile binaries for macOS on Linux
https://github.com/rust-cross/cargo-zigbuild
Iām curious what the blockers are for rustc to cross-compile like zig does natively.
- Cargo-zigbuild: Compile Rust using Zig as linker for easier cross compiling
- [Review] Introducing cargo-xwin: A Solution for Cross-Compiling Rust on macOS to MSVC
- Compiling Linux to Mac in CI/CD
- cargo-zigbuild 0.16 added support for (cross-)compiling macOS universal2 binaries/libraries
-
Conditional compilation to avoid cross compilation
Perhaps you can try cargo-zigbuild, it uses zig-cc for cross-compilation instead of creating a container, so it should be much more lightweight on MacOS, without all the cost of virtualization and file sharing.
- Cross-compiling simple Rust code from Mac OS X to Raspberry Pi 4
-
Future of Rust, 2023 and beyond?
I have tried, however I haven't been able to get it to work reliably (e.g. building on windows + linux on WSL works, Mac is a lot more involved; tried building for windows + linux on Mac and I couldn't get it to work at all); I've had some luck using zigbuild but that too doesn't seem to work for Mac.
-
C2Rust Transpiler
Zig also takes this approach, and even exposes its C compiler (which if I recall correctly is basically Clang plus diverse sysroots and other customisation out of the box) as a separate `zig cc`.
I do a lot of work in Rust, and cross-compilation can be a pain when you have a lot of C dependencies. Fortunately https://github.com/messense/cargo-zigbuild exists. It sounds crazy, but using Zig's inbuilt C compiler to help build my Rust projects has been the smoothest option I've found.
I can't help but wonder if it would be worth it for Rust to follow D and Zig by shipping its own inbuilt C compiler, even if they still want to also support external C toolchains. It should be roughly the same effort as it was for Zig, given that they both use LLVM.
-
Short story of Rust being amazing yet again (because it compiles on different architectures effortlessly)
Wait until you start using cargo zig-build. Suddenly it becomes way better than Go's cross compiler because you can seamlessly cross-compile rust AND C (thanks to Zig compiler of course). https://github.com/messense/cargo-zigbuild
msvc-wine-rust
-
Show HN: macOS-cross-compiler ā Compile binaries for macOS on Linux
AFAIK, there are no blockers really, it's just that Rust does not have its own linker, it delegates linkage to the system linker depending on the target. <https://rust-lang.github.io/rustup/cross-compilation.html?hi...>
You can specify your own linker if you want, mold is a very popular one, and cargo-zigbuild does the same behind the scenes with zig cc as the linker.
I did something similar a couple of months ago (or a year ago? I don't remember exactly). I managed to cross-compile to windows-msvc on Linux using Wine, there's a project that provides the scripts to make this easier, including the linker wrapper: <https://github.com/est31/msvc-wine-rust>. It was just for fun because Rust can already target windows-gnu and it'll use mingw64 linker.
Rust's approach to things is normally to provide the basic foundation and let the community build on top of it. I personally like this approach, but it also has this downside of people not knowing they may need an external/community built tool to accomplish what they want.
-
Rustup on Windows will soon give the option to auto install Visual Studio prerequisites
That's pretty neat! Generally though, I advise staying away from the official installer, it puts a lot of stuff onto the hard disk, not sure what, but suddenly a lot of free space is gone. If you download the components manually and install them manually, you reach a way smaller footprint. I've done that thing 5 years ago but not maintained it since as I don't need it any more, but: https://github.com/est31/msvc-wine-rust
-
Minimal Windows 10 SDK: For a smaller MSVC install
See also: https://github.com/est31/msvc-wine-rust
What are some alternatives?
zig - General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
rust.aws-cdk-lambda - A CDK (v2) Construct Library for AWS Lambda in Rust
aws-lambda-rust-runtime - A Rust runtime for AWS Lambda
serverless-rust-demo - Sample serverless application written in Rust
terminal-typeracer
doom - DOOM translated from C to V.
ci - AppVeyor community support repository
embed-c - Embed C code at compile time inside Rust using C2Rust
meta-debian - Meta-layer for Poky to build embedded Linux environments by Debian's source codes
aws-sam-cli-app-templates
wally - The Flash(ing tool)