Rust .msi installer ignores current install

9427b3b
Opened by Austin Bonander at 2023-11-18 21:00:04

One of the convenient features of the defunct .exe installer is it would remove old library archives before installing new ones, so that one could update Rust just by running over the current install. The .msi installer does not do this, it just naively installs the new libraries next to the old ones, and Rust can't figure out which to use:

rustbook\src\main.rs:1:1: 1:1 error: multiple matching crates for `std`
rustbook\src\main.rs:1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
                       ^
note: candidates:
note: path: \\?\C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\std-d855c359.dll
note: path: \\?\C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\libstd-d855c359.rlib
note: crate name: std
note: path: \\?\C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\std-74fa456f.dll
note: path: \\?\C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\libstd-74fa456f.rlib
note: crate name: std
rustbook\src\main.rs:1:1: 1:1 error: found staticlib `std` instead of rlib or dylib
rustbook\src\main.rs:1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
                       ^
rustbook\src\main.rs:1:1: 1:1 help: please recompile this crate using --crate-type lib
rustbook\src\main.rs:1:1: 1:1 note: crate `std` path #1: C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\libstdc++.a
error: aborting due to 2 previous errors
Could not compile `rustbook`.

To learn more, run the command again with --verbose.

I can't simply update my Rust install anymore. I have to remove the old libraries either manually or by running the Rust uninstaller. This is a major convenience discrepancy compared to using Rust on the Unix-based platforms.

  1. Note: this issue is about installing a new version of Rust over an old version in the same folder. It doesn't concern installing separate versions of Rust in separate folders. An "Update" option to the installer that automatically selects the current Rust install path would be great as well, as it currently suggests something rather arbitrary, C:\Program Files\Rust nightly update 1.3 or something like that.

    Austin Bonander at 2015-07-03 21:58:13

  2. I think because the name of the software changes with each version of Rust, the msi installation system ends up thinking that they are two different pieces of software and thus doesn't recognize the old version to ask you what you want to do with it. Ideally the installer would detect if there is an existing installation of Rust in the folder you're installing to and automatically uninstall the old one, but I'm not sure how to do that with msi.

    Peter Atashian at 2015-07-04 22:55:32

  3. It's disappointing because the .exe installer did this. It was my preferred method of updating when it was still available.

    Austin Bonander at 2015-07-05 02:06:13

  4. cc @brson @vadimcn

    Peter Atashian at 2015-07-05 02:27:01

  5. The .msi installer only updates versions which have the same (platform,channel,major,minor) tuple. For example it will update nightly 1.3.X -> 1.3.Y in-place. Everything else is treated as different software version - to enable installing them side-by side (which the .exe version did not allow). The detection is based on versions stored in the registry, not on the installation path. In other words, this is by design. In order to gain something (side-by-side installs) you lose something (ease of upgrade for users who don't care about side-by-side)...

    vadimcn at 2015-07-05 18:27:26

  6. That's an issue because I only really bother to update when the minor version gets bumped, as I expect is the same with many people. And, like I said, this is a pretty big discrepancy when you look at how easy it is to install and update Rust on the *nixes, package manager or otherwise.

    Why does the Rust installer care about side-by-side installs anyways? Can't multirust be updated to support Windows for this? Is the .exe installer still being built but just doesn't have a link provided for it?

    Austin Bonander at 2015-07-05 18:45:38

  7. Why does the Rust installer care about side-by-side installs anyways?

    This is based partly on my own preferences and partly because Python also does upgrades this way.

    Can't multirust be updated to support Windows for this?

    Multirust is a shell script that uses a bunch of unix command line tools, so it won't work on Windows without msys.

    vadimcn at 2015-07-05 19:22:15

  8. Nominating because this is surprising behavior to a lot of people.

    Brian Anderson at 2015-07-06 18:28:18

  9. triage: P-medium

    Would love to fix, but doesn't seem super high priority right now.

    Alex Crichton at 2015-07-20 05:03:18

  10. This is very confusing for new users. I just installed Rust 1.3 and had a old version of Rust 1.0, but never used it. The first "Hello World" example gave me this error messages:

    D:\code\rusty>rustc main.rs
    main.rs:1:1: 1:1 error: multiple matching crates for `std`
    main.rs:1 fn main() {
              ^
    note: candidates:
    note: path: \\?\D:\coding\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\std-4e7c5e5c.dll
    note: path: \\?\D:\coding\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\libstd-4e7c5e5c.rlib
    note: crate name: std
    note: path: \\?\D:\coding\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\std-198068b3.dll
    note: path: \\?\D:\coding\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\libstd-198068b3.rlib
    note: crate name: std
    main.rs:1:1: 1:1 error: found staticlib `std` instead of rlib or dylib
    main.rs:1 fn main() {
              ^
    main.rs:1:1: 1:1 help: please recompile this crate using --crate-type lib
    main.rs:1:1: 1:1 note: crate `std` path #1: D:\coding\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\libstdc++.a
    error: aborting due to 2 previous errors
    

    Google brought me here and I understand now that I shouldn't have installed Rust in the old directory, but still very confusing behaviour.

    I just wish the updates for Rust in msys2 would come faster.

    Josef at 2015-09-30 13:12:43

  11. To add to this issue, I'm not sure if this is specific to the .msi installer over the .exe installer, but it also appends the new directory to the PATH rather than replacing the current instance. This caused my system to prefer the old version rather than the new version and I had to update my PATH manually.

    Aaron Levine at 2016-03-08 14:52:35

  12. cc https://github.com/rust-lang/rust/issues/35653

    Brian Anderson at 2016-08-22 23:00:52

  13. Triage: I'm not totally sure, and frankly don't want to try and reproduce and mess up my local install, heh.

    I'm not sure how important this is these days, in the world of rustup.

    Steve Klabnik at 2018-10-31 15:24:51

  14. Triage: .msi is still provided as an official installation method: https://forge.rust-lang.org/infra/other-installation-methods.html. Can someone please check if this is still a problem? Many years has passed since this was last reported to be a problem. Thanks!

    Martin Nordholts at 2023-11-18 20:59:52