佐藤のメモ帳

Rust, Python, Java, AWS, etc...

error: the option `Z` is only accepted on the nightly compiler

TL;DR

安定版では使用できないオプション。 以下で解決した。

rustup install nightly
rustup default nightly

問題

Bevyのチュートリアルで高速コンパイルを試そうとした。

.cargo/config.tomlこれをコピーし、ビルドしたら以下のエラーが発生した。

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -C link-arg=-fuse-ld=/usr/local/bin/zld -Zshare-generics=y --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
  --- stderr
  error: the option `Z` is only accepted on the nightly compiler

環境

  • macOS Big Sur
  • cargo 1.55.0 (32da73ab1 2021-08-23)

解決

stackoverflow.com

Zオプションは安定板コンパイラでは使用できない。
ナイトリー版に入れ替えたら(cargo 1.56.0-nightly (18751dd3f 2021-09-01))ビルドが通った。

rustup install nightly
rustup default nightly