Rust処理系をインストールした時のメモです。
OSバージョン
$ uname -a
Linux chatora 3.13.0-63-generic #103-Ubuntu SMP Fri Aug 14 21:43:30 UTC 2015 i686 i686 i686 GNU/Linux
$
処理系のインストール
Rust処理系のインストール先ディレクトリを作成し、curlコマンドでセットアップスクリプトをダウンロード & 実行します。インストール先は、–prefix=インストール先 と指定します。
$ mkdir -p <インストール先>
$ curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --prefix=<インストール先>
Welcome to Rust.
This script will download the Rust compiler and its package manager, Cargo, and
install them to <インストール先>. You may install elsewhere by running this script
with the --prefix=<path> option.
The installer will run under 'sudo' and may ask you for your password. If you do
not want the script to run 'sudo' then pass it the --disable-sudo flag.
You may uninstall later by running <インストール先>/lib/rustlib/uninstall.sh,
or by running this script again with the --uninstall flag.
Continue? (y/N) y
rustup: gpg available. signatures will be verified
rustup: downloading manifest for 'stable'
rustup: downloading toolchain for 'stable'
######################################################################## 100.0%
~~~~~~~~~~~~~ 中 略 ~~~~~~~~~~~~~
rustup: extracting installer
rustup: installing toolchain for 'stable'
[sudo] password for yz2cm:
install: creating uninstall script at <インストール先>/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'rust-docs'
install: installing component 'cargo'
Rust is ready to roll.
$
パスの設定
~/.bashrcに、各種パスを追加します。
export PATH=${PATH}:<インストール先>/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<インストール先>/lib
$ . ~/.bashrc
処理系のバージョン
$ rustc --version
rustc 1.4.0 (8ab8581f6 2015-10-27)
$
サンプルコード
$ cat main.rs
fn main()
{
println!("Hello, world!");
}
$ rust main.rs
$ ./main
Hello, world!
$