概要
RustのWebフレームワークを使ったときにエラーが出たのでメモ。Rockerのドキュメントのクイックスタートをやってみました。問題の解決方法としてはcargo rust
を実行するときにrustのnightly版を使って実行すれば解決できますが、nightlyの使い方を知るまでに時間がかかりました。エラー内容は長いので記事の最後に記載します。
(2018/05/10追記)
@ykonomi さんがコメントに載せてくださったやり方でnightlyを動かすのでも良さそうです!
環境:windows10
やったこと
nightlyをinstall
rustc install nightly
nightlyをつかう。この'+nightly'を知るまでに時間がかかった。
cargo +nightly run
これで実行できた。
#エラー内容
error: failed to run custom build command for `rocket_codegen v0.3.8 (file:///xxx/rust/Rocket/codegen)`
process didn't exit successfully: `xxx\rust\Rocket\target\debug\build\rocket_codegen-d2d1541e746ad235\build-script-build` (exit code: 101)
--- stderr
?[1;31mError:?[0m ?[37mRocket requires a nightly or dev version of Rust.?[0m
?[37mInstalled version is:?[0m ?[33m1.25.0 (2018-03-25)?[0m. ?[37mMinimum required:?[0m ?[33m1.27.0-nightly (2018-04-06)?[0m.
?[34mSee the getting started guide (?[0m?[37mhttps://rocket.rs/guide/getting-started/?[0m?[34m) for more information.?[0m
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', codegen\build.rs:38:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `pear_codegen v0.0.16`
process didn't exit successfully: `xxx\rust\Rocket\target\debug\build\pear_codegen-a28c5dcc6703d3d8\build-script-build` (exit code: 101)
--- stderr
?[1;31mError:?[0m ?[37mPear requires a nightly or dev version of Rust.?[0m
?[37mInstalled version is:?[0m ?[33m1.25.0 (2018-03-25)?[0m. ?[37mMinimum required:?[0m ?[33m1.27.0-nightly (2018-04-14)?[0m.
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', xxx\.cargo\registry\src\github.com-1ecc6299db9ec823\pear_codegen-0.0.16\build.rs:31:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `rocket v0.3.8 (file:///xxx/rust/Rocket/lib)`
process didn't exit successfully: `xxx\rust\Rocket\target\debug\build\rocket-c96e4e05a2a699a0\build-script-build` (exit code: 101)
--- stderr
?[1;31mError:?[0m ?[37mRocket requires a nightly or dev version of Rust.?[0m
?[37mInstalled version is:?[0m ?[33m1.25.0 (2018-03-25)?[0m. ?[37mMinimum required:?[0m ?[33m1.27.0-nightly (2018-04-03)?[0m.
?[34mSee the getting started guide (?[0m?[37mhttps://rocket.rs/guide/getting-started/?[0m?[34m) for more information.?[0m
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', lib\build.rs:38:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed
20180501追記
nightlyをデフォルトにすることができるみたい。やってはいないが、これで+nightly
の指定がいらなくなるのかな。
rustup default nightly
参考
https://github.com/rust-lang-nursery/rustup.rs/issues/762
https://rocket.rs/guide/quickstart/#running-examples
https://qiita.com/yyu/items/18df35988f3ea3b12af0