🦀
RustのBevyで--target=aarch64-pc-windows-msvcをやってみたかった。
PS C:\~~~\binary_test> cargo run --target=aarch64-pc-windows-msvc
Compiling binary_test v0.0.0 (C:\~~~\binary_test)
error: linker `link.exe` not found
|
= note: program not found
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option.
note: VS Code is a different product, and is not sufficient.
error: could not compile `binary_test` (bin "binary_test") due to previous error
仮説
MSVC v143 - VS 2022 C++は入っているんだけどな。Cython動く環境だし。
となると、Visual StudioのVS 2017 C++ビルドツールを入れればいいんでしょ?分かってる分かってる。
・・・どれだ、これ?
インストールする前に。
調べてみると、2017年版ではなく2022年版のを入れても問題なく動いた報告もある。
となればlink.exeが見つからない?もしくは・・・。
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin
をシステム環境設定のPathに追加。
再起動。ダメでした。
解決
aarch64-pc-windows-msvc
をx86_64-pc-windows-msvc
に変更するだけでよかった。
ドキュメントはちゃんと読もうね・・・。
おまけ
rustupにMSVC版とGNU版があるようで、前者の場合VC++ Build toolsが必要になってくる。公式サイトで配布されているRUSTUP-INIT.EXE(64-BIT)を使用したため、確実にMSVC版ではある。
この環境では調べたサイト
Discussion