Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The specified task executable location "bin\clang-cl.exe" is invalid. #7

Open
11philip22 opened this issue Oct 22, 2021 · 3 comments
Open

Comments

@11philip22
Copy link

Hi,
I have installed llvm-utils for visual studio 2019. And i have installed llvm in C:\llvm
But when i compile a project with LLVM v 142 as toolchain. i get the error The specified task executable location "bin\clang-cl.exe" is invalid.
I have a Directory.build.props in my project root with the following contents:

<Project>
  <PropertyGroup>
    <LLVMInstallDir>C:\llvm\</LLVMInstallDir>
	<LLVMToolsVersion>14.0.0</LLVMToolsVersion>
  </PropertyGroup>
</Project>
@zufuliu
Copy link
Owner

zufuliu commented Oct 22, 2021

How about remove above property?
LLVMInstallDir is detected from registry (which is set official installer from https://github.com/llvm/llvm-project/releases), see https://github.com/zufuliu/llvm-utils/blob/main/VS2017/LLVM/LLVM.Common.props#L3

<PropertyGroup>
  <LLVMInstallDir>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\LLVM)</LLVMInstallDir>
  <LLVMInstallDir Condition="'$(LLVMInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\LLVM)</LLVMInstallDir>

for your self built llvm, two workarounds:

  1. you set ClangClExecutable in your project:
    ClangClExecutable

  2. create registry and set default value for LLVM\LLVM item to the directory C:\llvm.

I will need time to figure out why override LLVMInstallDir not work, and expose it in LLVM property page for easy configuration.

zufuliu added a commit that referenced this issue Oct 24, 2021
@zufuliu
Copy link
Owner

zufuliu commented Oct 24, 2021

Hi @11philip22, can you test latest code, check whether it works now?

In 319852e, I changed LLVMInstallDir to only use official installation folder when bin\clang-cl.exe exists (in your case, since bin\clang-cl.exe is not found, it's an empty string).
By default Visual Studio 2019/2022 sets LLVMInstallDir to $(VsInstallRoot)\VC\Tools\Llvm or $(VsInstallRoot)\VC\Tools\Llvm\x64, depends on the imported order of your Directory.build.props file, this change may still not fix the problem.

@11philip22
Copy link
Author

How about remove above property? LLVMInstallDir is detected from registry (which is set official installer from https://github.com/llvm/llvm-project/releases), see https://github.com/zufuliu/llvm-utils/blob/main/VS2017/LLVM/LLVM.Common.props#L3

<PropertyGroup>
  <LLVMInstallDir>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\LLVM)</LLVMInstallDir>
  <LLVMInstallDir Condition="'$(LLVMInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\LLVM)</LLVMInstallDir>

for your self built llvm, two workarounds:

1. you set `ClangClExecutable` in your project:
   ![ClangClExecutable](https://user-images.githubusercontent.com/2289926/138464602-aba182c7-70b8-4e7d-8346-388b436ac1d6.png)

2. create registry and set default value for `LLVM\LLVM` item to the directory `C:\llvm`.

I will need time to figure out why override LLVMInstallDir not work, and expose it in LLVM property page for easy configuration.

hi @zufuliu Thanks for responding.
I dont think LLVMInstallDir is set because i compiled from source.

Hi @11philip22, can you test latest code, check whether it works now?

In 319852e, I changed LLVMInstallDir to only use official installation folder when bin\clang-cl.exe exists (in your case, since bin\clang-cl.exe is not found, it's an empty string). By default Visual Studio 2019/2022 sets LLVMInstallDir to $(VsInstallRoot)\VC\Tools\Llvm or $(VsInstallRoot)\VC\Tools\Llvm\x64, depends on the imported order of your Directory.build.props file, this change may still not fix the problem.

I will try out your new release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants