Closed polloloco closed 8 months ago
What is the output of rustup show
? Are you using a msvc rust toolchain?
Yes, msvc
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\User\.rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-msvc (default)
nightly-x86_64-pc-windows-msvc
esp
installed targets for active toolchain
--------------------------------------
riscv32imc-unknown-none-elf
x86_64-pc-windows-msvc
active toolchain
----------------
stable-x86_64-pc-windows-msvc (default)
rustc 1.75.0 (82e1608df 2023-12-21)
I'm unable to repro this error locally. I suspect it has to do with your installation of msvc. A couple questions:
cargo build
failing with the same error?CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true
and running cargo build
provide any additional info? cargo build is failing the same way. Setting the environment variable doesn't provide any additional details.
Yes I'm running from the ewdk developer prompt. I have Visual Studio 2022 Enterprise (version 17.8.6) installed.
My visual studio install configuration:
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime",
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.VisualStudio.Component.TextTemplating",
"Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd",
"Microsoft.VisualStudio.Component.Debugger.JustInTime",
"Microsoft.VisualStudio.Component.ClassDesigner",
"Microsoft.VisualStudio.Component.GraphDocument",
"Microsoft.VisualStudio.Component.CodeMap",
"Microsoft.VisualStudio.Component.VC.CoreIde",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Graphics.Tools",
"Microsoft.VisualStudio.Component.VC.DiagnosticTools",
"Microsoft.VisualStudio.Component.Windows11SDK.22621",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Native",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.VC.ASAN",
"Microsoft.VisualStudio.Component.Vcpkg",
"Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset",
"Microsoft.VisualStudio.Component.VC.Llvm.Clang",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Component.VC.ATL.Spectre",
"Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre",
"Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre"
]
}
I'll try to reproduce the error in a VM tomorrow
I figured it out. The first time I ran it inside my VM, it didn't work because I forgot to install llvm. But it gave me an interesting error:
Unable to find libclang: "couldn't find any valid shared libraries matching: ['clang.dll', 'libclang.dll'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
After installing llvm it compiled in the VM.
So now I went to my machine and checked the LIBCLANG_PATH, and to my surprise it didn't point to my llvm installation, but rather to C:\Users\User\.rustup\toolchains\esp\xtensa-esp32-elf-clang\esp-clang\bin\libclang.dll
Looks like the esp32 rust toolchain sets that env var to their custom (patched) clang version.
I changed the env var in my terminal to point to my llvm installation like this set LIBCLANG_PATH=C:\Program Files\LLVM\bin\libclang.dll
and tried to run cargo make
again, and now it works :)
Yesterday I had a feeling the esp toolchain might be interfering so I checked PATH
to make sure the regular llvm installation comes first. That didn't help though. Also removing all esp related things from PATH didn't help, looks like I also have to make sure LIBCLANG_PATH
is correct.
Good to hear you solved your issue!
I had trouble compiling my own test driver, so I wanted to compile the sample-kmdf-driver crate to see if the problem is with my driver.
But I get the same error from that project (full output below):
I'm running Windows 10 LTSC, with the latest (10.0.22621) EWDK iso mounted to E: It looks like the compiler doesn't set preprocessor defines such as _MSC_VER for some reason