====== Rust 関連 ====== {{:rust:rust_programming_language_black_logo.svg?200|Rust ロゴ}}\\ **Rust** (ラスト) は、性能、メモリ安全性、安全な並行性を目指して設計されたマルチパラダイムのプログラミング言語である。C 言語、C++ に代わるシステムプログラミング言語を目指しており、構文的にはC++に似ているが、「ボローチェッカー」(borrow checker) で参照の有効性を検証することによってメモリ安全性を保証できる。Rust はガベージコレクションなしでのメモリ安全性を達成しており、必要な場面で参照カウントを使うこともできる。\\ 出典: [[wwjp>Rust_(プログラミング言語)|Rust (プログラミング言語) - Wikiwand]]\\ 本家: [[https://www.rust-lang.org/ja/|Rustプログラミング言語]] - rust-lang.org\\   [[https://rust-jp.rs|Rust の日本語情報]] - rust-jp.rs\\ ソースコード: [[git>rust-lang|The Rust Programming Language]] [[gtr>https://github.com/rust-lang/rust|翻訳]]\\        [[git>rust-lang/rust|GitHub - rust-lang/rust: Empowering everyone to build reliable and efficient software.]]\\ ドキュメント: [[https://doc.rust-lang.org/book/|The Rust Programming Language - The Rust Programming Language]] [[gtr>https://doc.rust-lang.org/book/|翻訳]] (公式英語) - rust-lang.org\\        [[https://www.rust-lang.org/ja/learn|Rustを学ぶ/Rustプログラミング言語]] - rust-lang.org\\        [[https://doc.rust-jp.rs/|Rustの日本語ドキュメント/Japanese Docs for Rust]] - rust-jp.rs\\        [[https://doc.rust-jp.rs/book-ja/|The Rust Programming Language 日本語版 - The Rust Programming Language 日本語版]] (日本語訳) - rust-jp.rs\\        [[https://doc.rust-jp.rs/book-ja-pdf/book.pdf|The Rust Programming Language 日本語版 (PDF版)]] (日本語訳) - rust-jp.rs\\        [[https://doc.rust-jp.rs/rust-by-example-ja/index.html|Introduction - Rust By Example 日本語版]] - rust-jp.rs\\        [[https://doc.rust-lang.org/rust-by-example/index.html|Introduction - Rust By Example]] - rust-lang.org\\ その他: [[https://rust-lang.github.io/rfcs/introduction.html|Introduction - The Rust RFC Book]] [[gtr>https://rust-lang.github.io/rfcs/introduction.html|翻訳]]\\ ===== 関連文献 ===== [[:python:jupyterlab:jupyterlab_and_rust|JupyterLab + Rust 開発環境の構築]]\\ ===== インストール ===== 参考:\\  [[https://doc.rust-jp.rs/book-ja/ch01-01-installation.html|インストール - The Rust Programming Language 日本語版]]\\  [[https://forge.rust-lang.org/infra/other-installation-methods.html|Other Installation Methods - Rust Forge]]\\ ==== Linux ==== === Fedora (Rust 公式から...) === 公式(非公式日本語翻訳): [[https://doc.rust-jp.rs/book-ja/ch01-01-installation.html#linux%E3%81%A8macos%E3%81%ABrustup%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B|インストール - The Rust Programming Language 日本語版]] より\\ **cargo**、**rustc**、および、**rustup**などもインストールされる😃\\
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /home/tomoyan/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /home/tomoyan/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /home/tomoyan/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /home/tomoyan/.profile
  /home/tomoyan/.bash_profile
  /home/tomoyan/.bashrc

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
> Enter で続行

info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2023-03-28, rust version 1.68.2 (9eb3afe9e 2023-03-27)
info: downloading component 'cargo'
  6.7 MiB /   6.7 MiB (100 %)   2.2 MiB/s in  3s ETA:  0s
info: downloading component 'clippy'
  2.4 MiB /   2.4 MiB (100 %) 951.7 KiB/s in  2s ETA:  0s
info: downloading component 'rust-docs'
 19.5 MiB /  19.5 MiB (100 %)   4.0 MiB/s in  4s ETA:  0s
info: downloading component 'rust-std'
 29.9 MiB /  29.9 MiB (100 %)   4.9 MiB/s in  6s ETA:  0s
info: downloading component 'rustc'
 68.1 MiB /  68.1 MiB (100 %)   4.3 MiB/s in 15s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 19.5 MiB /  19.5 MiB (100 %)   5.5 MiB/s in  3s ETA:  0s
info: installing component 'rust-std'
 29.9 MiB /  29.9 MiB (100 %)   7.3 MiB/s in  4s ETA:  0s
info: installing component 'rustc'
 68.1 MiB /  68.1 MiB (100 %)   9.1 MiB/s in  7s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu installed - rustc 1.68.2 (9eb3afe9e 2023-03-27)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source "$HOME/.cargo/env"
warning: it looks like you have an existing installation of Rust at: warning: /usr/bin warning: rustup should not be installed alongside Rust. Please uninstall your existing Rust first. warning: Otherwise you may have confusion unless you are careful with your PATH warning: If you are sure that you want both rustup and your already installed Rust warning: then please reply `y' or `yes' or set RUSTUP_INIT_SKIP_PATH_CHECK to yes warning: or pass `-y' to ignore all ignorable checks. Rust の既存のインストールがあるようです: /usr/bin rustup は Rust と一緒にインストールしないでください。最初に既存の Rust をアンインストールしてください。 そうしないと、PATH に注意しない限り、混乱する可能性があります。 rustup とすでにインストールされているRustの両方が必要な場合は、`y' または `yes' と応答するか、RUSTUP_INIT_SKIP_PATH_CHECK を yes に設定するか、`-y' を渡してすべてのチェックを無視できます。 Welcome to Rust! This will download and install the official compiler for the Rust programming language, and its package manager, Cargo. Rustup metadata and toolchains will be installed into the Rustup home directory, located at: /home/tomoyan/.rustup This can be modified with the RUSTUP_HOME environment variable. The Cargo home directory located at: /home/tomoyan/.cargo This can be modified with the CARGO_HOME environment variable. The cargo, rustc, rustup and other commands will be added to Cargo's bin directory, located at: /home/tomoyan/.cargo/bin This path will then be added to your PATH environment variable by modifying the profile files located at: /home/tomoyan/.profile /home/tomoyan/.bash_profile /home/tomoyan/.bashrc You can uninstall at any time with rustup self uninstall and these changes will be reverted. Rust へようこそ! これにより、Rust プログラミング言語の公式コンパイラとそのパッケージマネージャーである Cargo がダウンロードおよびインストールされます。 Rustupメタデータとツールチェーンは、次の場所にあるRustupホームディレクトリにインストールされます。 /home/tomoyan/.rustup これは、RUSTUP_HOME 環境変数を使用して変更できます。 次の場所にある Cargo ホームディレクトリ: /home/tomoyan/.cargo これは、CARGO_HOME 環境変数を使用して変更できます。 cargo、rustc、rustup、およびその他のコマンドは、次の場所にある Cargo の bin ディレクトリに追加されます。 /home/tomoyan/.cargo/bin このパスは、次の場所にあるプロファイルファイルを変更することにより、PATH 環境変数に追加されます。 /home/tomoyan/.profile /home/tomoyan/.bash_profile /home/tomoyan/.bashrc rustup セルフアンインストールを使用すると、いつでもアンインストールでき、これらの変更は元に戻されます。 **.bashrc** に自動ロードの設定を追加する。\\
$ echo 'source $HOME/.cargo/env' >> ~/.bashrc
**bash** の設定を反映させる。\\
$ . ~/.bashrc
**動作確認**\\
$ rustup --version
rustup 1.25.2 (17db695f1 2023-02-01)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.68.2 (9eb3afe9e 2023-03-27)`
$ rustc --version
rustc 1.68.2 (9eb3afe9e 2023-03-27)
$ cargo --version
cargo 1.68.2 (6feb7c9cf 2023-03-26)
**実行ファイルのパス確認**\\
$ which rustup rustc cargo
~/.cargo/bin/rustup
~/.cargo/bin/rustc
~/.cargo/bin/cargo
こちらは Fedora のリポジトリからインストールしたコマンドである🤔\\
$ /bin/rustc --version && /bin/cargo --version
rustc 1.63.0 (Fedora 1.63.0-1.fc36)
cargo 1.63.0
=== Fedora (RPM パッケージから...) === この手順はスキップして構わない。Rust 公式からのインストールで開発環境は整う🤔\\ **cargo**、**rustc** はインストールされるが、**rustup** が存在しない...🤔\\
$ sudo dnf install rust cargo
メタデータの期限切れの最終確認: 4:36:48 時間前の 2022年08月31日 22時35分04秒 に実施しました。
依存関係が解決しました。
==============================================================================================================
 パッケージ                    アーキテクチャー     バージョン                    リポジトリー          サイズ
==============================================================================================================
インストール:
 cargo                         x86_64               1.63.0-1.fc36                 updates               4.6 M
 rust                          x86_64               1.63.0-1.fc36                 updates                25 M
依存関係のインストール:
 rust-std-static               x86_64               1.63.0-1.fc36                 updates                27 M

トランザクションの概要
==============================================================================================================
インストール  3 パッケージ

ダウンロードサイズの合計: 56 M
インストール後のサイズ: 220 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
(1/3): cargo-1.63.0-1.fc36.x86_64.rpm                                         3.7 MB/s | 4.6 MB     00:01    
(2/3): rust-std-static-1.63.0-1.fc36.x86_64.rpm                               2.7 MB/s |  27 MB     00:09    
(3/3): rust-1.63.0-1.fc36.x86_64.rpm                                          1.7 MB/s |  25 MB     00:14    
--------------------------------------------------------------------------------------------------------------
合計                                                                          3.4 MB/s |  56 MB     00:16     
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                                                      1/1 
  インストール中   : rust-std-static-1.63.0-1.fc36.x86_64                                                 1/3 
  インストール中   : rust-1.63.0-1.fc36.x86_64                                                            2/3 
  インストール中   : cargo-1.63.0-1.fc36.x86_64                                                           3/3 
  scriptletの実行中: cargo-1.63.0-1.fc36.x86_64                                                           3/3 
  検証             : cargo-1.63.0-1.fc36.x86_64                                                           1/3 
  検証             : rust-1.63.0-1.fc36.x86_64                                                            2/3 
  検証             : rust-std-static-1.63.0-1.fc36.x86_64                                                 3/3 

インストール済み:
  cargo-1.63.0-1.fc36.x86_64       rust-1.63.0-1.fc36.x86_64       rust-std-static-1.63.0-1.fc36.x86_64      

完了しました!
**動作確認**\\
$ rustc --version
rustc 1.63.0 (Fedora 1.63.0-1.fc36)
$ cargo --version
cargo 1.63.0
=== DietPi (Raspberry Pi Zero WH) === 公式: [[https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-linux-or-macos|Installation - The Rust Programming Language]] [[gtr>https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-linux-or-macos|翻訳]]\\ 非公式日本語: [[https://doc.rust-jp.rs/book-ja/ch01-01-installation.html#linux%E3%81%A8macos%E3%81%ABrustup%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B|インストール - The Rust Programming Language 日本語版]]\\
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /home/dietpi/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /home/dietpi/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /home/dietpi/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /home/dietpi/.profile
  /home/dietpi/.bashrc

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: arm-unknown-linux-gnueabihf
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
> -> Enter を入力

info: profile set to 'default'
info: default host triple is arm-unknown-linux-gnueabihf
info: syncing channel updates for 'stable-arm-unknown-linux-gnueabihf'
info: latest update on 2023-08-03, rust version 1.71.1 (eb26296b5 2023-08-03)
info: downloading component 'cargo'
  6.5 MiB /   6.5 MiB (100 %) 609.6 KiB/s in 10s ETA:  0s
info: downloading component 'clippy'
  2.2 MiB /   2.2 MiB (100 %) 444.4 KiB/s in  6s ETA:  0s
info: downloading component 'rust-docs'
 13.6 MiB /  13.6 MiB (100 %) 552.9 KiB/s in 29s ETA:  0s
info: downloading component 'rust-std'
 23.0 MiB /  23.0 MiB (100 %) 424.2 KiB/s in 50s ETA:  0s
info: downloading component 'rustc'
 73.0 MiB /  73.0 MiB (100 %) 443.7 KiB/s in  2m  9s ETA:  0s    
info: downloading component 'rustfmt'
  2.1 MiB /   2.1 MiB (100 %) 490.6 KiB/s in  4s ETA:  0s
info: installing component 'cargo'
  6.5 MiB /   6.5 MiB (100 %)   1.5 MiB/s in  4s ETA:  0s
info: installing component 'clippy'
  2.2 MiB /   2.2 MiB (100 %)   1.6 MiB/s in  2s ETA:  0s
info: installing component 'rust-docs'
 13.6 MiB /  13.6 MiB (100 %) 398.4 KiB/s in  1m 19s ETA:  0s
info: installing component 'rust-std'
 23.0 MiB /  23.0 MiB (100 %)   1.5 MiB/s in 23s ETA:  0s
info: installing component 'rustc'
 73.0 MiB /  73.0 MiB (100 %) 940.8 KiB/s in 58s ETA:  0s
info: installing component 'rustfmt'
  2.1 MiB /   2.1 MiB (100 %)   1.6 MiB/s in  2s ETA:  0s
info: default toolchain set to 'stable-arm-unknown-linux-gnueabihf'

  stable-arm-unknown-linux-gnueabihf installed - rustc 1.71.1 (eb26296b5 2023-08-03)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source "$HOME/.cargo/env"
#!/bin/sh # rustup shell setup # affix colons on either side of $PATH to simplify matching case ":${PATH}:" in *:"$HOME/.cargo/bin":*) ;; *) # Prepending path in case a system-installed rustc needs to be overridden export PATH="$HOME/.cargo/bin:$PATH" ;; esac **.profile** に自動ロードの設定を追加する。\\
$ echo 'source $HOME/.cargo/env' >> ~/.profile
**動作確認**\\
$ rustc --version
rustc 1.61.0 (fe5b13d68 2022-05-18)
$ cargo --version
cargo 1.61.0 (a028ae42f 2022-04-29)
~/.cargo/bin/ の内容🤔\\
$ ls -l ~/.cargo/bin/
total 181136
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 cargo
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 cargo-clippy
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 cargo-fmt
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 cargo-miri
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 clippy-driver
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 rls
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 rust-gdb
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 rust-lldb
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 rustc
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 rustdoc
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 rustfmt
-rwxr-xr-x 12 dietpi dietpi 13974212 Jun  8 08:49 rustup
-rwxr-xr-x  1 dietpi dietpi 17775060 Jun 16 19:34 sccache
==== Windows ==== Visual Studio、Visual Studio Code を利用する場合は [[https://learn.microsoft.com/ja-jp/windows/dev-environment/rust/setup|Windows で Rust 用の開発環境を設定する]] も参照。\\ \\ 以下は [[windows:scoop|Scoop]] によるインストール手順です🤔\\
$ scoop install rustup
Installing 'rustup' (1.26.0) [64bit] from main bucket
rustup-init.exe (8.2 MB) [====================================================================================] 100%
Checking hash of rustup-init.exe ... ok.
Running installer script...
Linking ~\scoop\apps\rustup\current => ~\scoop\apps\rustup\1.26.0
Persisting .cargo
Persisting .rustup
'rustup' (1.26.0) was installed successfully!
Notes
-----
This package defaults to using the MSVC toolchain in new installs; use "rustup set default-host" to configure it
(existing installs may be using the GNU toolchain by default)
According to https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-windows
Microsoft C++ Build Tools is needed and can be downloaded here:
https://visualstudio.microsoft.com/visual-cpp-build-tools/
When installing build tools, these two components should be selected:
- MSVC - VS C++ x64/x86 build tools
- Windows SDK
Notes ----- This package defaults to using the MSVC toolchain in new installs; use "rustup set default-host" to configure it (existing installs may be using the GNU toolchain by default) According to https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-windows Microsoft C++ Build Tools is needed and can be downloaded here: https://visualstudio.microsoft.com/visual-cpp-build-tools/ When installing build tools, these two components should be selected: - MSVC - VS C++ x64/x86 build tools - Windows SDK ノート ----- このパッケージは、新規インストールではデフォルトで MSVC ツールチェーンを使用します。 "rustup set default-host" を使用して設定します (既存のインストールではデフォルトで GNU ツールチェーンが使用されている可能性があります) https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-windows によると Microsoft C++ Build Tools が必要で、ここからダウンロードできます: https://visualstudio.microsoft.com/visual-cpp-build-tools/ ビルド ツールをインストールするときは、次の 2 つのコンポーネントを選択する必要があります: - MSVC - VS C++ x64/x86 build tools - Windows SDK To get started you need Cargo's bin directory (C:\Users\tomoyan\scoop\persist \rustup\.cargo\bin) in your PATH environment variable. This has not been done automatically. 開始するには、PATH 環境変数に Cargo の bin ディレクトリ (C:\Users\tomoyan\scoop\persist\rustup\.cargo\bin) が必要です。 これは自動的には行われません。 Notes ----- To use the MSVC ABI without Visual Studio 2015 (or higher) installed, you will need the Visual Studio 2017 Build Tools: https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017 Visual Studio 2015 (またはそれ以降) をインストールせずにMSVC ABIを使用するには、Visual Studio 2017ビルドツールが必要です。 https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017 **環境変数の設定**\\
$ cat ~\scoop\buckets\main\bucket\rustup.json
{
    "version": "1.26.0",
    "description": "Manage multiple rust installations with ease",
    "homepage": "https://rustup.rs",
    "license": "MIT|Apache-2.0",
    "notes": [
        "This package defaults to using the MSVC toolchain in new installs; use \"rustup set default-host\" to configure it",
        "(existing installs may be using the GNU toolchain by default)",
        "According to https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-windows",
        "Microsoft C++ Build Tools is needed and can be downloaded here: https://visualstudio.microsoft.com/visual-cpp-build-tools/",
        "When installing build tools, these two components should be selected:",
        "- MSVC - VS C++ x64/x86 build tools",
        "- Windows SDK"
    ],
    "architecture": {
        "64bit": {
            "url": "https://static.rust-lang.org/rustup/archive/1.26.0/x86_64-pc-windows-msvc/rustup-init.exe",
            "hash": "365d072ac4ef47f8774f4d2094108035e2291a0073702db25fa7797a30861fc9"
        },
        "32bit": {
            "url": "https://static.rust-lang.org/rustup/archive/1.26.0/i686-pc-windows-msvc/rustup-init.exe",
            "hash": "3fcfaf0018c12b96c49dc7e13e8638bd8de686ab27dd14238c3f11d0a936c003"
        }
    },
    "installer": {
        "script": [
            "[Environment]::SetEnvironmentVariable('CARGO_HOME', \"$persist_dir\\.cargo\", 'Process')",
            "[Environment]::SetEnvironmentVariable('RUSTUP_HOME', \"$persist_dir\\.rustup\", 'Process')",
            "Invoke-ExternalCommand -Path \"$dir\\rustup-init.exe\" -Args @('-y', '--no-modify-path') | Out-Null"
        ]
    },
    "env_add_path": ".cargo\\bin",
    "env_set": {
        "CARGO_HOME": "$persist_dir\\.cargo",
        "RUSTUP_HOME": "$persist_dir\\.rustup"
    },
    "persist": [
        ".cargo",
        ".rustup"
    ],
    "checkver": {
        "url": "https://raw.githubusercontent.com/rust-lang-nursery/rustup.rs/master/Cargo.toml",
        "regex": "version = \"([\\d.]+)\""
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://static.rust-lang.org/rustup/archive/$version/x86_64-pc-windows-msvc/rustup-init.exe"
            },
            "32bit": {
                "url": "https://static.rust-lang.org/rustup/archive/$version/i686-pc-windows-msvc/rustup-init.exe"
            }
        },
        "hash": {
            "url": "$url.sha256"
        }
    }
}
インストーラはレジストリのPath 環境変数を自動で設定していないので、PowerShell を再起動すると消える🤔\\ PowerShell を終了する前にレジストリのユーザー環境変数に Path を設定するには以下のコマンドを実行する😉\\
$ [Environment]::SetEnvironmentVariable('Path', $env:CARGO_HOME + '\bin;' + $env:Path, 'User')
**動作確認**\\
$ rustc --version
rustc 1.71.0 (8ede3aae2 2023-07-12)
$ cargo --version
cargo 1.71.0 (cfd3bbd8f 2023-06-08)
==== Android (Termux!) ==== [[git>rust-lang/rustup/issues/2872|Can not install on android - target 'aarch64-linux-android' not found in channel. · Issue #2872 · rust-lang/rustup]]🤔\\ [[git>TermuxArch/TermuxArch|TermuxArch/TermuxArch: Experience the pleasure of the Linux command prompt in Android, Chromebook, Fire OS and Windows on smartphone, smartTV, tablet and wearable https://termuxarch.github.io/TermuxArch/]] を参照🤔\\ TermuxArch で rustup を使用するとのことですが試せてません😅\\
Welcome to Termux!

Wiki:            https://wiki.termux.com
Community forum: https://termux.com/community
Gitter chat:     https://gitter.im/termux/termux
IRC channel:     #termux on freenode

Working with packages:

 * Search packages:   pkg search 
 * Install a package: pkg install 
 * Upgrade packages:  pkg upgrade

Subscribing to additional repositories:

 * Root:     pkg install root-repo
 * Unstable: pkg install unstable-repo
 * X11:      pkg install x11-repo

Report issues at https://termux.com/issues

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
error: $HOME differs from euid-obtained home directory: you may be using sudo
error: $HOME directory: /data/data/com.termux/files/home
error: euid-obtained home directory: /data
error: if this is what you want, restart the installation with `-y'

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /data/data/com.termux/files/home/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /data/data/com.termux/files/home/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /data/data/com.termux/files/home/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /data/data/com.termux/files/home/.profile
  /data/data/com.termux/files/home/.bashrc

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: aarch64-linux-android
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>

info: profile set to 'default'
info: default host triple is aarch64-linux-android
info: syncing channel updates for 'stable-aarch64-linux-android'
info: latest update on 2022-08-11, rust version 1.63.0 (4b91a6ea7 2022-08-08)
error: target 'aarch64-linux-android' not found in channel.  Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets
$
==== マイコン (microcomputer) ==== [[rust:rust_on_esp_install|ESP32 Rust 開発環境のインストール]]\\ [[rust:rust_on_rp_install|Raspberry Pi Pico 開発環境のインストール]]\\ ===== はるおわ〜るどする😆 ===== 参考: [[https://doc.rust-jp.rs/book-ja/ch01-02-hello-world.html|Hello, World! - The Rust Programming Language 日本語版]]\\
$ mkdir -p rs_projects/hello_world
$ cd rs_projects/hello_world
$ cat << EOF > main.rs
fn main() {
    // ようこそ、はるおわ〜るどへ!
    println!("Welcome to Haruo World!🤤");
}
EOF
$ rustc main.rs
$ ./main
Welcome to Haruo World!🤤
==== Cargo ではるおわ〜るどする😆 ==== 参考: [[https://doc.rust-jp.rs/book-ja/ch01-03-hello-cargo.html|Hello, Cargo! - The Rust Programming Language 日本語版]]\\ \\ Cargo のバージョンが表示されれば利用出来る状態になっていることが確認できる🤔\\
$ cargo --version
cargo 1.71.1 (7f1d04c00 2023-07-29)
Cargo でアプリ **haruo_cargo** パッケージを作成する🤔 (雛形が生成される)\\
$ cargo new haruo_cargo
     Created binary (application) `haruo_cargo` package
$ cd haruo_cargo/
$ ll
合計 4
-rw-r--r-- 1 tomoyan tomoyan 180 12月  6 09:00 Cargo.toml
drwxr-xr-x 1 tomoyan tomoyan  14 12月  6 09:00 src
$ cat Cargo.toml
[package]
name = "haruo_cargo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
$ cat src/main.rs
fn main() {
    println!("Hello, world!");
}
$ sed -i -e 's/Hello/Haruo/g' src/main.rs
$ cargo run
   Compiling haruo_cargo v0.1.0 (/home/dietpi/my_projects/haruo_cargo)
    Finished dev [unoptimized + debuginfo] target(s) in 7.36s
     Running `target/debug/haruo_cargo`
Haruo, world!
===== 言語構文 ===== [[rust/language_memo|Rust ランゲージ メモ]]\\ ===== Rust の更新 ===== 公式: [[https://doc.rust-lang.org/book/appendix-07-nightly-rust.html|G - How Rust is Made and “Nightly Rust” - The Rust Programming Language]] (英語)\\  [[https://doc.rust-jp.rs/book-ja/appendix-07-nightly-rust.html|付録G:Rustの作られ方と“Nightly Rust” - The Rust Programming Language 日本語版]] より\\ 6週間サイクルで新しいバージョンの Rust が準備されるので、リリース情報を確認して適時更新する😉\\ \\ 公式: [[https://forge.rust-lang.org/#current-release-versions|Current Release Versions - Rust Forge]] でリリースを確認できる🤔\\ \\ **rustup** の更新を行う🤔\\
$ rustup self update
info: checking for self-update
info: downloading self-update
  rustup updated - 1.27.1 (from 1.27.0)
  
$ rustup -V
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.77.2 (25ef9e3d8 2024-04-09)`
**rust** の更新を行う🤔\\
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
730.9 KiB / 730.9 KiB (100 %) 463.2 KiB/s in  1s ETA:  0s
info: latest update on 2024-05-02, rust version 1.78.0 (9b00956e5 2024-04-29)
info: downloading component 'rust-src'
  2.5 MiB /   2.5 MiB (100 %) 732.1 KiB/s in  4s ETA:  0s
info: downloading component 'cargo'
  8.0 MiB /   8.0 MiB (100 %) 662.4 KiB/s in 13s ETA:  0s
info: downloading component 'clippy'
  2.3 MiB /   2.3 MiB (100 %) 627.0 KiB/s in  3s ETA:  0s
info: downloading component 'rust-docs'
 15.1 MiB /  15.1 MiB (100 %) 483.2 KiB/s in 25s ETA:  0s
info: downloading component 'rust-std'
 24.3 MiB /  24.3 MiB (100 %) 522.4 KiB/s in 42s ETA:  0s     
info: downloading component 'rustc'
 63.7 MiB /  63.7 MiB (100 %) 256.0 KiB/s in  2m 37s ETA:  0s    
info: downloading component 'rustfmt'
  2.3 MiB /   2.3 MiB (100 %) 411.8 KiB/s in  6s ETA:  0s
info: removing previous version of component 'rust-src'
info: removing previous version of component 'cargo'
info: removing previous version of component 'clippy'
info: removing previous version of component 'rust-docs'
info: removing previous version of component 'rust-std'
info: removing previous version of component 'rustc'
info: removing previous version of component 'rustfmt'
info: installing component 'rust-src'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 15.1 MiB /  15.1 MiB (100 %)   4.4 MiB/s in  3s ETA:  0s
info: installing component 'rust-std'
 24.3 MiB /  24.3 MiB (100 %)   6.7 MiB/s in  3s ETA:  0s
info: installing component 'rustc'
 63.7 MiB /  63.7 MiB (100 %)   9.3 MiB/s in  7s ETA:  0s
info: installing component 'rustfmt'
info: checking for self-update

  stable-x86_64-unknown-linux-gnu updated - rustc 1.78.0 (9b00956e5 2024-04-29) (from rustc 1.65.0 (897e37553 2022-11-02))

info: cleaning up downloads & tmp directories
===== Cargo 拡張機能 ===== ==== cargo-cache ==== 公式: [[https://github.com/matthiaskrgr/cargo-cache|matthiaskrgr/cargo-cache: manage cargo cache (${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively]]\\
$ cargo cache
Cargo cache '/home/tomoyan/.cargo':

Total:                               4.33 GB
  55 installed binaries:           598.06 MB
  Registry:                          3.06 GB
    2 registry indices:              1.05 GB
    2350 crate archives:           327.96 MB
    2350 crate source checkouts:     1.68 GB
  Git db:                          674.12 MB
    8 bare git repos:              111.93 MB
    12 git repo checkouts:         562.19 MB
=== ヘルプ ===
$ cargo cache --help
cargo-cache 0.8.3
matthiaskrgr
Manage cargo cache

USAGE:
    cargo cache [OPTIONS] [SUBCOMMAND]

OPTIONS:
    -a, --autoclean                        Removes crate source checkouts and git repo checkouts
    -e, --autoclean-expensive              As --autoclean, but also recompresses git repositories
    -f, --fsck                             Fsck git repositories
    -g, --gc                               Recompress git repositories (may take some time)
    -h, --help                             Print help information
    -i, --info                             Print information cache directories, what they are for and what can
                                           be safely deleted
    -k, --keep-duplicate-crates <N>        Remove all but N versions of crate in the source archives directory
    -l, --list-dirs                        List all found directory paths
    -n, --dry-run                          Don't remove anything, just pretend
    -o, --remove-if-older-than <date>      Removes items older than specified date: YYYY.MM.DD or HH:MM:SS
    -r, --remove-dir <dir1,dir2,dir3>      Remove directories, accepted values: all,git-db,git-repos,
                                           registry-sources,registry-crate-cache,registry-index,registry
    -t, --top-cache-items <N>              List the top N items taking most space in the cache
    -V, --version                          Print version information
    -y, --remove-if-younger-than <date>    Removes items younger than the specified date: YYYY.MM.DD or
                                           HH:MM:SS

SUBCOMMANDS:
    clean-unref    remove crates that are not referenced in a Cargo.toml from the cache
    help           Print this message or the help of the given subcommand(s)
    l              check local build cache (target) of a rust project
    local          check local build cache (target) of a rust project
    q              run a query
    query          run a query
    r              query each package registry separately
    registry       query each package registry separately
    sc             gather stats on a local sccache cache
    sccache        gather stats on a local sccache cache
    toolchain      print stats on installed toolchains
    trim           trim old items from the cache until maximum cache size limit is reached
    verify         verify crate sources
=== インストール ===
$ cargo install cargo-cache
    Updating crates.io index
  Downloaded cargo-cache v0.8.3
  Downloaded 1 crate (243.9 KB) in 0.36s
  Installing cargo-cache v0.8.3
    Updating crates.io index
  Downloaded adler v1.0.2
  Downloaded bitflags v1.3.2
  Downloaded autocfg v1.3.0
  Downloaded camino v1.1.7
  Downloaded bitflags v2.5.0
  Downloaded atty v0.2.14
  Downloaded cfg-if v1.0.0
  Downloaded cargo-platform v0.1.8
  Downloaded rustc_tools_util v0.2.1
  Downloaded tinyvec_macros v0.1.1
  Downloaded clap_lex v0.2.4
  Downloaded dirs-next v2.0.0
  Downloaded cargo_metadata v0.15.4
  Downloaded filetime v0.2.23
  Downloaded dirs-sys-next v0.1.2
  Downloaded itoa v1.0.11
  Downloaded humansize v1.1.1
  Downloaded home v0.5.9
  Downloaded form_urlencoded v1.2.1
  Downloaded pkg-config v0.3.30
  Downloaded either v1.12.0
  Downloaded percent-encoding v2.3.1
  Downloaded errno v0.3.9
  Downloaded remove_dir_all v0.7.0
  Downloaded strsim v0.10.0
  Downloaded crossbeam-deque v0.8.5
  Downloaded termcolor v1.4.1
  Downloaded xattr v1.3.1
  Downloaded walkdir v2.5.0
  Downloaded thiserror-impl v1.0.61
  Downloaded terminal_size v0.2.6
  Downloaded crc32fast v1.4.2
  Downloaded io-lifetimes v1.0.11
  Downloaded same-file v1.0.6
  Downloaded jobserver v0.1.31
  Downloaded os_str_bytes v6.6.1
  Downloaded once_cell v1.19.0
  Downloaded semver v1.0.23
  Downloaded crossbeam-epoch v0.9.18
  Downloaded iana-time-zone v0.1.60
  Downloaded miniz_oxide v0.7.3
  Downloaded proc-macro2 v1.0.84
  Downloaded thiserror v1.0.61
  Downloaded serde_derive v1.0.203
  Downloaded ryu v1.0.18
  Downloaded tinyvec v1.6.0
  Downloaded unicode-ident v1.0.12
  Downloaded textwrap v0.16.1
  Downloaded crossbeam-utils v0.8.20
  Downloaded tar v0.4.40
  Downloaded aho-corasick v1.1.3
  Downloaded quote v1.0.36
  Downloaded rayon-core v1.12.1
  Downloaded num-traits v0.2.19
  Downloaded unicode-bidi v0.3.15
  Downloaded log v0.4.21
  Downloaded cc v1.0.98
  Downloaded flate2 v1.0.30
  Downloaded indexmap v1.9.3
  Downloaded serde v1.0.203
  Downloaded url v2.5.0
  Downloaded memchr v2.7.2
  Downloaded hashbrown v0.12.3
  Downloaded unicode-normalization v0.1.23
  Downloaded serde_json v1.0.117
  Downloaded rayon v1.10.0
  Downloaded git2 v0.14.4
  Downloaded clap v3.2.25
  Downloaded vcpkg v0.2.15
  Downloaded syn v2.0.66
  Downloaded idna v0.5.0
  Downloaded rustix v0.38.34
  Downloaded rustix v0.37.27
  Downloaded regex-automata v0.4.6
  Downloaded libz-sys v1.1.18
  Downloaded linux-raw-sys v0.3.8
  Downloaded libc v0.2.155
  Downloaded regex-syntax v0.8.3
  Downloaded regex v1.10.4
  Downloaded libgit2-sys v0.13.5+1.4.5
  Downloaded linux-raw-sys v0.4.14
  Downloaded chrono v0.4.38
  Downloaded 82 crates (12.1 MB) in 1.78s (largest was `linux-raw-sys` at 1.8 MB)
   Compiling libc v0.2.155
   Compiling proc-macro2 v1.0.84
   Compiling unicode-ident v1.0.12
   Compiling quote v1.0.36
   Compiling syn v2.0.66
   Compiling jobserver v0.1.31
   Compiling once_cell v1.19.0
   Compiling autocfg v1.3.0
   Compiling cc v1.0.98
   Compiling serde v1.0.203
   Compiling pkg-config v0.3.30
   Compiling serde_derive v1.0.203
   Compiling crossbeam-utils v0.8.20
   Compiling io-lifetimes v1.0.11
   Compiling vcpkg v0.2.15
   Compiling libz-sys v1.1.18
   Compiling cfg-if v1.0.0
   Compiling bitflags v1.3.2
   Compiling tinyvec_macros v0.1.1
   Compiling rustix v0.37.27
   Compiling tinyvec v1.6.0
   Compiling linux-raw-sys v0.3.8
   Compiling rustix v0.38.34
   Compiling crossbeam-epoch v0.9.18
   Compiling unicode-normalization v0.1.23
   Compiling libgit2-sys v0.13.5+1.4.5
   Compiling num-traits v0.2.19
   Compiling indexmap v1.9.3
   Compiling thiserror v1.0.61
   Compiling camino v1.1.7
   Compiling semver v1.0.23
   Compiling percent-encoding v2.3.1
   Compiling serde_json v1.0.117
   Compiling linux-raw-sys v0.4.14
   Compiling unicode-bidi v0.3.15
   Compiling memchr v2.7.2
   Compiling rayon-core v1.12.1
   Compiling bitflags v2.5.0
   Compiling aho-corasick v1.1.3
   Compiling idna v0.5.0
   Compiling form_urlencoded v1.2.1
   Compiling terminal_size v0.2.6
   Compiling crossbeam-deque v0.8.5
   Compiling thiserror-impl v1.0.61
   Compiling rustc_tools_util v0.2.1
   Compiling ryu v1.0.18
   Compiling hashbrown v0.12.3
   Compiling itoa v1.0.11
   Compiling regex-syntax v0.8.3
   Compiling os_str_bytes v6.6.1
   Compiling adler v1.0.2
   Compiling miniz_oxide v0.7.3
   Compiling clap_lex v0.2.4
   Compiling regex-automata v0.4.6
   Compiling cargo-cache v0.8.3
   Compiling textwrap v0.16.1
   Compiling url v2.5.0
   Compiling xattr v1.3.1
   Compiling cargo-platform v0.1.8
   Compiling crc32fast v1.4.2
   Compiling filetime v0.2.23
   Compiling dirs-sys-next v0.1.2
   Compiling atty v0.2.14
   Compiling same-file v1.0.6
   Compiling termcolor v1.4.1
   Compiling iana-time-zone v0.1.60
   Compiling log v0.4.21
   Compiling either v1.12.0
   Compiling strsim v0.10.0
   Compiling clap v3.2.25
   Compiling rayon v1.10.0
   Compiling chrono v0.4.38
   Compiling walkdir v2.5.0
   Compiling dirs-next v2.0.0
   Compiling tar v0.4.40
   Compiling flate2 v1.0.30
   Compiling cargo_metadata v0.15.4
   Compiling regex v1.10.4
   Compiling remove_dir_all v0.7.0
   Compiling home v0.5.9
   Compiling humansize v1.1.1
   Compiling git2 v0.14.4
    Finished `release` profile [optimized] target(s) in 8m 28s
  Installing /home/tomoyan/.cargo/bin/cargo-cache
   Installed package `cargo-cache v0.8.3` (executable `cargo-cache`)
===== ツールチェイン (toolchain) ===== 公式: [[https://rust-lang.github.io/rustup/concepts/toolchains.html|Toolchains - The rustup book]] [[gtr>https://rust-lang.github.io/rustup/concepts/toolchains.html|翻訳]]\\ Rust のツールチェーン仕様は
<channel>[-<date>][-<host>]

<channel>       = stable|beta|nightly|<major.minor>|<major.minor.patch>
<date>          = YYYY-MM-DD
<host>          = <target-triple>
例: stable-x86_64-unknown-linux-gnu\\ **channel:** //stable//\\ **date:** \\ **host:** //x86_64-unknown-linux-gnu (target-triple)//\\ esp32 マイコン用の esp ツールチェーンは [[rust:rust_on_esp_install#ツールチェーンのインストール|espup]] で追加する。\\ インストール済みのツールチェーン一覧の確認🤔\\
$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
esp
デフォルトのツールチェインを確認する🤔\\ **Fedora**\\
$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/tomoyan/.rustup

stable-x86_64-unknown-linux-gnu (default)
rustc 1.72.0 (5680fa18f 2023-08-23)
**DietPi**\\
$ rustup show
Default host: arm-unknown-linux-gnueabihf
rustup home:  /home/dietpi/.rustup

stable-arm-unknown-linux-gnueabihf (default)
rustc 1.72.0 (5680fa18f 2023-08-23)
==== バージョンを指定したツールチェーンの追加 ==== 公式: [[https://rust-lang.github.io/rustup/concepts/channels.html|Channels - The rustup book]] [[gtr>https://rust-lang.github.io/rustup/concepts/channels.html|翻訳]]\\
$ rustup toolchain install 1.67
info: syncing channel updates for '1.67-x86_64-unknown-linux-gnu'
info: latest update on 2023-02-09, rust version 1.67.1 (d5a82bbd2 2023-02-07)
info: downloading component 'cargo'
  6.6 MiB /   6.6 MiB (100 %)   2.7 MiB/s in  2s ETA:  0s
info: downloading component 'clippy'
info: downloading component 'rust-docs'
 19.3 MiB /  19.3 MiB (100 %)   3.8 MiB/s in  5s ETA:  0s
info: downloading component 'rust-std'
 29.3 MiB /  29.3 MiB (100 %) 522.0 KiB/s in 15s ETA:  0s
info: downloading component 'rustc'
 67.8 MiB /  67.8 MiB (100 %)   4.5 MiB/s in 18s ETA:  0s
info: downloading component 'rustfmt'
  4.5 MiB /   4.5 MiB (100 %)   4.1 MiB/s in  1s ETA:  0s
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 19.3 MiB /  19.3 MiB (100 %)   5.0 MiB/s in  3s ETA:  0s
info: installing component 'rust-std'
 29.3 MiB /  29.3 MiB (100 %)   6.9 MiB/s in  4s ETA:  0s
info: installing component 'rustc'
 67.8 MiB /  67.8 MiB (100 %)   6.3 MiB/s in 16s ETA:  0s
  4 IO-ops /   4 IO-ops (100 %)   0 IOPS in  8s ETA: Unknown
info: installing component 'rustfmt'

  1.67-x86_64-unknown-linux-gnu installed - rustc 1.67.1 (d5a82bbd2 2023-02-07)

info: checking for self-update
追加されたツールチェーンのコンパイラバージョンを確認する🤔\\
$ rustup run 1.67 rustc -V
rustc 1.67.1 (d5a82bbd2 2023-02-07)
追加されたツールチェーンをデフォルトに設定する🤔\\
$ rustup default 1.67
info: using existing install for '1.67-x86_64-unknown-linux-gnu'
info: default toolchain set to '1.67-x86_64-unknown-linux-gnu'

  1.67-x86_64-unknown-linux-gnu unchanged - rustc 1.67.1 (d5a82bbd2 2023-02-07)
ツールチェーン一覧でもデフォルトを確認できる🤔\\
$ rustup toolchain list
stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
1.67-x86_64-unknown-linux-gnu (default)
esp
デフォルトツールチェーンのコンパイラバージョンを確認する🤔\\
$ rustc -V --verbose
rustc 1.76.0-nightly (87e1447aa 2023-11-30)
binary: rustc
commit-hash: 87e1447aadaa2899ff6ccabe1fa669eb50fb60a1
commit-date: 2023-11-30
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5
==== ツールチェーンの削除 ====
$ rustup toolchain uninstall 1.67
info: uninstalling toolchain '1.67-x86_64-unknown-linux-gnu'
info: toolchain '1.67-x86_64-unknown-linux-gnu' uninstalled
$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
esp
==== ディレクトリ毎のツールチェーンのオーバーライド ==== 公式: [[https://rust-lang.github.io/rustup/overrides.html#directory-overrides|Directory overrides - Overrides - The rustup book]] [[gtr>https://rust-lang.github.io/rustup/overrides.html#directory-overrides|翻訳]]\\
$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
esp
$ cd esp32-nostd-ssd1306
$ rustup override set esp
info: override toolchain for '/home/tomoyan/my_projects/esp32-nostd-ssd1306' set to 'esp'
$ rustup toolchain list  
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
esp (override)
$ cd ..
$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
esp
$ cd esp32-nostd-ssd1306
$ rustup toolchain list 
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
esp (override)
オーバーライドの解除\\
$ rustup override unset
info: override toolchain for '/home/tomoyan/my_projects/esp32-nostd-ssd1306' removed
==== クロスビルド可能なターゲットの一覧表示 ==== ※ターゲットトリプル: {arch}-{vendor}-{sys}-{abi}\\  {abi} を除く {arch}-{vendor}-{sys} のこと🤔\\ **Fedora**\\
$ rustup target list | grep installed
x86_64-unknown-linux-gnu (installed)
$ rustup target list
aarch64-apple-darwin
aarch64-apple-ios
aarch64-apple-ios-sim
aarch64-fuchsia
aarch64-linux-android
aarch64-pc-windows-msvc
aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
aarch64-unknown-none
aarch64-unknown-none-softfloat
arm-linux-androideabi
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armebv7r-none-eabi
armebv7r-none-eabihf
armv5te-unknown-linux-gnueabi
armv5te-unknown-linux-musleabi
armv7-linux-androideabi
armv7-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
armv7a-none-eabi
armv7r-none-eabi
armv7r-none-eabihf
asmjs-unknown-emscripten
i586-pc-windows-msvc
i586-unknown-linux-gnu
i586-unknown-linux-musl
i686-linux-android
i686-pc-windows-gnu
i686-pc-windows-msvc
i686-unknown-freebsd
i686-unknown-linux-gnu
i686-unknown-linux-musl
mips-unknown-linux-gnu
mips-unknown-linux-musl
mips64-unknown-linux-gnuabi64
mips64-unknown-linux-muslabi64
mips64el-unknown-linux-gnuabi64
mips64el-unknown-linux-muslabi64
mipsel-unknown-linux-gnu
mipsel-unknown-linux-musl
nvptx64-nvidia-cuda
powerpc-unknown-linux-gnu
powerpc64-unknown-linux-gnu
powerpc64le-unknown-linux-gnu
riscv32i-unknown-none-elf
riscv32imac-unknown-none-elf
riscv32imc-unknown-none-elf
riscv64gc-unknown-linux-gnu
riscv64gc-unknown-none-elf
riscv64imac-unknown-none-elf
s390x-unknown-linux-gnu
sparc64-unknown-linux-gnu
sparcv9-sun-solaris
thumbv6m-none-eabi
thumbv7em-none-eabi
thumbv7em-none-eabihf
thumbv7m-none-eabi
thumbv7neon-linux-androideabi
thumbv7neon-unknown-linux-gnueabihf
thumbv8m.base-none-eabi
thumbv8m.main-none-eabi
thumbv8m.main-none-eabihf
wasm32-unknown-emscripten
wasm32-unknown-unknown
wasm32-wasi
x86_64-apple-darwin
x86_64-apple-ios
x86_64-fortanix-unknown-sgx
x86_64-fuchsia
x86_64-linux-android
x86_64-pc-solaris
x86_64-pc-windows-gnu
x86_64-pc-windows-msvc
x86_64-sun-solaris
x86_64-unknown-freebsd
x86_64-unknown-illumos
x86_64-unknown-linux-gnu (installed)
x86_64-unknown-linux-gnux32
x86_64-unknown-linux-musl
x86_64-unknown-netbsd
x86_64-unknown-none
x86_64-unknown-redox
**DietPi**\\
$ rustup target list | grep installed
arm-unknown-linux-gnueabihf (installed)
$ rustup target list
aarch64-apple-darwin
aarch64-apple-ios
aarch64-apple-ios-sim
aarch64-fuchsia
aarch64-linux-android
aarch64-pc-windows-msvc
aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
aarch64-unknown-none
aarch64-unknown-none-softfloat
arm-linux-androideabi
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf (installed)
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armebv7r-none-eabi
armebv7r-none-eabihf
armv5te-unknown-linux-gnueabi
armv5te-unknown-linux-musleabi
armv7-linux-androideabi
armv7-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
armv7a-none-eabi
armv7r-none-eabi
armv7r-none-eabihf
asmjs-unknown-emscripten
i586-pc-windows-msvc
i586-unknown-linux-gnu
i586-unknown-linux-musl
i686-linux-android
i686-pc-windows-gnu
i686-pc-windows-msvc
i686-unknown-freebsd
i686-unknown-linux-gnu
i686-unknown-linux-musl
mips-unknown-linux-gnu
mips-unknown-linux-musl
mips64-unknown-linux-gnuabi64
mips64-unknown-linux-muslabi64
mips64el-unknown-linux-gnuabi64
mips64el-unknown-linux-muslabi64
mipsel-unknown-linux-gnu
mipsel-unknown-linux-musl
nvptx64-nvidia-cuda
powerpc-unknown-linux-gnu
powerpc64-unknown-linux-gnu
powerpc64le-unknown-linux-gnu
riscv32i-unknown-none-elf
riscv32imac-unknown-none-elf
riscv32imc-unknown-none-elf
riscv64gc-unknown-linux-gnu
riscv64gc-unknown-none-elf
riscv64imac-unknown-none-elf
s390x-unknown-linux-gnu
sparc64-unknown-linux-gnu
sparcv9-sun-solaris
thumbv6m-none-eabi
thumbv7em-none-eabi
thumbv7em-none-eabihf
thumbv7m-none-eabi
thumbv7neon-linux-androideabi
thumbv7neon-unknown-linux-gnueabihf
thumbv8m.base-none-eabi
thumbv8m.main-none-eabi
thumbv8m.main-none-eabihf
wasm32-unknown-emscripten
wasm32-unknown-unknown
wasm32-wasi
x86_64-apple-darwin
x86_64-apple-ios
x86_64-fortanix-unknown-sgx
x86_64-fuchsia
x86_64-linux-android
x86_64-pc-solaris
x86_64-pc-windows-gnu
x86_64-pc-windows-msvc
x86_64-sun-solaris
x86_64-unknown-freebsd
x86_64-unknown-illumos
x86_64-unknown-linux-gnu
x86_64-unknown-linux-gnux32
x86_64-unknown-linux-musl
x86_64-unknown-netbsd
x86_64-unknown-redox
==== cross のインストール ==== 公式: [[git>cross-rs/cross|cross-rs/cross: “Zero setup” cross compilation and “cross testing” of Rust crates]] [[gtr>https://github.com/cross-rs/cross|翻訳]]\\
$ cargo install cross --git https://github.com/cross-rs/cross
    Updating git repository `https://github.com/cross-rs/cross`
    Updating git submodule `https://github.com/cross-rs/cross-toolchains.git`
  Installing cross v0.2.5 (https://github.com/cross-rs/cross#6d097fb5)
    Updating crates.io index
  Downloaded is-terminal v0.4.12
  Downloaded signal-hook-registry v1.4.2
  Downloaded winnow v0.5.40
  Downloaded 3 crates (184.8 KB) in 0.56s
   Compiling proc-macro2 v1.0.81
   Compiling unicode-ident v1.0.12
   Compiling libc v0.2.153
   Compiling serde v1.0.199
   Compiling cfg-if v1.0.0
   Compiling rustix v0.38.34
   Compiling cc v1.0.95
   Compiling utf8parse v0.2.1
   Compiling anstyle-parse v0.2.3
   Compiling linux-raw-sys v0.4.13
   Compiling quote v1.0.36
   Compiling hashbrown v0.14.3
   Compiling syn v2.0.60
   Compiling atty v0.2.14
   Compiling backtrace v0.3.71
   Compiling eyre v0.6.12
   Compiling is_ci v1.2.0
   Compiling semver v1.0.22
   Compiling bitflags v2.5.0
   Compiling anstyle v1.0.6
   Compiling equivalent v1.0.1
   Compiling anstyle-query v1.0.2
   Compiling gimli v0.28.1
   Compiling adler v1.0.2
   Compiling colorchoice v1.0.0
   Compiling memchr v2.7.2
   Compiling miniz_oxide v0.7.2
   Compiling object v0.32.2
   Compiling anstream v0.6.13
   Compiling indexmap v2.2.6
   Compiling addr2line v0.21.0
   Compiling supports-color v1.3.1
   Compiling signal-hook v0.3.17
   Compiling serde_json v1.0.116
   Compiling rustc-demangle v0.1.23
   Compiling serde_derive v1.0.199
   Compiling heck v0.5.0
   Compiling indenter v0.3.3
   Compiling winnow v0.5.40
   Compiling once_cell v1.19.0
   Compiling clap_lex v0.7.0
   Compiling strsim v0.11.1
   Compiling thiserror v1.0.59
   Compiling clap_builder v4.5.2
   Compiling clap_derive v4.5.4
   Compiling thiserror-impl v1.0.59
   Compiling owo-colors v3.5.0
   Compiling signal-hook-registry v1.4.2
   Compiling dirs-sys v0.3.7
   Compiling home v0.5.9
   Compiling bitflags v1.3.2
   Compiling cross v0.2.5 (/home/tomoyan/.cargo/git/checkouts/cross-dac8861107f29545/6d097fb)
   Compiling either v1.11.0
   Compiling ryu v1.0.17
   Compiling itoa v1.0.11
   Compiling fastrand v2.1.0
   Compiling which v4.4.2
   Compiling toml_datetime v0.6.5
   Compiling serde_spanned v0.6.5
   Compiling tempfile v3.10.1
   Compiling toml_edit v0.19.15
   Compiling serde_ignored v0.1.10
   Compiling nix v0.26.4
   Compiling directories v4.0.1
   Compiling color-eyre v0.6.3
   Compiling rustc_version v0.4.0
   Compiling toml v0.7.8
   Compiling clap v4.5.4
   Compiling is-terminal v0.4.12
   Compiling shell-words v1.1.0
   Compiling const-sha1 v0.2.0
   Compiling shell-escape v0.1.5
    Finished release [optimized] target(s) in 2m 09s
   Replacing /home/tomoyan/.cargo/bin/cross
   Replacing /home/tomoyan/.cargo/bin/cross-util
    Replaced package `cross v0.2.5` with `cross v0.2.5 (https://github.com/cross-rs/cross#6d097fb5)` (executables `cross`, `cross-util`)
==== インストール ==== 公式: [[https://rust-lang.github.io/rustup/cross-compilation.html|Cross-compilation - The rustup book]]\\ クロスビルド可能なターゲットの一覧に存在するものは、ターゲットを追加するだけで済みます😊\\
$ rustup target add arm-unknown-linux-gnueabihf
info: downloading component 'rust-std' for 'arm-unknown-linux-gnueabihf'
info: installing component 'rust-std' for 'arm-unknown-linux-gnueabihf'
 22.5 MiB /  22.5 MiB (100 %)   8.1 MiB/s in  2s ETA:  0s
$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/tomoyan/.rustup

installed targets for active toolchain
--------------------------------------

arm-unknown-linux-gnueabihf
x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.72.0 (5680fa18f 2023-08-23)
==== アンインストール ====
$ rustup target remove thumbv7em-none-eabihf
info: removing component 'rust-std' for 'thumbv7em-none-eabihf'
$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/tomoyan/.rustup

stable-x86_64-unknown-linux-gnu (default)
rustc 1.65.0 (897e37553 2022-11-02)

===== Rust のアンインストール =====
$ rustup self uninstall

Thanks for hacking in Rust!

This will uninstall all Rust toolchains and data, and remove
$HOME/.cargo/bin from your PATH environment variable.

Continue? (y/N) y -> y を入力して Enter

info: removing rustup home
info: removing cargo home
info: removing rustup binaries
info: rustup is uninstalled
===== クレート ===== ^ ドキュメント\\ リポジトリ ^ クレート追加\\ サンプル (examples) ^ 説明 ^ | [[https://docs.rs/clap|clap - Rust]]\\ [[git>clap-rs/clap|clap]] |
$ cargo add clap -F derive
$ git clone --depth 1 https://github.com/clap-rs/clap.git
| Command Line Argument Parser for Rust | | [[https://docs.rs/walkdir|walkdir - Rust]]\\ [[git>BurntSushi/walkdir|walkdir]] |
$ cargo add walkdir
$ git clone --depth 1 https://github.com/BurntSushi/walkdir.git
| Rust library for walking directories recursively. | | [[https://docs.rs/dotenv|dotenv - Rust]]\\ [[git>dotenv-rs/dotenv|rust-dotenv]] |
$ cargo add dotenv
$ git clone --depth 1 https://github.com/dotenv-rs/dotenv.git
| It loads environment variables from a .env file. | | [[https://docs.rs/colored|colored - Rust]]\\ [[git>mackwic/colored|Colored]] |
$ cargo add colored
$ git clone --depth 1 https://github.com/colored-rs/colored.git
| colored: (Rust) Coloring terminal so simple you already know how to do it !. | | [[https://docs.rs/diesel|diesel - Rust]]\\ [[git>diesel-rs/diesel|diesel ORM]] |
$ cargo add diesel
$ git clone --depth 1 https://github.com/diesel-rs/diesel.git
| diesel: A safe, extensible ORM and Query Builder for Rust. | | [[https://docs.rs/env_logger|env_logger - Rust]]\\ [[git>rust-cli/env_logger|env_logger]] |
$ cargo add env_logger
$ git clone --depth 1 https://github.com/rust-cli/env_logger.git
| rust-cli/env_logger: A logging implementation for `log` which is configured via an environment variable. | | [[https://docs.rs/exif|exif - Rust]]\\ [[glb>dcuddeback/exif|exif]] |
$ cargo add exif
$ git clone --depth 1 https://gitlab.com/dcuddeback/exif.git
| Rust wrapper for libexif. | | [[https://docs.rs/numfmt|numfmt - Rust]]\\ [[git>kurtlawrence/numfmt|numfmt]] |
$ cargo add numfmt
$ git clone --depth 1 https://github.com/kurtlawrence/numfmt.git
| kurtlawrence/numfmt: Fast and friendly Rust number formatting | | [[https://docs.rs/pathdiff|pathdiff - Rust]]\\ [[git>Manishearth/pathdiff|pathdiff]] |
$ cargo add pathdiff
$ git clone --depth 1 https://github.com/Manishearth/pathdiff.git
| Manishearth/pathdiff | | [[https://docs.rs/spinners|spinners - Rust]]\\ [[git>fgribreau/spinners|spinners]] |
$ cargo add spinners
$ git clone --depth 1 https://github.com/FGRibreau/spinners.git
| FGRibreau/spinners: 🛎 60+ Elegant terminal spinners for Rust | | [[https://docs.rs/substring|substring - Rust]]\\ [[git>Anders429/substring|substring]] |
$ cargo add substring
$ git clone --depth 1 https://github.com/Anders429/substring.git
| Anders429/substring: A substring method for string types. | | [[https://docs.rs/termion|termion - Rust]]\\ [[glbc>redox-os.org/redox-os/termion|termion]] |
$ cargo add termion
$ git clone --depth 1 https://gitlab.redox-os.org/redox-os/termion.git
| A bindless library for controlling terminals/TTY. | | [[https://docs.rs/axum|axum - Rust]]\\ [[git>tokio-rs/axum|axum]] |
$ cargo add axum
$ git clone --depth 1 https://github.com/tokio-rs/axum.git
| tokio-rs/axum: Ergonomic and modular web framework built with Tokio, Tower, and Hyper | | [[https://docs.rs/tera|tera - Rust]]\\ [[git>Keats/tera|tera]] |
$ cargo add tera
$ git clone --depth 1 https://github.com/Keats/tera.git
| Keats/tera: A template engine for Rust based on Jinja2/Django | | [[https://docs.rs/yew|yew - Rust]]\\ [[git>yewstack/yew|yew]] |
$ cargo add yew
$ git clone --depth 1 https://github.com/yewstack/yew.git
| yewstack/yew: Rust / Wasm framework for creating reliable and efficient web applications. | | [[https://docs.rs/lazy_static|lazy_static - Rust]]\\ [[git>rust-lang-nursery/lazy-static.rs|lazy_static]] |
$ cargo add lazy_static
$ git clone --depth 1 https://github.com/rust-lang-nursery/lazy-static.rs.git
| rust-lang-nursery/lazy-static.rs: A small macro for defining lazy evaluated static variables in Rust. | | [[https://docs.rs/tokio|tokio - Rust]]\\ [[git>tokio-rs/tokio|tokio]] |
$ cargo add tokio
$ git clone --depth 1 https://github.com/ratatui-org/ratatui.git
| tokio-rs/tokio: A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ... | | [[https://docs.rs/ratatui|ratatui - Rust]]\\ [[git>ratatui-org/ratatui|ratatui]] |
$ cargo add ratatui
$ git clone --depth 1 https://github.com/ratatui-org/ratatui.git
| ratatui-org/ratatui: Rust library that's all about cooking up terminal user interfaces (TUIs) 👨‍🍳🐀 | | [[https://docs.rs/crossterm|crossterm - Rust]]\\ [[git>crossterm-rs/crossterm|crossterm]] |
$ cargo add crossterm
$ git clone --depth 1 https://github.com/crossterm-rs/crossterm.git
| crossterm-rs/crossterm: Cross platform terminal library rust |
===== OS ===== [[git>Centaurus99/arceos-lwip|Centaurus99/arceos-lwip: An experimental modular OS written in Rust.]]\\ Rust で書かれた実験的なモジュール式オペレーティング システム (またはユニカーネル)。\\ ArceOS は Unikraft から多くの影響を受けています。\\ 🚧 作業中。\\ ==== Filesystem ==== [[git>elliott10/lwext4_rust|lwext4 in Rust - elliott10/lwext4_rust]]\\ [[git>gkostka/lwext4|lwext4]] は、マイクロコントローラー用の C 言語の ext2/ext3/ext4 ファイルシステム ライブラリで lwext4 in Rust は Rust インターフェースを提供するために、lwext4 を Rust 言語で抽象化している。\\ ===== レシピ ===== ==== sccache - Shared Compilation Cache ==== ソースコード: [[git>mozilla/sccache|mozilla/sccache: sccache is ccache with cloud storage]]\\ $ TMPDIR=/var/tmp cargo install sccache
    Updating crates.io index
  Downloaded sccache v0.3.0
  Downloaded 1 crate (272.5 KB) in 0.70s
  Installing sccache v0.3.0
  Downloaded async-trait v0.1.56
  Downloaded crypto-common v0.1.3
  Downloaded ar v0.9.0
  Downloaded digest v0.10.3
  Downloaded bincode v1.3.3
  Downloaded base64 v0.13.0
  Downloaded directories v4.0.1
  Downloaded zstd-safe v3.0.1+zstd.1.4.9
  Downloaded try-lock v0.2.3
  Downloaded hyper v0.14.19
  Downloaded unix_socket v0.5.0
  Downloaded xattr v0.2.3
  Downloaded daemonize v0.4.1
  Downloaded boxfnonce v0.1.1
  Downloaded md5 v0.3.8
  Downloaded language-tags v0.3.2
  Downloaded thiserror-impl v1.0.31
  Downloaded hyperx v1.4.0
  Downloaded openssl-sys v0.9.74
  Downloaded pulldown-cmark v0.0.3
  Downloaded mio v0.8.3
  Downloaded pin-project v1.0.10
  Downloaded openssl-macros v0.1.0
  Downloaded native-tls v0.2.10
  Downloaded bufstream v0.1.4
  Downloaded mime v0.3.16
  Downloaded openssl v0.10.40
  Downloaded getopts v0.2.21
  Downloaded blake3 v0.3.8
  Downloaded retry v1.3.1
  Downloaded redis v0.21.5
  Downloaded spin v0.5.2
  Downloaded tokio-native-tls v0.3.0
  Downloaded vte_generate_state_changes v0.1.1
  Downloaded tokio-serde v0.8.0
  Downloaded skeptic v0.4.0
  Downloaded constant_time_eq v0.1.5
  Downloaded futures-locks v0.7.0
  Downloaded dtoa v0.4.8
  Downloaded hmac v0.12.1
  Downloaded conhash v0.4.0
  Downloaded tokio-util v0.6.10
  Downloaded tower v0.4.12
  Downloaded untrusted v0.7.1
  Downloaded tower-layer v0.3.1
  Downloaded toml v0.5.9
  Downloaded tokio-util v0.7.3
  Downloaded memcached-rs v0.4.2
  Downloaded ipnet v2.5.0
  Downloaded httparse v1.7.1
  Downloaded http v0.2.8
  Downloaded aho-corasick v0.7.18
  Downloaded zstd-sys v1.4.20+zstd.1.4.9
  Downloaded tar v0.4.38
  Downloaded futures-macro v0.3.21
  Downloaded futures-sink v0.3.21
  Downloaded pin-utils v0.1.0
  Downloaded itoa v0.4.8
  Downloaded humantime v2.1.0
  Downloaded semver-parser v0.7.0
  Downloaded rand_chacha v0.2.2
  Downloaded rand_chacha v0.3.1
  Downloaded signal-hook-registry v1.4.0
  Downloaded rand_core v0.6.3
  Downloaded futures-task v0.3.21
  Downloaded foreign-types-shared v0.1.1
  Downloaded want v0.3.0
  Downloaded hyper-tls v0.5.0
  Downloaded slab v0.4.6
  Downloaded strip-ansi-escapes v0.1.1
  Downloaded sha-1 v0.10.0
  Downloaded semver v0.9.0
  Downloaded openssl-probe v0.1.5
  Downloaded tokio-macros v1.8.0
  Downloaded socket2 v0.4.4
  Downloaded flate2 v1.0.24
  Downloaded futures-channel v0.3.21
  Downloaded rand v0.8.5
  Downloaded futures-util v0.3.21
  Downloaded rand v0.7.3
  Downloaded zip v0.5.13
  Downloaded serde_urlencoded v0.7.1
  Downloaded pin-project-internal v1.0.10
  Downloaded rand v0.4.6
  Downloaded bytes v1.1.0
  Downloaded tower-service v0.3.1
  Downloaded thiserror v1.0.31
  Downloaded reqwest v0.11.11
  Downloaded termcolor v1.1.3
  Downloaded httpdate v1.0.2
  Downloaded crc32fast v1.3.2
  Downloaded block-buffer v0.10.2
  Downloaded linked-hash-map v0.5.4
  Downloaded sha2 v0.10.2
  Downloaded jobserver v0.1.24
  Downloaded arrayvec v0.5.2
  Downloaded foreign-types v0.3.2
  Downloaded byteorder v1.4.3
  Downloaded futures-io v0.3.21
  Downloaded futures v0.3.21
  Downloaded rand_core v0.5.1
  Downloaded cfg-if v0.1.10
  Downloaded ppv-lite86 v0.2.16
  Downloaded getrandom v0.1.16
  Downloaded http-body v0.4.5
  Downloaded futures-core v0.3.21
  Downloaded futures-executor v0.3.21
  Downloaded fnv v1.0.7
  Downloaded env_logger v0.9.0
  Downloaded md-5 v0.10.1
  Downloaded counted-array v0.1.2
  Downloaded combine v4.6.4
  Downloaded zstd v0.6.1+zstd.1.4.9
  Downloaded vte v0.10.1
  Downloaded local-encoding v0.2.0
  Downloaded crypto-mac v0.8.0
  Downloaded number_prefix v0.4.0
  Downloaded h2 v0.3.13
  Downloaded arrayref v0.3.6
  Downloaded tempdir v0.3.7
  Downloaded tokio v1.19.2
  Downloaded encoding_rs v0.8.31
  Downloaded ring v0.16.20
  Downloaded 123 crates (13.1 MB) in 3.04s (largest was `ring` at 5.1 MB)
  Downloaded parity-tokio-ipc v0.9.0
  Downloaded 1 crate (15.9 KB) in 0.36s
  Downloaded winapi v0.3.9
  Downloaded 1 crate (1.2 MB) in 0.37s
   Compiling libc v0.2.126
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.39
   Compiling unicode-ident v1.0.1
   Compiling syn v1.0.96
   Compiling autocfg v1.1.0
   Compiling log v0.4.17
   Compiling memchr v2.5.0
   Compiling once_cell v1.12.0
   Compiling version_check v0.9.4
   Compiling pin-project-lite v0.2.9
   Compiling futures-core v0.3.21
   Compiling bytes v1.1.0
   Compiling futures-sink v0.3.21
   Compiling typenum v1.15.0
   Compiling futures-channel v0.3.21
   Compiling futures-task v0.3.21
   Compiling pkg-config v0.3.25
   Compiling futures-util v0.3.21
   Compiling itoa v1.0.2
   Compiling pin-utils v0.1.0
   Compiling futures-io v0.3.21
   Compiling slab v0.4.6
   Compiling openssl v0.10.40
   Compiling serde v1.0.137
   Compiling bitflags v1.3.2
   Compiling fnv v1.0.7
   Compiling foreign-types-shared v0.1.1
   Compiling subtle v2.4.1
   Compiling getrandom v0.1.16
   Compiling percent-encoding v2.1.0
   Compiling matches v0.1.9
   Compiling ppv-lite86 v0.2.16
   Compiling native-tls v0.2.10
   Compiling tinyvec_macros v0.1.0
   Compiling unicode-width v0.1.9
   Compiling remove_dir_all v0.5.3
   Compiling httparse v1.7.1
   Compiling openssl-probe v0.1.5
   Compiling hashbrown v0.11.2
   Compiling tower-service v0.3.1
   Compiling unicode-bidi v0.3.8
   Compiling httpdate v1.0.2
   Compiling try-lock v0.2.3
   Compiling crc32fast v1.3.2
   Compiling arrayvec v0.5.2
   Compiling encoding_rs v0.8.31
   Compiling zstd-safe v3.0.1+zstd.1.4.9
   Compiling ryu v1.0.10
   Compiling serde_json v1.0.81
   Compiling cfg-if v0.1.10
   Compiling async-trait v0.1.56
   Compiling byteorder v1.4.3
   Compiling utf8parse v0.2.0
   Compiling adler v1.0.2
   Compiling semver-parser v0.7.0
   Compiling cpufeatures v0.2.2
   Compiling anyhow v1.0.57
   Compiling mime v0.3.16
   Compiling regex-syntax v0.6.26
   Compiling hyperx v1.4.0
   Compiling serde_derive v1.0.137
   Compiling md5 v0.3.8
   Compiling base64 v0.13.0
   Compiling ipnet v2.5.0
   Compiling termcolor v1.1.3
   Compiling same-file v1.0.6
   Compiling untrusted v0.7.1
   Compiling boxfnonce v0.1.1
   Compiling lazy_static v1.4.0
   Compiling constant_time_eq v0.1.5
   Compiling tower-layer v0.3.1
   Compiling fastrand v1.7.0
   Compiling itoa v0.4.8
   Compiling bufstream v0.1.4
   Compiling strsim v0.8.0
   Compiling ansi_term v0.12.1
   Compiling arrayref v0.3.6
   Compiling either v1.6.1
   Compiling dtoa v0.4.8
   Compiling humantime v2.1.0
   Compiling vec_map v0.8.2
   Compiling spin v0.5.2
   Compiling language-tags v0.3.2
   Compiling linked-hash-map v0.5.4
   Compiling counted-array v0.1.2
   Compiling number_prefix v0.4.0
   Compiling ar v0.9.0
   Compiling indexmap v1.8.2
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling tracing-core v0.1.27
   Compiling generic-array v0.14.5
   Compiling unicase v2.6.0
   Compiling http v0.2.8
   Compiling foreign-types v0.3.2
   Compiling form_urlencoded v1.0.1
   Compiling tinyvec v1.6.0
   Compiling getopts v0.2.21
   Compiling textwrap v0.11.0
   Compiling miniz_oxide v0.5.3
   Compiling semver v0.9.0
   Compiling walkdir v2.3.2
   Compiling http-body v0.4.5
   Compiling unicode-normalization v0.1.19
   Compiling pulldown-cmark v0.0.3
   Compiling quote v1.0.18
   Compiling num_cpus v1.13.1
   Compiling signal-hook-registry v1.4.0
   Compiling socket2 v0.4.4
   Compiling getrandom v0.2.7
   Compiling atty v0.2.14
   Compiling time v0.1.44
   Compiling unix_socket v0.5.0
   Compiling dirs-sys v0.3.7
   Compiling xattr v0.2.3
   Compiling filetime v0.2.16
   Compiling tempfile v3.3.0
   Compiling jobserver v0.1.24
   Compiling daemonize v0.4.1
   Compiling which v4.2.5
   Compiling rand v0.4.6
   Compiling mio v0.8.3
   Compiling tracing v0.1.35
   Compiling want v0.3.0
   Compiling conhash v0.4.0
   Compiling aho-corasick v0.7.18
   Compiling idna v0.2.3
   Compiling serde_urlencoded v0.7.1
   Compiling bincode v1.3.3
   Compiling toml v0.5.9
   Compiling flate2 v1.0.24
   Compiling vte_generate_state_changes v0.1.1
   Compiling rand_core v0.6.3
   Compiling uuid v0.8.2
   Compiling rand_core v0.5.1
   Compiling clap v2.34.0
   Compiling directories v4.0.1
   Compiling tar v0.4.38
   Compiling cc v1.0.73
   Compiling tempdir v0.3.7
   Compiling tower v0.4.12
   Compiling regex v1.5.6
   Compiling crypto-common v0.1.3
   Compiling block-buffer v0.10.2
   Compiling digest v0.9.0
   Compiling crypto-mac v0.8.0
   Compiling url v2.2.2
   Compiling vte v0.10.1
   Compiling rand_chacha v0.3.1
   Compiling rand_chacha v0.2.2
   Compiling tokio-macros v1.8.0
   Compiling futures-macro v0.3.21
   Compiling openssl-macros v0.1.0
   Compiling thiserror-impl v1.0.31
   Compiling pin-project-internal v1.0.10
   Compiling openssl-sys v0.9.74
   Compiling zstd-sys v1.4.20+zstd.1.4.9
   Compiling blake3 v0.3.8
   Compiling ring v0.16.20
   Compiling skeptic v0.4.0
   Compiling chrono v0.4.19
   Compiling env_logger v0.9.0
   Compiling digest v0.10.3
   Compiling strip-ansi-escapes v0.1.1
   Compiling rand v0.8.5
   Compiling rand v0.7.3
   Compiling tokio v1.19.2
   Compiling thiserror v1.0.31
   Compiling pin-project v1.0.10
   Compiling local-encoding v0.2.0
   Compiling md-5 v0.10.1
   Compiling hmac v0.12.1
   Compiling sha-1 v0.10.0
   Compiling sha2 v0.10.2
   Compiling retry v1.3.1
   Compiling memcached-rs v0.4.2
   Compiling futures-executor v0.3.21
   Compiling tokio-util v0.7.3
   Compiling tokio-util v0.6.10
   Compiling futures-locks v0.7.0
   Compiling zip v0.5.13
   Compiling tokio-serde v0.8.0
   Compiling futures v0.3.21
   Compiling h2 v0.3.13
   Compiling combine v4.6.4
   Compiling hyper v0.14.19
   Compiling tokio-native-tls v0.3.0
   Compiling hyper-tls v0.5.0
   Compiling redis v0.21.5
   Compiling reqwest v0.11.11
   Compiling zstd v0.6.1+zstd.1.4.9
   Compiling sccache v0.3.0
    Finished release [optimized] target(s) in 5m 56s
  Installing /home/tomoyan/.cargo/bin/sccache
   Installed package `sccache v0.3.0` (executable `sccache`)
**動作確認**\\ $ sccache -h
sccache 0.3.0

USAGE:
    sccache [FLAGS] [OPTIONS] [cmd]...

FLAGS:
        --dist-auth       authenticate for distributed compilation
        --dist-status     show status of the distributed client
    -h, --help            Prints help information
    -s, --show-stats      show cache statistics
        --start-server    start background server
        --stop-server     stop background server
    -V, --version         Prints version information
    -z, --zero-stats      zero statistics counters

OPTIONS:
        --package-toolchain      package toolchain for distributed compilation
        --stats-format 
            set output format of statistics [default: text]  [possible values: text, json]


ARGS:
    ...

Enabled features:
    S3:        true
    Redis:     true
    Memcached: true
    GCS:       true
    Azure:     true

Rust の Cargo から sccache を利用するには **RUSTC_WRAPPER** 環境変数を設定する😉\\ $ echo 'export RUSTC_WRAPPER=$(which sccache)' >> .bashrc $ . .bashrc $ echo $RUSTC_WRAPPER
/home/tomoyan/.cargo/bin/sccache
または、\\ $ echo 'export RUSTC_WRAPPER=$(which sccache)' >> .profile $ . .profile $ echo $RUSTC_WRAPPER
/home/dietpi/.cargo/bin/sccache
sccache の統計情報を表示する🤔\\ $ sccache -s
Compile requests                      0
Compile requests executed             0
Cache hits                            0
Cache misses                          0
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average cache read miss           0.000 s
Average cache read hit            0.000 s
Failed distributed compilations       0
Cache location                  Local disk: "/home/tomoyan/.cache/sccache"
==== Evcxr ==== [[git>google/evcxr|google/evcxr - Contribute to google/evcxr development by creating an account on GitHub.]]\\ [[python:jupyterlab:jupyterlab_and_rust#evcxr|Evcxr - JupyterLab + Rust 開発環境の構築]] を参照...🤤\\ ==== Rust Language Server ==== [[https://rust-analyzer.github.io/|rust-analyzer]]\\ [[https://rust-analyzer.github.io/manual.html|User Manual - rust-analyzer]] [[gtr>https://rust-analyzer.github.io/manual.html|翻訳]]\\ [[git>rust-lang/rust-analyzer|rust-lang/rust-analyzer: A Rust compiler front-end for IDEs]]\\ [[https://langserver.org/|Langserver.org]]\\ ==== Application Frameworks ==== [[https://trends.google.com/trends/explore?cat=31&date=2017-01-01%202024-10-20&q=Actix%20Web,Axum%20Rust,Rocket%20Rust,Gotham%20Rust,Tide%20Rust&hl=ja|Actix Web, Axum Rust, Rocket Rust, Gotham Rust, Tide Rust - 調べる - Google トレンド]]\\ 参考: [[https://www.shuttle.rs/blog/2023/08/23/rust-web-framework-comparison|Best Rust Web Frameworks to Use in 2023]] [[gtr>https://www.shuttle.rs/blog/2023/08/23/rust-web-framework-comparison|翻訳]]\\   [[https://fettblog.eu/slides/microservices-with-rust-and-tokio/|Microservices with Rust and Tokio | Slides + Coverage]]\\ 以下は 2024/05/16 現在 [[https://www.shuttle.rs/|Shuttle - Build Backends Fast]] のテンプレートで選択できるフレームワークの一覧...🤔\\ | [[https://actix.rs/|Actix]] | 強力で高速な Web フレームワーク | | [[https://docs.rs/axum/|axum - Rust]] | Tokio エコシステムのモジュラー Web フレームワーク | | [[https://bevyengine.org/|Bevy Engine]] | WASM にコンパイルされるデータ駆動型ゲーム エンジン | | [[https://loco.rs/|Loco | Loco]] | バッテリー付属の Axum に基づく Web フレームワーク | | [[https://docs.rs/poem/|poem - Rust]] | フル機能を備えた使いやすい Web フレームワーク | | [[https://docs.rs/poise/|poise - Rust]] | 優れたスラッシュコマンドサポートを備えた Discord Bot フレームワーク | | [[https://rocket.rs/|Rocket - Simple, Fast, Type-Safe Web Framework for Rust]] | シンプルで使いやすいWebフレームワーク | | [[https://salvo.rs/|Home | Salvo]] | フル機能を備えた使いやすい Web フレームワーク | | [[https://docs.rs/serenity/|serenity - Rust]] | Discordボットフレームワーク | | [[https://docs.rs/thruster/|thruster - Rust]] | Web フレームワーク | | [[https://docs.rs/tide/|tide - Rust]] | Web フレームワーク | | [[https://docs.rs/tower/|tower - Rust]] | モジュラーサービスライブラリ | | [[https://docs.rs/warp/|warp - Rust]] | Web フレームワーク | [[git>tokio-rs/axum/blob/main/ECOSYSTEM.md|axum/ECOSYSTEM.md at main · tokio-rs/axum]]\\ === テンプレートエンジン === [[https://keats.github.io/tera/|Tera - Inspired by Jinja2 and Django templates]]\\ [[https://docs.rs/handlebars/|handlebars-rust]]\\ [[https://docs.rs/minijinja/|MiniJinja]]\\ === Wasm Web アプリケーション フレームワーク === Rust / Wasm クライアント Web アプリケーション フレームワーク\\ [[https://yew.rs/|Yew]]\\ === 非同期ランタイム === [[https://tokio.rs/|Tokio - An asynchronous Rust runtime]]\\ Rust 用の WebAssembly (WASM) Web アプリケーション バンドラー\\ [[https://trunkrs.dev/|Trunk | Build, bundle & ship your Rust WASM application to the web]]\\ === TUI ライブラリ === ratatui: ターミナル ユーザー インターフェイス (TUI) を作成するための Rust ライブラリ 👨‍🍳🐀\\ [[https://ratatui.rs/|Ratatui | Ratatui]]\\ [[git>ratatui-org/ratatui|ratatui-org/ratatui: Rust library that's all about cooking up terminal user interfaces (TUIs) 👨‍🍳🐀]]\\ === GUI ライブラリ === Rust 用のエレガントな GUI ライブラリ\\ デスクトップ、Web、モバイルなどで実行されるアプリを構築するための Rust ライブラリ\\ [[https://dioxuslabs.com/|Dioxus | An elegant GUI library for Rust]]\\ [[.rust:axum|Axum]]\\ ==== ORM - Object Relational Mapper ==== 参考: [[https://www.shuttle.rs/blog/2024/01/16/best-orm-rust|A Guide to Rust ORMs in 2024]] [[gtr>https://www.shuttle.rs/blog/2024/01/16/best-orm-rust|翻訳]]\\ === SeaORM === 公式: [[https://www.sea-ql.org/SeaORM/|SeaORM 🐚 An async & dynamic ORM for Rust]]\\ ソースコード: [[git>SeaQL/sea-orm|SeaQL/sea-orm: 🐚 An async & dynamic ORM for Rust]]\\ === Diesel === 公式: [[https://diesel.rs/|Diesel is a Safe, Extensible ORM and Query Builder for Rust]]\\ ソースコード: [[git>diesel-rs/diesel|diesel-rs/diesel: A safe, extensible ORM and Query Builder for Rust]]\\ [[.rust:diesel|Diesel]]\\ ==== Web ベースの Rust シミュレーター ==== [[rust:wokwi|Wokwi]]\\ ==== uutils - ユビキタスなコマンド ライン ユーティリティの Rust でのクロスプラットフォーム再実装 ==== 公式: [[https://uutils.github.io/|uutils]]\\    [[https://github.com/uutils/coreutils|uutils/coreutils: Cross-platform Rust rewrite of the GNU coreutils]]\\ === インストール ===
$ cargo install coreutils
    Updating crates.io index
  Downloaded coreutils v0.0.25
  Downloaded 1 crate (1.5 MB) in 1.82s
  Installing coreutils v0.0.25
    Updating crates.io index
  Downloaded anstream v0.6.13
  Downloaded arrayref v0.3.7
  Downloaded anstyle v1.0.6
  Downloaded uu_df v0.0.25
  Downloaded bitflags v2.5.0
  Downloaded uu_echo v0.0.25
  Downloaded binary-heap-plus v0.5.0
  Downloaded uu_env v0.0.25
  Downloaded bigdecimal v0.4.3
  Downloaded console v0.15.8
  Downloaded anstyle-query v1.0.2
  Downloaded anstyle-parse v0.2.3
  Downloaded uu_expand v0.0.25
  Downloaded clap_complete v4.5.1
  Downloaded crossbeam-utils v0.8.19
  Downloaded uu_expr v0.0.25
  Downloaded uu_fmt v0.0.25
  Downloaded uu_false v0.0.25
  Downloaded uu_factor v0.0.25
  Downloaded chrono v0.4.35
  Downloaded uu_fold v0.0.25
  Downloaded cpufeatures v0.2.12
  Downloaded uu_pr v0.0.25
  Downloaded uu_join v0.0.25
  Downloaded uu_rm v0.0.25
  Downloaded uu_hashsum v0.0.25
  Downloaded uu_readlink v0.0.25
  Downloaded uu_od v0.0.25
  Downloaded uu_shuf v0.0.25
  Downloaded uu_head v0.0.25
  Downloaded uu_tail v0.0.25
  Downloaded uu_printenv v0.0.25
  Downloaded uu_seq v0.0.25
  Downloaded uu_ptx v0.0.25
  Downloaded uu_mv v0.0.25
  Downloaded uu_mktemp v0.0.25
  Downloaded uu_paste v0.0.25
  Downloaded uu_tac v0.0.25
  Downloaded uu_mkdir v0.0.25
  Downloaded uu_true v0.0.25
  Downloaded uu_nl v0.0.25
  Downloaded uu_printf v0.0.25
  Downloaded uu_rmdir v0.0.25
  Downloaded uu_ls v0.0.25
  Downloaded uu_test v0.0.25
  Downloaded uu_sum v0.0.25
  Downloaded uu_ln v0.0.25
  Downloaded uu_pwd v0.0.25
  Downloaded fastrand v2.0.2
  Downloaded uu_split v0.0.25
  Downloaded uu_tr v0.0.25
  Downloaded uu_tee v0.0.25
  Downloaded uu_link v0.0.25
  Downloaded uu_shred v0.0.25
  Downloaded uu_tsort v0.0.25
  Downloaded uu_sleep v0.0.25
  Downloaded uu_realpath v0.0.25
  Downloaded uu_touch v0.0.25
  Downloaded uu_yes v0.0.25
  Downloaded xattr v1.3.1
  Downloaded clap_mangen v0.2.20
  Downloaded uutils_term_grid v0.3.0
  Downloaded uu_unexpand v0.0.25
  Downloaded uu_truncate v0.0.25
  Downloaded uu_sort v0.0.25
  Downloaded uu_more v0.0.25
  Downloaded uu_numfmt v0.0.25
  Downloaded uu_dirname v0.0.25
  Downloaded uu_uniq v0.0.25
  Downloaded uucore v0.0.25
  Downloaded uu_wc v0.0.25
  Downloaded wild v2.2.1
  Downloaded uu_dircolors v0.0.25
  Downloaded uu_unlink v0.0.25
  Downloaded walkdir v2.5.0
  Downloaded uu_du v0.0.25
  Downloaded z85 v3.0.5
  Downloaded uu_vdir v0.0.25
  Downloaded uuhelp_parser v0.0.25
  Downloaded uucore_procs v0.0.25
  Downloaded const-random v0.1.18
  Downloaded cfg_aliases v0.1.1
  Downloaded data-encoding-macro-internal v0.1.12
  Downloaded data-encoding-macro v0.1.14
  Downloaded uu_base64 v0.0.25
  Downloaded uu_basename v0.0.25
  Downloaded match_cfg v0.1.0
  Downloaded uu_comm v0.0.25
  Downloaded uu_dir v0.0.25
  Downloaded uu_basenc v0.0.25
  Downloaded compare v0.1.0
  Downloaded constant_time_eq v0.3.0
  Downloaded clap_lex v0.7.0
  Downloaded hostname v0.3.1
  Downloaded uu_base32 v0.0.25
  Downloaded ctrlc v3.4.4
  Downloaded filetime v0.2.23
  Downloaded keccak v0.1.5
  Downloaded dlv-list v0.5.2
  Downloaded data-encoding v2.5.0
  Downloaded either v1.10.0
  Downloaded terminal_size v0.2.6
  Downloaded strsim v0.11.0
  Downloaded uu_date v0.0.25
  Downloaded self_cell v1.0.3
  Downloaded crossbeam-deque v0.8.5
  Downloaded uu_cut v0.0.25
  Downloaded phf_codegen v0.11.2
  Downloaded num-integer v0.1.46
  Downloaded phf_generator v0.11.2
  Downloaded uu_csplit v0.0.25
  Downloaded siphasher v0.3.11
  Downloaded lscolors v0.16.0
  Downloaded uu_cat v0.0.25
  Downloaded thiserror v1.0.58
  Downloaded pkg-config v0.3.30
  Downloaded phf_shared v0.11.2
  Downloaded md-5 v0.10.6
  Downloaded uu_cksum v0.0.25
  Downloaded phf v0.11.2
  Downloaded thiserror-impl v1.0.58
  Downloaded ordered-multimap v0.6.0
  Downloaded quick-error v2.0.1
  Downloaded os_display v0.1.3
  Downloaded getrandom v0.2.12
  Downloaded fs_extra v1.3.0
  Downloaded bytecount v0.6.7
  Downloaded blake2b_simd v1.0.2
  Downloaded iana-time-zone v0.1.60
  Downloaded rust-ini v0.19.0
  Downloaded roff v0.2.1
  Downloaded onig v6.4.0
  Downloaded uu_dd v0.0.25
  Downloaded nu-ansi-term v0.49.0
  Downloaded memmap2 v0.9.4
  Downloaded sm3 v0.4.2
  Downloaded uu_cp v0.0.25
  Downloaded clap v4.5.3
  Downloaded tempfile v3.10.1
  Downloaded num-traits v0.2.18
  Downloaded log v0.4.21
  Downloaded half v2.4.0
  Downloaded crossbeam-epoch v0.9.18
  Downloaded parse_datetime v0.5.0
  Downloaded notify v6.0.1
  Downloaded fundu-core v0.3.0
  Downloaded textwrap v0.16.1
  Downloaded rayon-core v1.12.1
  Downloaded indicatif v0.17.8
  Downloaded cc v1.0.90
  Downloaded fundu v2.0.0
  Downloaded crossbeam-channel v0.5.12
  Downloaded num-bigint v0.4.4
  Downloaded unicode-segmentation v1.11.0
  Downloaded mio v0.8.11
  Downloaded hashbrown v0.13.2
  Downloaded itertools v0.12.1
  Downloaded clap_builder v4.5.2
  Downloaded linux-raw-sys v0.4.13
  Downloaded rayon v1.10.0
  Downloaded blake3 v1.5.1
  Downloaded nix v0.28.0
  Downloaded rustix v0.37.27
  Downloaded rustix v0.38.32
  Downloaded onig_sys v69.8.1
  Downloaded sha3 v0.10.8
  Downloaded 166 crates (8.3 MB) in 5.35s (largest was `linux-raw-sys` at 1.5 MB)
   Compiling libc v0.2.153
   Compiling cfg-if v1.0.0
   Compiling bitflags v2.5.0
   Compiling version_check v0.9.4
   Compiling typenum v1.17.0
   Compiling proc-macro2 v1.0.79
   Compiling generic-array v0.14.7
   Compiling rustix v0.38.32
   Compiling unicode-ident v1.0.12
   Compiling linux-raw-sys v0.4.13
   Compiling quote v1.0.35
   Compiling cc v1.0.90
   Compiling utf8parse v0.2.1
   Compiling memchr v2.7.1
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling anstyle-parse v0.2.3
   Compiling anstyle v1.0.6
   Compiling colorchoice v1.0.0
   Compiling anstyle-query v1.0.2
   Compiling unicode-width v0.1.11
   Compiling anstream v0.6.13
   Compiling clap_lex v0.7.0
   Compiling cfg_aliases v0.1.1
   Compiling syn v1.0.109
   Compiling strsim v0.11.0
   Compiling nix v0.28.0
   Compiling terminal_size v0.3.0
   Compiling clap_builder v4.5.2
   Compiling blake3 v1.5.1
   Compiling syn v2.0.55
   Compiling constant_time_eq v0.3.0
   Compiling arrayref v0.3.7
   Compiling same-file v1.0.6
   Compiling thiserror v1.0.58
   Compiling cpufeatures v0.2.12
   Compiling either v1.10.0
   Compiling data-encoding v2.5.0
   Compiling arrayvec v0.7.4
   Compiling walkdir v2.5.0
   Compiling data-encoding-macro-internal v0.1.12
   Compiling clap v4.5.3
   Compiling uuhelp_parser v0.0.25
   Compiling thiserror-impl v1.0.58
   Compiling keccak v0.1.5
   Compiling once_cell v1.19.0
   Compiling sha3 v0.10.8
   Compiling data-encoding-macro v0.1.14
   Compiling uucore_procs v0.0.25
   Compiling blake2b_simd v1.0.2
   Compiling itertools v0.12.1
   Compiling sha1 v0.10.6
   Compiling sha2 v0.10.8
   Compiling xattr v1.3.1
   Compiling os_display v0.1.3
   Compiling md-5 v0.10.6
   Compiling sm3 v0.4.2
   Compiling z85 v3.0.5
   Compiling dunce v1.0.4
   Compiling hex v0.4.3
   Compiling glob v0.3.1
   Compiling wild v2.2.1
   Compiling autocfg v1.1.0
   Compiling uucore v0.0.25
   Compiling aho-corasick v1.1.3
   Compiling num-traits v0.2.18
   Compiling regex-syntax v0.8.2
   Compiling crossbeam-utils v0.8.19
   Compiling crunchy v0.2.2
   Compiling iana-time-zone v0.1.60
   Compiling chrono v0.4.35
   Compiling regex-automata v0.4.6
   Compiling getrandom v0.2.12
   Compiling bitflags v1.3.2
   Compiling tiny-keccak v2.0.2
   Compiling rand_core v0.6.4
   Compiling ppv-lite86 v0.2.17
   Compiling rand_chacha v0.3.1
   Compiling log v0.4.21
   Compiling signal-hook v0.3.17
   Compiling number_prefix v0.4.0
   Compiling const-random-macro v0.1.16
   Compiling rand v0.8.5
   Compiling mio v0.8.11
   Compiling lock_api v0.4.11
   Compiling num-bigint v0.4.4
   Compiling signal-hook-registry v1.4.1
   Compiling siphasher v0.3.11
   Compiling parking_lot_core v0.9.9
   Compiling pkg-config v0.3.30
   Compiling portable-atomic v1.6.0
   Compiling regex v1.10.4
   Compiling io-lifetimes v1.0.11
   Compiling smallvec v1.13.2
   Compiling onig_sys v69.8.1
   Compiling phf_shared v0.11.2
   Compiling const-random v0.1.18
   Compiling crossbeam-epoch v0.9.18
   Compiling num-integer v0.1.46
   Compiling filetime v0.2.23
   Compiling rayon-core v1.12.1
   Compiling libm v0.2.8
   Compiling rustix v0.37.27
   Compiling match_cfg v0.1.0
   Compiling scopeguard v1.2.0
   Compiling nu-ansi-term v0.49.0
   Compiling lazy_static v1.4.0
   Compiling console v0.15.8
   Compiling lscolors v0.16.0
   Compiling hostname v0.3.1
   Compiling crossbeam-deque v0.8.5
   Compiling dlv-list v0.5.2
   Compiling phf_generator v0.11.2
   Compiling bigdecimal v0.4.3
   Compiling uutils_term_grid v0.3.0
   Compiling inotify-sys v0.1.5
   Compiling fundu-core v0.3.0
   Compiling fastrand v2.0.2
   Compiling linux-raw-sys v0.3.8
   Compiling hashbrown v0.13.2
   Compiling ordered-multimap v0.6.0
   Compiling fundu v2.0.0
   Compiling tempfile v3.10.1
   Compiling inotify v0.9.6
   Compiling uu_ls v0.0.25
   Compiling indicatif v0.17.8
   Compiling uu_factor v0.0.25
   Compiling parking_lot v0.12.1
   Compiling phf_codegen v0.11.2
   Compiling signal-hook-mio v0.2.3
   Compiling parse_datetime v0.5.0
   Compiling crossbeam-channel v0.5.12
   Compiling uu_base32 v0.0.25
   Compiling quick-error v2.0.1
   Compiling compare v0.1.0
   Compiling minimal-lexical v0.2.1
   Compiling binary-heap-plus v0.5.0
   Compiling notify v6.0.1
   Compiling crossterm v0.27.0
   Compiling nom v7.1.3
   Compiling rayon v1.10.0
   Compiling coreutils v0.0.25
   Compiling terminal_size v0.2.6
   Compiling rust-ini v0.19.0
   Compiling onig v6.4.0
   Compiling bstr v1.9.1
   Compiling ctrlc v3.4.4
   Compiling memmap2 v0.9.4
   Compiling half v2.4.0
   Compiling roff v0.2.1
   Compiling smawk v0.3.2
   Compiling fs_extra v1.3.0
   Compiling unicode-linebreak v0.1.5
   Compiling fnv v1.0.7
   Compiling self_cell v1.0.3
   Compiling gcd v2.3.0
   Compiling unicode-segmentation v1.11.0
   Compiling bytecount v0.6.7
   Compiling byteorder v1.5.0
   Compiling uu_dd v0.0.25
   Compiling uu_wc v0.0.25
   Compiling uu_od v0.0.25
   Compiling uu_more v0.0.25
   Compiling uu_sort v0.0.25
   Compiling uu_mv v0.0.25
   Compiling textwrap v0.16.1
   Compiling uu_cut v0.0.25
   Compiling clap_mangen v0.2.20
   Compiling uu_tac v0.0.25
   Compiling uu_expr v0.0.25
   Compiling uu_env v0.0.25
   Compiling uu_seq v0.0.25
   Compiling uu_tr v0.0.25
   Compiling uu_tail v0.0.25
   Compiling phf v0.11.2
   Compiling uu_cp v0.0.25
   Compiling uu_pr v0.0.25
   Compiling uu_basenc v0.0.25
   Compiling uu_base64 v0.0.25
   Compiling uu_touch v0.0.25
   Compiling uu_date v0.0.25
   Compiling uu_dir v0.0.25
   Compiling uu_vdir v0.0.25
   Compiling uu_mktemp v0.0.25
   Compiling uu_sleep v0.0.25
   Compiling uu_ptx v0.0.25
   Compiling uu_csplit v0.0.25
   Compiling uu_hashsum v0.0.25
   Compiling uu_nl v0.0.25
   Compiling uu_shuf v0.0.25
   Compiling uu_shred v0.0.25
   Compiling uu_du v0.0.25
   Compiling uu_readlink v0.0.25
   Compiling uu_link v0.0.25
   Compiling uu_split v0.0.25
   Compiling uu_rmdir v0.0.25
   Compiling uu_printf v0.0.25
   Compiling uu_rm v0.0.25
   Compiling uu_yes v0.0.25
   Compiling uu_uniq v0.0.25
   Compiling uu_dirname v0.0.25
   Compiling uu_realpath v0.0.25
   Compiling uu_df v0.0.25
   Compiling uu_join v0.0.25
   Compiling uu_dircolors v0.0.25
   Compiling uu_sum v0.0.25
   Compiling uu_paste v0.0.25
   Compiling uu_tsort v0.0.25
   Compiling uu_numfmt v0.0.25
   Compiling uu_true v0.0.25
   Compiling uu_expand v0.0.25
   Compiling uu_unexpand v0.0.25
   Compiling uu_mkdir v0.0.25
   Compiling uu_false v0.0.25
   Compiling uu_cat v0.0.25
   Compiling uu_pwd v0.0.25
   Compiling uu_unlink v0.0.25
   Compiling uu_basename v0.0.25
   Compiling uu_printenv v0.0.25
   Compiling uu_tee v0.0.25
   Compiling uu_cksum v0.0.25
   Compiling uu_test v0.0.25
   Compiling uu_fold v0.0.25
   Compiling uu_ln v0.0.25
   Compiling uu_head v0.0.25
   Compiling uu_comm v0.0.25
   Compiling uu_echo v0.0.25
   Compiling uu_fmt v0.0.25
   Compiling uu_truncate v0.0.25
   Compiling clap_complete v4.5.1
    Finished release [optimized] target(s) in 5m 36s
  Installing /home/tomoyan/.cargo/bin/coreutils
   Installed package `coreutils v0.0.25` (executable `coreutils`)
=== 使い方 ===
$ coreutils du --help
Estimate file space usage

Usage: coreutils du [OPTION]... [FILE]...
       coreutils du [OPTION]... --files0-from=F

Options:
      --help                 Print help information.
  -a, --all                  write counts for all files, not just directories
      --apparent-size        print apparent sizes, rather than disk usage although the apparent size is
                             usually smaller, it may be larger due to holes in ('sparse') files, internal
                             fragmentation, indirect blocks, and the like
  -B, --block-size <SIZE>    scale sizes by SIZE before printing them. E.g., '-BM' prints sizes in units of
                             1,048,576 bytes. See SIZE format below.
  -b, --bytes                equivalent to '--apparent-size --block-size=1'
  -c, --total                produce a grand total
  -d, --max-depth <N>        print the total for a directory (or file, with --all) only if it is N or fewer
                             levels below the command line argument;  --max-depth=0 is the same as --summarize
  -h, --human-readable       print sizes in human readable format (e.g., 1K 234M 2G)
      --inodes               list inode usage information instead of block usage like --block-size=1K
  -k                         like --block-size=1K
  -l, --count-links          count sizes many times if hard linked
  -L, --dereference          follow all symbolic links
  -D, --dereference-args     follow only symlinks that are listed on the command line [short aliases: H]
  -P, --no-dereference       don't follow any symbolic links (this is the default)
  -m                         like --block-size=1M
  -0, --null                 end each output line with 0 byte rather than newline
  -S, --separate-dirs        do not include size of subdirectories
  -s, --summarize            display only a total for each argument
      --si                   like -h, but use powers of 1000 not 1024
  -x, --one-file-system      skip directories on different file systems
  -t, --threshold <SIZE>     exclude entries smaller than SIZE if positive, or entries greater than SIZE if
                             negative
  -v, --verbose              verbose mode (option not present in GNU/Coreutils)
      --exclude <PATTERN>    exclude files that match PATTERN
  -X, --exclude-from <FILE>  exclude files that match any pattern in FILE
      --files0-from <FILE>   summarize device usage of the NUL-terminated file names specified in file F; if F
                             is -, then read names from standard input
      --time[=<WORD>...]     show time of the last modification of any file in the directory, or any of its
                             subdirectories. If WORD is given, show time as WORD instead of modification time:
                             atime, access, use, ctime, status, birth or creation [possible values: atime,
                             access, use, ctime, status, birth, creation]
      --time-style <STYLE>   show times using style STYLE: full-iso, long-iso, iso, +FORMAT FORMAT is
                             interpreted like 'date'
  -V, --version              Print version

Display values are in units of the first available SIZE from --block-size,
and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE is an integer and optional unit (example: 10M is 10*1024*1024).
Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers
of 1000).

PATTERN allows some advanced exclusions. For example, the following syntaxes
are supported:
? will match only one character
* will match zero or more characters
{a,b} will match a or b
===== 実装方法に迷ったら... ===== [[https://www.oreilly.com/library/view/command-line-rust/9781098109424/|Command-Line Rust [Book]]]\\ [[git>kyclark/command-line-rust|kyclark/command-line-rust: Code for Command-Line Rust (O'Reilly, 2022, ISBN 9781098109417)]]\\ [[https://www.oreilly.com/library/view/programming-rust/9781491927274/|Programming Rust [Book]]]\\ [[git>ProgrammingRust|Programming Rust]]\\ [[https://www.manning.com/books/rust-in-action|Rust in Action]]\\ [[git>rust-in-action/code|rust-in-action/code: Source code for the book Rust in Action]]\\ ===== トラブルシューティング ===== ==== [sccache] error: failed to run custom build command for `openssl-sys v0.9.75` でビルドがエラー終了する ==== $ cargo install sccache
    Updating crates.io index
  Downloaded sccache v0.3.0
  Downloaded 1 crate (272.5 KB) in 1.17s
  Installing sccache v0.3.0
  Downloaded bitflags v1.3.2
  ...
   Compiling rand v0.8.5
   Compiling rand v0.7.3
error: failed to run custom build command for `openssl-sys v0.9.75`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installCiIUHG/release/build/openssl-sys-7bf1e8bf5be1b2d6/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENSSL_STATIC
  cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  run pkg_config fail: "`\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"` did not exit successfully: exit status: 1\nerror: could not find system library 'openssl' required by the 'openssl-sys' crate\n\n--- stderr\nPackage openssl was not found in the pkg-config search path.\nPerhaps you should add the directory containing `openssl.pc'\nto the PKG_CONFIG_PATH environment variable\nPackage 'openssl', required by 'virtual:world', not found\n"

  --- stderr
  thread 'main' panicked at '

  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
  compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.

  $HOST = x86_64-unknown-linux-gnu
  $TARGET = x86_64-unknown-linux-gnu
  openssl-sys = 0.9.75

  ', /home/tomoyan/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.75/build/find_normal.rs:191:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `sccache v0.3.0`, intermediate artifacts can be found at `/tmp/cargo-installCiIUHG`
Ubuntu では libssl-dev を、Fedora では openssl-devel をインストールしてから再実行する🤔\\ $ sudo dnf install openssl-devel
Fedora 36 - x86_64 - Updates                                                  5.8 kB/s | 5.5 kB     00:00    
Fedora 36 - x86_64 - Updates                                                  273 kB/s | 515 kB     00:01    
Fedora Modular 36 - x86_64 - Updates                                          6.7 kB/s | 4.8 kB     00:00    
依存関係が解決しました。
==============================================================================================================
 パッケージ                  アーキテクチャー     バージョン                      リポジトリー          サイズ
==============================================================================================================
インストール:
 openssl-devel               x86_64               1:3.0.5-1.fc36                  updates               3.0 M

トランザクションの概要
==============================================================================================================
インストール  1 パッケージ

ダウンロードサイズの合計: 3.0 M
インストール後のサイズ: 4.6 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
openssl-devel-3.0.5-1.fc36.x86_64.rpm                                         2.3 MB/s | 3.0 MB     00:01    
--------------------------------------------------------------------------------------------------------------
合計                                                                          1.5 MB/s | 3.0 MB     00:02     
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                                                      1/1 
  インストール中   : openssl-devel-1:3.0.5-1.fc36.x86_64                                                  1/1 
  scriptletの実行中: openssl-devel-1:3.0.5-1.fc36.x86_64                                                  1/1 
  検証             : openssl-devel-1:3.0.5-1.fc36.x86_64                                                  1/1 

インストール済み:
  openssl-devel-1:3.0.5-1.fc36.x86_64                                                                         

完了しました!
==== [sccache] No space left on device (os error 28) でビルドがエラー終了する ==== $ cargo install sccache
    Updating crates.io index
  Downloaded sccache v0.3.0
  Downloaded 1 crate (272.5 KB) in 2.44s
  Installing sccache v0.3.0
  Downloaded async-trait v0.1.56
  ...
   Compiling local-encoding v0.2.0
   Compiling tokio v1.19.2
error: failed to write /tmp/cargo-installcx83Fu/release/deps/rmetaqzpZIF/lib.rmeta: No space left on device (os error 28)
error: could not compile `tokio` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `sccache v0.3.0`, intermediate artifacts can be found at `/tmp/cargo-installcx83Fu`
**/tmp** が溢れている😱\\ $ df -BM
Filesystem     1M-blocks   Used Available Use% Mounted on
/dev/root        118989M 13156M   101048M  12% /
devtmpfs            183M     0M      183M   0% /dev
tmpfs               215M     0M      215M   0% /dev/shm
tmpfs                86M     9M       78M  10% /run
tmpfs                 5M     1M        5M   1% /run/lock
tmpfs               428M   426M        3M 100% /tmp
tmpfs                50M     1M       50M   1% /var/log
/dev/mmcblk0p1      127M    51M       76M  41% /boot
tmpfs                43M     1M       43M   1% /run/user/0
tmpfs                43M     1M       43M   1% /run/user/106
tmpfs                43M     1M       43M   1% /run/user/1000
**tmp** を掃除する😊\\ $ rm -rf /tmp/cargo-* $ rm -rf /var/tmp/cargo-* 一時作業ディレクトリを **/var/tmp** にしてビルドを再実行する😊\\ $ TMPDIR=/var/tmp cargo install sccache
   Updating crates.io index
 Installing sccache v0.3.0
   Compiling libc v0.2.126
  ...
===== Rust のアンインストール =====
$ rustup self uninstall


Thanks for hacking in Rust!

This will uninstall all Rust toolchains and data, and remove
$HOME/.cargo/bin from your PATH environment variable.

Continue? (y/N) y -> y を入力して Enter

info: removing rustup home
info: removing cargo home
info: removing rustup binaries
info: rustup is uninstalled
===== 参考文献 ===== [[https://blog.mtb-production.info/entry/2020/11/19/021415|Rustをインストールして、Hello Worldしただけの話 - matobaの備忘録]]\\ [[https://zenn.dev/suauiya/books/ef2d2c67c546361e4518/viewer/4bc94a19cf74da37bf8f|インストール後にrustupを使ってすること|WindowsでRustの開発環境を構築する(not on WSL)/おまけのみ有料]]\\ [[https://zenn.dev/esaka/scraps/e9baa5851f6109|Rustでreplやjupyter-notebook使う]]\\ [[https://zenn.dev/kt3k/articles/d557cc874961ab|Rust プロジェクトの GitHub Actions で incremental build をするためのテクニック]]\\ [[https://qiita.com/manontroppo1974/items/a6bcef67285c10edff77|Ubuntu上でRaspberry Pi Zero向けクロスコンパイル事始め - Qiita]]\\ [[https://wiki.archlinux.jp/index.php/Rust|Rust - ArchWiki]]\\ [[https://esp-rs.github.io/book/|Introduction - The Rust on ESP Book]]\\ [[md>codex/rust-101-everything-you-need-to-know-about-rust-f3dd0ae99f4c|Rust 101 — Everything you need to know about Rust | by Nishant Aanjaney Jalan | CodeX | Medium]]\\ [[https://www.devopsschool.com/blog/what-is-rust-and-how-it-works-an-overview-and-its-use-cases/|What is Rust and How it works? An Overview and Its Use Cases - DevOpsSchool.com]]\\ [[md>@adwilson0286/my-thoughts-on-programming-a-raspberry-pi-pico-with-rust-29d642898544|My Thoughts on Programming a Raspberry Pi Pico with Rust | by Alex Wilson | Medium]]\\ [[dt>kgrech/6-things-you-can-do-with-the-cow-in-rust-4l55|6 things you can do with the Cow 🐄 in Rust 🦀 - DEV Community]] [[gtr>https://dev.to/kgrech/6-things-you-can-do-with-the-cow-in-rust-4l55|翻訳]]\\ [[https://gihyo.jp/article/2023/07/monthly-python-2307|PythonとRustの融合:PyO3/maturinを使ったPythonバインディングの作成入門 | gihyo.jp]]\\ [[https://users.rust-lang.org/t/rust-official-ide/103656|Rust official IDE - community - The Rust Programming Language Forum]]\\ [[https://rapidrehita.health.nz/blog/extending-django-with-rust/|Rapid Rēhita | Extending Django with Rust]]\\ ==== 付録 ==== インストーラスクリプトの内容\\
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bat -p -l sh --pager never
#!/bin/sh
# shellcheck shell=dash
# shellcheck disable=SC2039  # local is non-POSIX

# This is just a little script that can be downloaded from the internet to
# install rustup. It just does platform detection, downloads the installer
# and runs it.

# It runs on Unix shells like {a,ba,da,k,z}sh. It uses the common `local`
# extension. Note: Most shells limit `local` to 1 var per line, contra bash.

# Some versions of ksh have no `local` keyword. Alias it to `typeset`, but
# beware this makes variables global with f()-style function syntax in ksh93.
# mksh has this alias by default.
has_local() {
    # shellcheck disable=SC2034  # deliberately unused
    local _has_local
}

has_local 2>/dev/null || alias local=typeset

is_zsh() {
    [ -n "${ZSH_VERSION-}" ]
}

set -u

# If RUSTUP_UPDATE_ROOT is unset or empty, default it.
RUSTUP_UPDATE_ROOT="${RUSTUP_UPDATE_ROOT:-https://static.rust-lang.org/rustup}"

# NOTICE: If you change anything here, please make the same changes in setup_mode.rs
usage() {
    cat <<EOF
rustup-init 1.27.1 (a8e4f5c64 2024-04-24)

The installer for rustup

Usage: rustup-init[EXE] [OPTIONS]

Options:
  -v, --verbose
          Enable verbose output
  -q, --quiet
          Disable progress output
  -y
          Disable confirmation prompt.
      --default-host <default-host>
          Choose a default host triple
      --default-toolchain <default-toolchain>
          Choose a default toolchain to install. Use 'none' to not install any toolchains at all
      --profile <profile>
          [default: default] [possible values: minimal, default, complete]
  -c, --component <components>...
          Component name to also install
  -t, --target <targets>...
          Target name to also install
      --no-update-default-toolchain
          Don't update any existing default toolchain after install
      --no-modify-path
          Don't configure the PATH environment variable
  -h, --help
          Print help
  -V, --version
          Print version
EOF
}

main() {
    downloader --check
    need_cmd uname
    need_cmd mktemp
    need_cmd chmod
    need_cmd mkdir
    need_cmd rm
    need_cmd rmdir

    get_architecture || return 1
    local _arch="$RETVAL"
    assert_nz "$_arch" "arch"

    local _ext=""
    case "$_arch" in
        *windows*)
            _ext=".exe"
            ;;
    esac

    local _url="${RUSTUP_UPDATE_ROOT}/dist/${_arch}/rustup-init${_ext}"

    local _dir
    if ! _dir="$(ensure mktemp -d)"; then
        # Because the previous command ran in a subshell, we must manually
        # propagate exit status.
        exit 1
    fi
    local _file="${_dir}/rustup-init${_ext}"

    local _ansi_escapes_are_valid=false
    if [ -t 2 ]; then
        if [ "${TERM+set}" = 'set' ]; then
            case "$TERM" in
                xterm*|rxvt*|urxvt*|linux*|vt*)
                    _ansi_escapes_are_valid=true
                ;;
            esac
        fi
    fi

    # check if we have to use /dev/tty to prompt the user
    local need_tty=yes
    for arg in "$@"; do
        case "$arg" in
            --help)
                usage
                exit 0
                ;;
            *)
                OPTIND=1
                if [ "${arg%%--*}" = "" ]; then
                    # Long option (other than --help);
                    # don't attempt to interpret it.
                    continue
                fi
                while getopts :hy sub_arg "$arg"; do
                    case "$sub_arg" in
                        h)
                            usage
                            exit 0
                            ;;
                        y)
                            # user wants to skip the prompt --
                            # we don't need /dev/tty
                            need_tty=no
                            ;;
                        *)
                            ;;
                        esac
                done
                ;;
        esac
    done

    if $_ansi_escapes_are_valid; then
        printf "\33[1minfo:\33[0m downloading installer\n" 1>&2
    else
        printf '%s\n' 'info: downloading installer' 1>&2
    fi

    ensure mkdir -p "$_dir"
    ensure downloader "$_url" "$_file" "$_arch"
    ensure chmod u+x "$_file"
    if [ ! -x "$_file" ]; then
        printf '%s\n' "Cannot execute $_file (likely because of mounting /tmp as noexec)." 1>&2
        printf '%s\n' "Please copy the file to a location where you can execute binaries and run ./rustup-init${_ext}." 1>&2
        exit 1
    fi

    if [ "$need_tty" = "yes" ] && [ ! -t 0 ]; then
        # The installer is going to want to ask for confirmation by
        # reading stdin.  This script was piped into `sh` though and
        # doesn't have stdin to pass to its children. Instead we're going
        # to explicitly connect /dev/tty to the installer's stdin.
        if [ ! -t 1 ]; then
            err "Unable to run interactively. Run with -y to accept defaults, --help for additional options"
        fi

        ignore "$_file" "$@" < /dev/tty
    else
        ignore "$_file" "$@"
    fi

    local _retval=$?

    ignore rm "$_file"
    ignore rmdir "$_dir"

    return "$_retval"
}

check_proc() {
    # Check for /proc by looking for the /proc/self/exe link
    # This is only run on Linux
    if ! test -L /proc/self/exe ; then
        err "fatal: Unable to find /proc/self/exe.  Is /proc mounted?  Installation cannot proceed without /proc."
    fi
}

get_bitness() {
    need_cmd head
    # Architecture detection without dependencies beyond coreutils.
    # ELF files start out "\x7fELF", and the following byte is
    #   0x01 for 32-bit and
    #   0x02 for 64-bit.
    # The printf builtin on some shells like dash only supports octal
    # escape sequences, so we use those.
    local _current_exe_head
    _current_exe_head=$(head -c 5 /proc/self/exe )
    if [ "$_current_exe_head" = "$(printf '\177ELF\001')" ]; then
        echo 32
    elif [ "$_current_exe_head" = "$(printf '\177ELF\002')" ]; then
        echo 64
    else
        err "unknown platform bitness"
    fi
}

is_host_amd64_elf() {
    need_cmd head
    need_cmd tail
    # ELF e_machine detection without dependencies beyond coreutils.
    # Two-byte field at offset 0x12 indicates the CPU,
    # but we're interested in it being 0x3E to indicate amd64, or not that.
    local _current_exe_machine
    _current_exe_machine=$(head -c 19 /proc/self/exe | tail -c 1)
    [ "$_current_exe_machine" = "$(printf '\076')" ]
}

get_endianness() {
    local cputype=$1
    local suffix_eb=$2
    local suffix_el=$3

    # detect endianness without od/hexdump, like get_bitness() does.
    need_cmd head
    need_cmd tail

    local _current_exe_endianness
    _current_exe_endianness="$(head -c 6 /proc/self/exe | tail -c 1)"
    if [ "$_current_exe_endianness" = "$(printf '\001')" ]; then
        echo "${cputype}${suffix_el}"
    elif [ "$_current_exe_endianness" = "$(printf '\002')" ]; then
        echo "${cputype}${suffix_eb}"
    else
        err "unknown platform endianness"
    fi
}

# Detect the Linux/LoongArch UAPI flavor, with all errors being non-fatal.
# Returns 0 or 234 in case of successful detection, 1 otherwise (/tmp being
# noexec, or other causes).
check_loongarch_uapi() {
    need_cmd base64

    local _tmp
    if ! _tmp="$(ensure mktemp)"; then
        return 1
    fi

    # Minimal Linux/LoongArch UAPI detection, exiting with 0 in case of
    # upstream ("new world") UAPI, and 234 (-EINVAL truncated) in case of
    # old-world (as deployed on several early commercial Linux distributions
    # for LoongArch).
    #
    # See https://gist.github.com/xen0n/5ee04aaa6cecc5c7794b9a0c3b65fc7f for
    # source to this helper binary.
    ignore base64 -d > "$_tmp" <<EOF
f0VMRgIBAQAAAAAAAAAAAAIAAgEBAAAAeAAgAAAAAABAAAAAAAAAAAAAAAAAAAAAQQAAAEAAOAAB
AAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAAAAAJAAAAAAAAAAkAAAAAAAAAAAA
AQAAAAAABCiAAwUAFQAGABUAByCAAwsYggMAACsAC3iBAwAAKwAxen0n
EOF

    ignore chmod u+x "$_tmp"
    if [ ! -x "$_tmp" ]; then
        ignore rm "$_tmp"
        return 1
    fi

    "$_tmp"
    local _retval=$?

    ignore rm "$_tmp"
    return "$_retval"
}

ensure_loongarch_uapi() {
    check_loongarch_uapi
    case $? in
        0)
            return 0
            ;;
        234)
            echo >&2
            echo 'Your Linux kernel does not provide the ABI required by this Rust' >&2
            echo 'distribution.  Please check with your OS provider for how to obtain a' >&2
            echo 'compatible Rust package for your system.' >&2
            echo >&2
            exit 1
            ;;
        *)
            echo "Warning: Cannot determine current system's ABI flavor, continuing anyway." >&2
            echo >&2
            echo 'Note that the official Rust distribution only works with the upstream' >&2
            echo 'kernel ABI.  Installation will fail if your running kernel happens to be' >&2
            echo 'incompatible.' >&2
            ;;
    esac
}

get_architecture() {
    local _ostype _cputype _bitness _arch _clibtype
    _ostype="$(uname -s)"
    _cputype="$(uname -m)"
    _clibtype="gnu"

    if [ "$_ostype" = Linux ]; then
        if [ "$(uname -o)" = Android ]; then
            _ostype=Android
        fi
        if ldd --version 2>&1 | grep -q 'musl'; then
            _clibtype="musl"
        fi
    fi

    if [ "$_ostype" = Darwin ]; then
        # Darwin `uname -m` can lie due to Rosetta shenanigans. If you manage to
        # invoke a native shell binary and then a native uname binary, you can
        # get the real answer, but that's hard to ensure, so instead we use
        # `sysctl` (which doesn't lie) to check for the actual architecture.
        if [ "$_cputype" = i386 ]; then
            # Handling i386 compatibility mode in older macOS versions (<10.15)
            # running on x86_64-based Macs.
            # Starting from 10.15, macOS explicitly bans all i386 binaries from running.
            # See: <https://support.apple.com/en-us/HT208436>

            # Avoid `sysctl: unknown oid` stderr output and/or non-zero exit code.
            if sysctl hw.optional.x86_64 2> /dev/null || true | grep -q ': 1'; then
                _cputype=x86_64
            fi
        elif [ "$_cputype" = x86_64 ]; then
            # Handling x86-64 compatibility mode (a.k.a. Rosetta 2)
            # in newer macOS versions (>=11) running on arm64-based Macs.
            # Rosetta 2 is built exclusively for x86-64 and cannot run i386 binaries.

            # Avoid `sysctl: unknown oid` stderr output and/or non-zero exit code.
            if sysctl hw.optional.arm64 2> /dev/null || true | grep -q ': 1'; then
                _cputype=arm64
            fi
        fi
    fi

    if [ "$_ostype" = SunOS ]; then
        # Both Solaris and illumos presently announce as "SunOS" in "uname -s"
        # so use "uname -o" to disambiguate.  We use the full path to the
        # system uname in case the user has coreutils uname first in PATH,
        # which has historically sometimes printed the wrong value here.
        if [ "$(/usr/bin/uname -o)" = illumos ]; then
            _ostype=illumos
        fi

        # illumos systems have multi-arch userlands, and "uname -m" reports the
        # machine hardware name; e.g., "i86pc" on both 32- and 64-bit x86
        # systems.  Check for the native (widest) instruction set on the
        # running kernel:
        if [ "$_cputype" = i86pc ]; then
            _cputype="$(isainfo -n)"
        fi
    fi

    case "$_ostype" in

        Android)
            _ostype=linux-android
            ;;

        Linux)
            check_proc
            _ostype=unknown-linux-$_clibtype
            _bitness=$(get_bitness)
            ;;

        FreeBSD)
            _ostype=unknown-freebsd
            ;;

        NetBSD)
            _ostype=unknown-netbsd
            ;;

        DragonFly)
            _ostype=unknown-dragonfly
            ;;

        Darwin)
            _ostype=apple-darwin
            ;;

        illumos)
            _ostype=unknown-illumos
            ;;

        MINGW* | MSYS* | CYGWIN* | Windows_NT)
            _ostype=pc-windows-gnu
            ;;

        *)
            err "unrecognized OS type: $_ostype"
            ;;

    esac

    case "$_cputype" in

        i386 | i486 | i686 | i786 | x86)
            _cputype=i686
            ;;

        xscale | arm)
            _cputype=arm
            if [ "$_ostype" = "linux-android" ]; then
                _ostype=linux-androideabi
            fi
            ;;

        armv6l)
            _cputype=arm
            if [ "$_ostype" = "linux-android" ]; then
                _ostype=linux-androideabi
            else
                _ostype="${_ostype}eabihf"
            fi
            ;;

        armv7l | armv8l)
            _cputype=armv7
            if [ "$_ostype" = "linux-android" ]; then
                _ostype=linux-androideabi
            else
                _ostype="${_ostype}eabihf"
            fi
            ;;

        aarch64 | arm64)
            _cputype=aarch64
            ;;

        x86_64 | x86-64 | x64 | amd64)
            _cputype=x86_64
            ;;

        mips)
            _cputype=$(get_endianness mips '' el)
            ;;

        mips64)
            if [ "$_bitness" -eq 64 ]; then
                # only n64 ABI is supported for now
                _ostype="${_ostype}abi64"
                _cputype=$(get_endianness mips64 '' el)
            fi
            ;;

        ppc)
            _cputype=powerpc
            ;;

        ppc64)
            _cputype=powerpc64
            ;;

        ppc64le)
            _cputype=powerpc64le
            ;;

        s390x)
            _cputype=s390x
            ;;
        riscv64)
            _cputype=riscv64gc
            ;;
        loongarch64)
            _cputype=loongarch64
            ensure_loongarch_uapi
            ;;
        *)
            err "unknown CPU type: $_cputype"

    esac

    # Detect 64-bit linux with 32-bit userland
    if [ "${_ostype}" = unknown-linux-gnu ] && [ "${_bitness}" -eq 32 ]; then
        case $_cputype in
            x86_64)
                if [ -n "${RUSTUP_CPUTYPE:-}" ]; then
                    _cputype="$RUSTUP_CPUTYPE"
                else {
                    # 32-bit executable for amd64 = x32
                    if is_host_amd64_elf; then {
                         echo "This host is running an x32 userland; as it stands, x32 support is poor," 1>&2
                         echo "and there isn't a native toolchain -- you will have to install" 1>&2
                         echo "multiarch compatibility with i686 and/or amd64, then select one" 1>&2
                         echo "by re-running this script with the RUSTUP_CPUTYPE environment variable" 1>&2
                         echo "set to i686 or x86_64, respectively." 1>&2
                         echo 1>&2
                         echo "You will be able to add an x32 target after installation by running" 1>&2
                         echo "  rustup target add x86_64-unknown-linux-gnux32" 1>&2
                         exit 1
                    }; else
                        _cputype=i686
                    fi
                }; fi
                ;;
            mips64)
                _cputype=$(get_endianness mips '' el)
                ;;
            powerpc64)
                _cputype=powerpc
                ;;
            aarch64)
                _cputype=armv7
                if [ "$_ostype" = "linux-android" ]; then
                    _ostype=linux-androideabi
                else
                    _ostype="${_ostype}eabihf"
                fi
                ;;
            riscv64gc)
                err "riscv64 with 32-bit userland unsupported"
                ;;
        esac
    fi

    # Detect armv7 but without the CPU features Rust needs in that build,
    # and fall back to arm.
    # See https://github.com/rust-lang/rustup.rs/issues/587.
    if [ "$_ostype" = "unknown-linux-gnueabihf" ] && [ "$_cputype" = armv7 ]; then
        if ensure grep '^Features' /proc/cpuinfo | grep -E -q -v 'neon|simd'; then
            # At least one processor does not have NEON (which is asimd on armv8+).
            _cputype=arm
        fi
    fi

    _arch="${_cputype}-${_ostype}"

    RETVAL="$_arch"
}

say() {
    printf 'rustup: %s\n' "$1"
}

err() {
    say "$1" >&2
    exit 1
}

need_cmd() {
    if ! check_cmd "$1"; then
        err "need '$1' (command not found)"
    fi
}

check_cmd() {
    command -v "$1" > /dev/null 2>&1
}

assert_nz() {
    if [ -z "$1" ]; then err "assert_nz $2"; fi
}

# Run a command that should never fail. If the command fails execution
# will immediately terminate with an error showing the failing
# command.
ensure() {
    if ! "$@"; then err "command failed: $*"; fi
}

# This is just for indicating that commands' results are being
# intentionally ignored. Usually, because it's being executed
# as part of error handling.
ignore() {
    "$@"
}

# This wraps curl or wget. Try curl first, if not installed,
# use wget instead.
downloader() {
    # zsh does not split words by default, Required for curl retry arguments below.
    is_zsh && setopt local_options shwordsplit

    local _dld
    local _ciphersuites
    local _err
    local _status
    local _retry
    if check_cmd curl; then
        _dld=curl
    elif check_cmd wget; then
        _dld=wget
    else
        _dld='curl or wget' # to be used in error message of need_cmd
    fi

    if [ "$1" = --check ]; then
        need_cmd "$_dld"
    elif [ "$_dld" = curl ]; then
        check_curl_for_retry_support
        _retry="$RETVAL"
        get_ciphersuites_for_curl
        _ciphersuites="$RETVAL"
        if [ -n "$_ciphersuites" ]; then
            _err=$(curl $_retry --proto '=https' --tlsv1.2 --ciphers "$_ciphersuites" --silent --show-error --fail --location "$1" --output "$2" 2>&1)
            _status=$?
        else
            echo "Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure"
            if ! check_help_for "$3" curl --proto --tlsv1.2; then
                echo "Warning: Not enforcing TLS v1.2, this is potentially less secure"
                _err=$(curl $_retry --silent --show-error --fail --location "$1" --output "$2" 2>&1)
                _status=$?
            else
                _err=$(curl $_retry --proto '=https' --tlsv1.2 --silent --show-error --fail --location "$1" --output "$2" 2>&1)
                _status=$?
            fi
        fi
        if [ -n "$_err" ]; then
            echo "$_err" >&2
            if echo "$_err" | grep -q 404$; then
                err "installer for platform '$3' not found, this may be unsupported"
            fi
        fi
        return $_status
    elif [ "$_dld" = wget ]; then
        if [ "$(wget -V 2>&1|head -2|tail -1|cut -f1 -d" ")" = "BusyBox" ]; then
            echo "Warning: using the BusyBox version of wget.  Not enforcing strong cipher suites for TLS or TLS v1.2, this is potentially less secure"
            _err=$(wget "$1" -O "$2" 2>&1)
            _status=$?
        else
            get_ciphersuites_for_wget
            _ciphersuites="$RETVAL"
            if [ -n "$_ciphersuites" ]; then
                _err=$(wget --https-only --secure-protocol=TLSv1_2 --ciphers "$_ciphersuites" "$1" -O "$2" 2>&1)
                _status=$?
            else
                echo "Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure"
                if ! check_help_for "$3" wget --https-only --secure-protocol; then
                    echo "Warning: Not enforcing TLS v1.2, this is potentially less secure"
                    _err=$(wget "$1" -O "$2" 2>&1)
                    _status=$?
                else
                    _err=$(wget --https-only --secure-protocol=TLSv1_2 "$1" -O "$2" 2>&1)
                    _status=$?
                fi
            fi
        fi
        if [ -n "$_err" ]; then
            echo "$_err" >&2
            if echo "$_err" | grep -q ' 404 Not Found$'; then
                err "installer for platform '$3' not found, this may be unsupported"
            fi
        fi
        return $_status
    else
        err "Unknown downloader"   # should not reach here
    fi
}

check_help_for() {
    local _arch
    local _cmd
    local _arg
    _arch="$1"
    shift
    _cmd="$1"
    shift

    local _category
    if "$_cmd" --help | grep -q 'For all options use the manual or "--help all".'; then
      _category="all"
    else
      _category=""
    fi

    case "$_arch" in

        *darwin*)
        if check_cmd sw_vers; then
            case $(sw_vers -productVersion) in
                10.*)
                    # If we're running on macOS, older than 10.13, then we always
                    # fail to find these options to force fallback
                    if [ "$(sw_vers -productVersion | cut -d. -f2)" -lt 13 ]; then
                        # Older than 10.13
                        echo "Warning: Detected macOS platform older than 10.13"
                        return 1
                    fi
                    ;;
                11.*)
                    # We assume Big Sur will be OK for now
                    ;;
                *)
                    # Unknown product version, warn and continue
                    echo "Warning: Detected unknown macOS major version: $(sw_vers -productVersion)"
                    echo "Warning TLS capabilities detection may fail"
                    ;;
            esac
        fi
        ;;

    esac

    for _arg in "$@"; do
        if ! "$_cmd" --help "$_category" | grep -q -- "$_arg"; then
            return 1
        fi
    done

    true # not strictly needed
}

# Check if curl supports the --retry flag, then pass it to the curl invocation.
check_curl_for_retry_support() {
    local _retry_supported=""
    # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
    if check_help_for "notspecified" "curl" "--retry"; then
        _retry_supported="--retry 3"
        if check_help_for "notspecified" "curl" "--continue-at"; then
            # "-C -" tells curl to automatically find where to resume the download when retrying.
            _retry_supported="--retry 3 -C -"
        fi
    fi

    RETVAL="$_retry_supported"
}

# Return cipher suite string specified by user, otherwise return strong TLS 1.2-1.3 cipher suites
# if support by local tools is detected. Detection currently supports these curl backends:
# GnuTLS and OpenSSL (possibly also LibreSSL and BoringSSL). Return value can be empty.
get_ciphersuites_for_curl() {
    if [ -n "${RUSTUP_TLS_CIPHERSUITES-}" ]; then
        # user specified custom cipher suites, assume they know what they're doing
        RETVAL="$RUSTUP_TLS_CIPHERSUITES"
        return
    fi

    local _openssl_syntax="no"
    local _gnutls_syntax="no"
    local _backend_supported="yes"
    if curl -V | grep -q ' OpenSSL/'; then
        _openssl_syntax="yes"
    elif curl -V | grep -iq ' LibreSSL/'; then
        _openssl_syntax="yes"
    elif curl -V | grep -iq ' BoringSSL/'; then
        _openssl_syntax="yes"
    elif curl -V | grep -iq ' GnuTLS/'; then
        _gnutls_syntax="yes"
    else
        _backend_supported="no"
    fi

    local _args_supported="no"
    if [ "$_backend_supported" = "yes" ]; then
        # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
        if check_help_for "notspecified" "curl" "--tlsv1.2" "--ciphers" "--proto"; then
            _args_supported="yes"
        fi
    fi

    local _cs=""
    if [ "$_args_supported" = "yes" ]; then
        if [ "$_openssl_syntax" = "yes" ]; then
            _cs=$(get_strong_ciphersuites_for "openssl")
        elif [ "$_gnutls_syntax" = "yes" ]; then
            _cs=$(get_strong_ciphersuites_for "gnutls")
        fi
    fi

    RETVAL="$_cs"
}

# Return cipher suite string specified by user, otherwise return strong TLS 1.2-1.3 cipher suites
# if support by local tools is detected. Detection currently supports these wget backends:
# GnuTLS and OpenSSL (possibly also LibreSSL and BoringSSL). Return value can be empty.
get_ciphersuites_for_wget() {
    if [ -n "${RUSTUP_TLS_CIPHERSUITES-}" ]; then
        # user specified custom cipher suites, assume they know what they're doing
        RETVAL="$RUSTUP_TLS_CIPHERSUITES"
        return
    fi

    local _cs=""
    if wget -V | grep -q '\-DHAVE_LIBSSL'; then
        # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
        if check_help_for "notspecified" "wget" "TLSv1_2" "--ciphers" "--https-only" "--secure-protocol"; then
            _cs=$(get_strong_ciphersuites_for "openssl")
        fi
    elif wget -V | grep -q '\-DHAVE_LIBGNUTLS'; then
        # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
        if check_help_for "notspecified" "wget" "TLSv1_2" "--ciphers" "--https-only" "--secure-protocol"; then
            _cs=$(get_strong_ciphersuites_for "gnutls")
        fi
    fi

    RETVAL="$_cs"
}

# Return strong TLS 1.2-1.3 cipher suites in OpenSSL or GnuTLS syntax. TLS 1.2
# excludes non-ECDHE and non-AEAD cipher suites. DHE is excluded due to bad
# DH params often found on servers (see RFC 7919). Sequence matches or is
# similar to Firefox 68 ESR with weak cipher suites disabled via about:config.
# $1 must be openssl or gnutls.
get_strong_ciphersuites_for() {
    if [ "$1" = "openssl" ]; then
        # OpenSSL is forgiving of unknown values, no problems with TLS 1.3 values on versions that don't support it yet.
        echo "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384"
    elif [ "$1" = "gnutls" ]; then
        # GnuTLS isn't forgiving of unknown values, so this may require a GnuTLS version that supports TLS 1.3 even if wget doesn't.
        # Begin with SECURE128 (and higher) then remove/add to build cipher suites. Produces same 9 cipher suites as OpenSSL but in slightly different order.
        echo "SECURE128:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS-ALL:-CIPHER-ALL:-MAC-ALL:-KX-ALL:+AEAD:+ECDHE-ECDSA:+ECDHE-RSA:+AES-128-GCM:+CHACHA20-POLY1305:+AES-256-GCM"
    fi
}

main "$@" || exit 1