rustc
rustcはrust用コンパイラである。
Usage: rustc [OPTIONS] INPUT
Options:
-h, --help Display this messageヘルプを表示します。
--cfg SPEC Configure the compilation environmentコンパイル環境を構成する。条件付きコンパイルのための設定を渡す。 条件付きコンパイルについては以下で説明されている。 https://doc.rust-jp.rs/the-rust-programming-language-ja/1.6/book/conditional-compilation.html
-L [KIND=]PATH Add a directory to the library search path. The
optional KIND can be one of dependency, crate, native,
framework, or all (the default).ライブラリ検索パスにディレクトリを追加する。 KINDには以下のオプションを指定できる。
- dependency
- crate
- native
- framework
- all (the default)
-l [KIND=]NAME Link the generated crate(s) to the specified native
library NAME. The optional KIND can be one of
static, framework, or dylib (the default).生成されたクレートを指定されたネイティブライブラリNAMEにリンクする。 KINDには以下のオプションを指定できる。
- static
- framework
- dylib (the default)
--crate-type [bin|lib|rlib|dylib|cdylib|staticlib|proc-macro]
Comma separated list of types of crates
for the compiler to emitコンパイラが発行するクレートの種類のカンマ区切りリストを指定する。
| crate-type | 用途 |
|---|---|
| bin | 実行可能形式 |
| lib | その時に応じて適切な種類を自動で選択(rustcではrlibが作られる) |
| rlib | Rust用静的ライブラリ |
| dylib | Rust用動的ライブラリ |
| cdylib | 汎用動的ライブラリ |
| staticlib | 汎用静的ライブラリ |
| proc-macro | Procedural macros |
参考
- https://qiita.com/etoilevi/items/4bd4c5b726e41f5a6689
- https://slideship.com/users/@statiolake/presentations/2019/07/CZ9wX4Zi8R93MhxN7jRBK5/
--crate-name NAME
Specify the name of the crate being builtクレート名を指定する。
--edition 2015|2018
Specify which edition of the compiler to use when
compiling code.コードのコンパイル時に使用するコンパイラのエディションを指定する。
参考 https://qiita.com/garkimasera/items/1bc973eae60fe0c10210
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
Comma separated list of types of output for the
compiler to emitコンパイラーが出力する出力タイプのコンマ区切りリストを指定する。
| emit | 意味 |
|---|---|
| asm | アセンブリ |
| llvm-bc | |
| llvm-ir | LLVM-IR中間言語 |
| obj | |
| metadata | |
| link | |
| dep-info | |
| mir |
--print [crate-name|file-names|sysroot|cfg|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|native-static-libs]
Compiler information to print on stdoutstdoutに出力するコンパイラ情報。
| 指定 | 意味 |
|---|---|
| crate-name | |
| file-names | |
| sysroot | |
| cfg | |
| target-list | |
| target-cpus | |
| target-features | |
| relocation-models | |
| code-models | |
| tls-models | |
| target-spec-json | |
| native-static-libs |
-g Equivalent to -C debuginfo=2-C debuginfo=2 と等価。
-O Equivalent to -C opt-level=2-C opt-level=2 と等価。
-o FILENAME Write output to <filename>出力ファイル名を指定する。
--out-dir DIR Write output to compiler-chosen filename in <dir>出力ディレクトリを指定する。
--explain OPT Provide a detailed explanation of an error messageエラーメッセージの詳細な説明を提供する。
--test Build a test harnessテストハーネスをビルドする。
--target TARGET Target triple for which the code is compiledコードがコンパイルされる対象のトリプル1。
Target triple とは何を指しているのか?
-W, --warn OPT Set lint warningslintのワーニングを出力する。
-A, --allow OPT Set lint allowedlintのワーニングを許容する。
-D, --deny OPT Set lint deniedlintのワーニングを許容しない。
-F, --forbid OPT Set lint forbiddenlintのワーニングを拒否する。
--cap-lints LEVEL
Set the most restrictive lint level. More restrictive
lints are capped at this level最も制限の厳しいlintレベルを設定する。 より制限的リントはこのレベルで制限される。
-C, --codegen OPT[=VALUE]
Set a codegen optioncodegenオプションを設定する。 https://docs.rs/codegen/0.1.3/codegen/
-V, --version Print version info and exitバージョンを表示する。
-v, --verbose Use verbose output出力を多くする。
Additional help:
-C help Print codegen optionscodegenオプションを表示する。
-W help Print 'lint' options and default settingslintオプションとデフォルト設定を表示する。
-Z help Print unstable compiler optionsunstableなコンパイラオプションを表示する。
--help -v Print the full set of options rustc acceptsrustcのhelpを表示する。