Rust(1.72.0)インストール後下記のエラーメッセージが表示された。
error: linker
link.exe
not found
|
= note: program not found
note: the msvc targets depend on the msvc linker butlink.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.
Window 11
scoopでRust開発環境を設定する
scoop install rust
scoop install rustup
rustup toolchain install stable-x86_64-pc-windows-gnu
rustup default stable-x86_64-pc-windows-gnu
hello world
cargo new hello
cargo new hello --vcs none // no git
cd hello
cargo run
Dependency manage tool
- install cargo-edit
cargo install cargo-edit
- Add pakages
cargo add num
Generate doc
cargo doc
cargo doc --open
Windows10 or Windows 11
Even you did as the same as the steps above, it still maybe report error.
I encountered such "linker.exe" on Windows10
Using Tauri on window11, it showed
package.metadata does not exist
Follow these steps, though I didn't want to install Visual Studio Build Tools because it't too big, I haven't found any other better method.
- Install Visual Studio Build Tools with "Desktop development with C++" checked. Then
rustup target remove x86_64-pc-windows-gnu
rustup target add x86_64-pc-windows-msvc
rustup default stable-msvc
Windows で最も簡単なやり方
Windows Subsystem for Linux: Ubuntu
As the official guide: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Then it maybe report this error.
cargo run
Compiling hello v0.1.0 (/home/ldk/hello)
error: linkercc
not found
|
= note: No such file or directory (os error 2)
error: could not compilehello
(bin "hello") due to previous error
Install this package and try again
sudo apt-get update
sudo apt install build-essential
cargo install cargo-edit
It maybe report such error:
error: failed to run custom build command for
openssl-sys v0.9.93
Caused by:
process didn't exit successfully:/tmp/cargo-installaGSe6L/release/build/openssl-sys-c43e78ad5c62ea2e/build-script-main
(exit status: 101)
Run this command and try again
sudo apt install pkg-config libssl-dev
When you use xlsxwriter
, you may encounter such error:
thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching
Run this command and try again
sudo apt-get install libclang-dev
Show Rust documents
rustup doc --std
Update Rust
rustup -V
rustup update