[Fixed] Issue with building LLVM in Rust compiler build

Hi folks,

I posted a question on the users forum link and was advised that this would be a more suitable place for such a topic.

I am trying to build the Rust compiler (MSVC build) from source on a Windows VM. When building the rust compiler from source, I encountered an error when it tries to build LLVM. The full relevant log can be found here .

It seems that it tries to execute the directory (bin) instead of the executable (cmake.exe), which led to me thinking that the PATH for cmake is wrongly set. However, running cmake --version yields the correct output in the same script. so it shouldn’t be that. Does anyone here know what could cause this wrong cmake reference?

Update: This build process works on my local machine, where CMake is installed seperately rather than through Visual Studio, as in the case of the Windows VM. Could this be a point of concern? This line on the official Rust github repo in particular might be relevant

(If you're installing cmake yourself, be careful that “C++ CMake tools for Windows” doesn't get included under “Individual components”.)

Update:

So from the backtrace I found the relevant line here: image from ..cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.33\src\lib.rs:773:5

This line of code expects executable to be a valid path to the executable cmake.exe, instead of the containing folder.

In the VM that I am building this project, there happens to be a cmake environment variable that points to the bin folder, which is captured by the env::var("CMAKE") call. The cmake --version call still works fine because it uses the PATH environment variable.