LoginSignup
3
3

More than 1 year has passed since last update.

Rust環境構築: Visual C++ Build Toolsを使わずにCygwinのC++環境を使う

Last updated at Posted at 2022-03-10

通常, WindowsにRustをインストールすると, Visual C++ Build Toolsのインストールを求められる.
C++環境をCygwinで既に持っているユーザーは, Visual C++ Build Toolsをインストールしたくない.
ここではその回避方法を示す.

前提

gcc-core, gcc-g++, gdb, makeは既にCygwinで導入済みとする.
私のCygwinインストールメモはこちら.

Rustの環境構築

ダウンロード

通常のインストーラーの場所ではなく, こちらからx86_64-pc-windows-gnurustup-init.exeをダウンロードする.
installer.png

インストール

インストーラーの実行
install1.png
C++のビルドツールが必要と言われますが, 既にCygwinで持っているためそのまま進めます.

インストールオプションが出るため, 修正する必要があります.
(インストーラーでgnuを選んだのにデフォルトでmsvcになっているという罠があります)
install2.png
2のCustomize installationを選んで,

Default host triple? [x86_64-pc-windows-msvc]

と聞かれるので, x86_64-pc-windows-gnuと入力します.
その他の設定はそのままでOKです.

実行

run.png

  1. cargo new helloworld
  2. cd helloworld
  3. cargo run

で動作確認します.
無事, 動かすことができました.

3
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
3
3