Cross-platform bundling

It's impressive that Rust can build a working Microsoft Windows executable under Linux. Even at the game level, with full 3D capabilities. Here's an example of mine to show it all working. That's using the Rend3/Egui->WGPU graphics systems, and they're now all portable enough that cross-compiling works. That's a remarkable achievement. Game devs need this.

But once you have a .exe file, you need to build an installer, a .msi or .msix file, to ship. This is not, unfortunately, a standard cargo function. I'd like to see that added.

All the parts exist, but they don't connect and don't work cross-platform. Here's what's available to build upon.

  • cargo-bundle Now, this does exactly the right thing. It's integrated with the Rust ecosystem. It gets the data it needs from the Cargo.toml file. It's installed with cargo install cargo-bundle. The only problem is that it doesn't work for Windows targets. The Windows target part is unimplemented. Only Mac targets are implemented. So, what I'm asking for is that this be completed and made a part of the Rust tooling.
  • WiX This toolset has, internally, the code to create .msi files. It only runs on Windows, and has many of non-Rust dependencies. But that's a source of open-source code for making .msi files. Internally, Wix had two Windows executables, candle.exe and flame.exe, which did all the work. They took in XML and other files and emitted .msi files. So that's where to look for code to do this.
  • Tauri This is a full toolset, an alternative to cargo. It's mostly intended for web apps. It used to have a standalone executable called tauri-bundler, which was a based on cargo-bundle. That could successfully make .msi files. But inside, it was calling candle.exe and flame.exe. The Tauri developers made the bundler into a library, which is useful if you want to integrate it into something else. But you still need to be able to run candle.exe and flame.exe, which are Windows-only.

So, is there interest in this? All the necessary parts seem to exist. This needs someone who lives in Windows land, and understands Windows installers, which I do not.

It seems a lack that the Rust system can cross-compile all the way to a Windows executable, but not do the last step needed to make a usable application.

2 Likes

This is not necessarily the case: a decent amount of software offers "portable" installations which are just an exe or a folder that you place wherever on your PC. If all you have is a single exe and you don't need support files, then you can be done here with a probable executable!

That said, yes, the general expectation of Windows consumers is to download an installer — a single something file that they can double click to visually walk through installing software to a standard or custom location. (It's worth noting that it actually being in msi/msix format isn't important; much software ships an installer exe. It's just "an executable" to anyone who doesn't care about the benefits of an msi installer over adhoc executables.)

Additionally, if shipping via a platform distribution like Steam, you don't want an installer file; instead you tell steamcmd that it should copy these files into this relative location in an install, and assign the files to a depot.

More assets: there's a rust-msi crate for reading and writing .msi files entirely from Rust. The author wrote, back in 2018, that this was intended to help make cargo-bundle work for Windows targets. But that was never done.

Windows warning

Microsoft "discourages" that.

The jaws are closing on raw .exe files. Microsoft wants an installer. And code signing. And Microsoft Play Store approval. That's mandatory for locked-down Windows 10 S systems, or enterprise systems.

So, Rust needs signable bundling if Rust is to be used by non-developers.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.