4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Jetson NanoでRustを始める

Posted at

C/C++を置き換える言語として、調査していたところ、AIで注目されているpythonをおさえて3年連続で好きな言語第1位「Rust」と見つけた。
気になり、早速、試してみることにしました。

前準備

Jetson nano Developerの公式ページより、OSイメージファイルをダウンロードし、microSDヘ書き込みます。
macOS, Windows, Linuxにて、操作手順が異なります。
https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit#write

IPアドレスを確認する

$ ip address

TIPS:ifconfigコマンドは非推奨になってしまったので、今後はipコマンドを使いましょう。

必要なパッケージをインストール

$ sudo apt -y install curl

Rustをインストール

$ curl https://sh.rustup.rs -sSf | sh

Current installation options:

   default host triple: aarch64-unknown-linux-gnu
     default toolchain: stable
               profile: default
  modify PATH variable: yes

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

1を選択し、ディフォルトでインストールします。

パスを反映する

$ source $HOME/.cargo/env

Rustのバージョンを確認

$ rustc -V

TIPS:2019年10月19日時点で下記の通りでした。
rustc 1.38.0 (625451e37 2019-09-23)

プロジェクトファイルを作成

$ cargo new hello
$ cd hello
$ cat src/main.rs
fn main() {
    println!("Hello, world!");
}

TIPS:Hello Worldコードは自動生成されます。

Rustをコンパイル・実行

$ cargo run

まとめ

  • Rustはインストールが簡単
  • パッケージ管理はcargo

TIPS:Rustをアンインストールする方法

$ rustup self uninstall
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?