nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

Can't install cargo-update v0.5.2 in the 'normal' console on Windows #17

Closed mzji closed 7 years ago

mzji commented 7 years ago

When I tried to install the cargo-update in the normal console (read as: not developer console) as usual, I get:

C:\Users\USERNAME>cargo install cargo-update -f
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading cargo-update v0.5.2
 Downloading json v0.11.1
   Compiling ansi_term v0.9.0
   Compiling regex-syntax v0.3.9
   Compiling rustc-serialize v0.3.21
   Compiling winapi v0.2.8
   Compiling vec_map v0.6.0
   Compiling unicode-width v0.1.3
   Compiling strsim v0.5.2
   Compiling json v0.11.1
   Compiling libc v0.2.17
   Compiling array_tool v0.3.3
   Compiling winapi-build v0.1.1
   Compiling unicode-segmentation v0.1.2
   Compiling bitflags v0.7.0
   Compiling utf8-ranges v0.1.3
   Compiling cargo-update v0.5.2
   Compiling lazy_static v0.2.2
   Compiling tabwriter v0.1.25
   Compiling memchr v0.1.11
   Compiling kernel32-sys v0.2.2
   Compiling aho-corasick v0.5.3
Build failed, waiting for other jobs to finish...
error: failed to compile `cargo-update v0.5.2`, intermediate artifacts can be found at `C:\Users\USERNAME\AppData\Local\Temp\cargo-install.JYDW3ptfUGzE`

Caused by:
  failed to run custom build command for `cargo-update v0.5.2`
process didn't exit successfully: `C:\Users\USERNAME\AppData\Local\Temp\cargo-install.JYDW3ptfUGzE\release\build\cargo-update-6aef32cf34a5954c\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 2, message: "The system cannot find the file specified." } }', ../src/libcore\result.rs:837
stack backtrace:
   0:     0x7ff7bec3114a - std::panicking::default_hook::{{closure}}
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:252
   1:     0x7ff7bec30656 - std::panicking::default_hook
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:263
   2:     0x7ff7bec33f4d - std::panicking::rust_panic_with_hook
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:451
   3:     0x7ff7bec33de8 - std::panicking::begin_panic<collections::string::String>
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:413
   4:     0x7ff7bec33d04 - std::panicking::begin_panic_fmt
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:397
   5:     0x7ff7bec33c99 - std::panicking::rust_begin_panic
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:373
   6:     0x7ff7bec36757 - core::panicking::panic_fmt
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libcore\panicking.rs:69
   7:     0x7ff7bec2108f - POW10TO128
   8:     0x7ff7bec21753 - POW10TO128
   9:     0x7ff7bec360d1 - panic_unwind::__rust_maybe_catch_panic
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libpanic_unwind\lib.rs:97
  10:     0x7ff7bec3453a - std::rt::lang_start
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\rt.rs:51
  11:     0x7ff7bec39748 - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
  12:     0x7ffc873e8363 - BaseThreadInitThunk

Then I try to re-do this in the developer console, I get:

D:\Microsoft Visual Studio 14.0\VC>cargo install cargo-update -f
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling utf8-ranges v0.1.3
   Compiling lazy_static v0.2.2
   Compiling unicode-width v0.1.3
   Compiling bitflags v0.7.0
   Compiling regex-syntax v0.3.9
   Compiling rustc-serialize v0.3.21
   Compiling libc v0.2.17
   Compiling winapi-build v0.1.1
   Compiling json v0.11.1
   Compiling vec_map v0.6.0
   Compiling array_tool v0.3.3
   Compiling unicode-segmentation v0.1.2
   Compiling winapi v0.2.8
   Compiling strsim v0.5.2
   Compiling ansi_term v0.9.0
   Compiling cargo-update v0.5.2
   Compiling tabwriter v0.1.25
   Compiling memchr v0.1.11
   Compiling kernel32-sys v0.2.2
   Compiling aho-corasick v0.5.3
   Compiling toml v0.2.1
   Compiling thread-id v2.0.0
   Compiling term_size v0.2.1
   Compiling thread_local v0.2.7
   Compiling clap v2.19.0
   Compiling regex v0.1.80
   Compiling semver-parser v0.6.1
   Compiling semver v0.5.1
    Finished release [optimized] target(s) in 251.12 secs
   Replacing C:\Users\Mystery\.cargo\bin\cargo-install-update.exe

Obviously, this line in the build.rs tries to .unwrap() to run the rc program which is unavailable in the 'normal' console, then aborts the building process.

VS users won't always add the path of the building tools into $PATH. Also, running cargo and all of its sub-commands won't need a developer console. Since installing the old version of cargo-update won't need the developer console, I hope installing new versions won't need the developer console, too.

nabijaczleweli commented 7 years ago

What the fuck is a developer console. Fix your $PATH.

mzji commented 7 years ago

@nabijaczleweli I'd have to say, when I see the f-word, I feel a bit uncomfortable. Below is the explain of what is 'the developer console'. By default, after installed the Visual Studio or the Visual C++ building tools, the path of C/C++ building tools won't add to your $PATH by default. The way to use the C/C++ building tools, recommended by Microsoft, is running this shortcut link in the Start Menu: Screenshot of the VS entry This shortcut is the 'developer console'. Click it, then a new console starts: Screenshot of the developer console Starting this shortcut, on Windows, is slow, even with a SSD. It takes about 8~10 seconds on my machine (with an SSD, of course). As I said above, the path of C/C++ building tools is not added to the $PATH by default. So when a MSVC user try to cargo install cargo-update in the normal console (since cargo itself don't need a developer console to run) will just get a building error with no hints. At least, we could add some notes in the README.md, to tell MSVC users that it's required to use a developer console (or add the path of C/C++ building tools to the $PATH, of course) to install or update the cargo-update crate. Best regards, MZ Ji

nabijaczleweli commented 7 years ago

So you consciously choose to be incompatible with everything on the goddamn planet. Fine, I'll add a notice or something.

nabijaczleweli commented 7 years ago

Released in v0.5.3