프로그래밍/프로그래밍언어

[rust] note: the msvc targets depend on the msvc linker but `link.exe` was not found

Hithero 2021. 12. 22. 18:19

 

에러

note: the msvc targets depend on the msvc linker but `link.exe` was not found

note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed with the Visual C++ option

상황

scoop을 통해 rust를 uninstall하고 rustup을 다시 설치하였다.

그 이후 cargo build를 하려고하니 해당 에러가 발생하였다.

msvc 계열은 보통 visual studio 에서 많이 붙는 네이밍인데, 나는 보통 gcc/g++과 같은 gnu 계열을 사용하오 있는 상황이었다.(이전 rust도 gcc설치하고 사용했었음)

해결법

rustup show 커맨드로 확인해보자. 필자는 stable-x86_64-pc-windows-msvc (default) 가 깔려있었다.

stable-x86_64-pc-windows-msvc 대신 stable-x86_64-pc-windows-gnu를 툴체인에 설치하고, default로 설정해주면 된다.

rustup uninstall toolchain stable-x86_64-pc-windows-msvc
rustup toolchain install stable-x86_64-pc-windows-gnu
rustup default stable-x86_64-pc-windows-gnu

다른 방법으로는 에러코드에서 제시한대로, visual c++ build tool을 설치해주는 것이다.

https://taking.kr/blog/archives/5436.html

위의 링크를 참고하자. 

원인

msvc 계열을 쓰지 않아서 gnu로 설치해야 하는 것이었다.

 

 

 

참고자료

https://stackoverflow.com/questions/55603111/unable-to-compile-rust-hello-world-on-windows-linker-link-exe-not-found

728x90
반응형