YU2TA7KA's BLOG ~take one step at a time~


Raspberry PiにRustをインストールしてHelloWorldする




Rust (プログラミング言語) - Wikipedia

Hello World


pi@raspberrypi:~/Rust $ uname -a
Linux raspberrypi 4.19.57-v7+ #1244 SMP Thu Jul 4 18:45:25 BST 2019 armv7l GNU/Linux
pi@raspberrypi:~/Rust $ cat /proc/version
Linux version 4.19.57-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1244 SMP Thu Jul 4 18:45:25 BST 2019
pi@raspberrypi:~/Rust $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.9 (stretch)
Release:        9.9
Codename:       stretch


pi@raspberrypi:~/Rust $ curl https://sh.rustup.rs -sSf | sh
info: downloading installer

Welcome to Rust!

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

It will add the cargo, rustc, rustup and other commands to
directory, located at:


This path will then be added to your PATH environment varia
profile file located at:


You can uninstall at any time with rustup self uninstall an
be reverted.

Current installation options:

   default host triple: armv7-unknown-linux-gnueabihf
     default toolchain: stable
  modify PATH variable: yes

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

info: syncing channel updates for 'stable-armv7-unknown-lin
info: latest update on 2019-07-04, rust version 1.36.0 (a53
info: downloading component 'rustc'
 75.2 MiB /  75.2 MiB (100 %)   5.2 MiB/s in 30s ETA:  0s
info: downloading component 'rust-std'
 65.0 MiB /  65.0 MiB (100 %)   1.1 MiB/s in 33s ETA:  0s
info: downloading component 'cargo'

info: installing component 'rustc'
 75.2 MiB /  75.2 MiB (100 %)   2.6 MiB/s in 39s ETA:  0s
info: installing component 'rust-std'
 65.0 MiB /  65.0 MiB (100 %)   3.2 MiB/s in  1m 33s ETA:
info: installing component 'cargo'
  4.2 MiB /   4.2 MiB (100 %)   3.1 MiB/s in  8s ETA:  0s
info: default toolchain set to 'stable'

  stable installed - rustc 1.36.0 (a53f9df32 2019-07-03)

Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo
environment variable. Next time you log in this will be don

To configure your current shell run source $HOME/.cargo/env


pi@raspberrypi:~/Rust $  cargo --version
cargo 1.36.0 (c4fcfb725 2019-05-15)
pi@raspberrypi:~/Rust $  rustc --version
rustc 1.36.0 (a53f9df32 2019-07-03)
pi@raspberrypi:~/Rust $ rustdoc --version
rustdoc 1.36.0 (a53f9df32 2019-07-03)
pi@raspberrypi:~/Rust $ rustup --version
rustup 1.18.3 (435397f48 2019-05-22)


pi@raspberrypi:~/Rust $ source $HOME/.cargo/env



pi@raspberrypi:~/Rust $ cargo new hello
     Created binary (application) `hello` package
pi@raspberrypi:~/Rust $ cd hello/
pi@raspberrypi:~/Rust/hello $ cargo build
   Compiling hello v0.1.0 (/home/pi/Rust/hello)
    Finished dev [unoptimized + debuginfo] target(s) in 9.29s


pi@raspberrypi:~/Rust/hello $ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/hello`
Hello, world!


UbuntuにRustをインストールする - Qiita
Home | Rustの日本語ドキュメント/Japanese Docs for Rust
Hello, World! - The Rust Programming Language