LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 42290 - LLVM Compiler Toolchain extension does not support Visual Studio 2019
Summary: LLVM Compiler Toolchain extension does not support Visual Studio 2019
Status: RESOLVED WONTFIX
Alias: None
Product: Packaging
Classification: Unclassified
Component: Windows Installer (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-16 00:37 PDT by Karsten H
Modified: 2019-06-26 16:28 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten H 2019-06-16 00:37:40 PDT
On my Windows 10 system with Visual Studio Enterprise 2019 version 16.1.3, the LLVM Compiler Toolchain extension version 1.0.359557 does not install the .props and .targets and .xml files to the folder "MSBuild\Microsoft\VC\v160" where platform toolsets are specified for VS 2019.
Instead, it installs to the folder "Common7\IDE\VC\VCTargets" where platform toolsets are specified for VS 2017. As a result, there is no LLVM platform toolset available in project properties.
I have tried multiple times, including the complete uninstallation and reinstallation of VS and the extension.
After manually copying all 7 files from the wrong folder to the correct folder it works.
With VS 2019, Microsoft seems to have changed the folder where platform toolsets are specified. In this case, the extension has not yet been adapted to this change.
Comment 1 Hans Wennborg 2019-06-17 07:32:56 PDT
Sorry about this. I bumped the manifest to claim VS2019 support because it worked on my machine, but it seems it only works if VS2017 is also installed.

I've added a note about this to the extension description at https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.llvm-toolchain

Nobody is really maintaining this extension. If you'd be interested in trying to write patches to fix this, I can help test and get them committed.
Comment 2 Karsten H 2019-06-18 03:41:15 PDT
I think the following Microsoft Developer Community bug report for VS 2019 addresses this issue:
https://developercommunity.visualstudio.com/content/problem/498941/vsix-vctargets-install-root-still-points-to-old-lo.html

Looking at the source code of the extension, I think the file "llvm.csproj" needs to be fixed as follows in order to support VS 2019:
1. In the "InstallRoot" element exchange the word "VCTargets" with "MSBuild" (seven changes in total)
2. If the "VSIXSubPath" element (right below the "InstallRoot" element) exists, then prepend "Microsoft\VC\v160\" to its path, else add the "VSIXSubPath" element with the path "Microsoft\VC\v160" (right below the "InstallRoot" element)

These are all of the necessary changes:

<Content Include="llvm-general.xml">
      <IncludeInVSIX>true</IncludeInVSIX>
      <InstallRoot>MSBuild</InstallRoot>
      <VSIXSubPath>Microsoft\VC\v160\1033</VSIXSubPath>
</Content>
<Content Include="LLVM.Cpp.Common.props">
      <IncludeInVSIX>true</IncludeInVSIX>
      <InstallRoot>MSBuild</InstallRoot>
      <VSIXSubPath>Microsoft\VC\v160</VSIXSubPath>
</Content>
<Content Include="LLVM.Cpp.Common.targets">
      <IncludeInVSIX>true</IncludeInVSIX>
      <InstallRoot>MSBuild</InstallRoot>
      <VSIXSubPath>Microsoft\VC\v160</VSIXSubPath>
</Content>
<Content Include="Platformx64\Toolset.props">
      <IncludeInVSIX>true</IncludeInVSIX>
      <InstallRoot>MSBuild</InstallRoot>
      <VSIXSubPath>Microsoft\VC\v160\Platforms\x64\PlatformToolsets\llvm</VSIXSubPath>
</Content>
<Content Include="Platformx64\Toolset.targets">
      <IncludeInVSIX>true</IncludeInVSIX>
      <InstallRoot>MSBuild</InstallRoot>
      <VSIXSubPath>Microsoft\VC\v160\Platforms\x64\PlatformToolsets\llvm</VSIXSubPath>
</Content>
<Content Include="Platformx86\Toolset.props">
      <IncludeInVSIX>true</IncludeInVSIX>
      <InstallRoot>MSBuild</InstallRoot>
      <VSIXSubPath>Microsoft\VC\v160\Platforms\Win32\PlatformToolsets\llvm</VSIXSubPath>
</Content>
<Content Include="Platformx86\Toolset.targets">
      <IncludeInVSIX>true</IncludeInVSIX>
      <InstallRoot>MSBuild</InstallRoot>
      <VSIXSubPath>Microsoft\VC\v160\Platforms\Win32\PlatformToolsets\llvm</VSIXSubPath>
</Content>

But I must admit that I have never written an extension, so I might be wrong or this might be just part of the full solution.
Comment 3 Hans Wennborg 2019-06-19 00:56:39 PDT
Hmm, but we'd also like the extension to keep working with VS 2017.

All in all, since we unfortunately don't have anyone maintaining the extension, and as MS is adding their own llvm/clang toolset in VS 2019, I've updated the extension manifest to no longer claim 2019 support and linked to MS' blog post from the extension description.
Comment 4 Karsten H 2019-06-19 13:21:05 PDT
If I understand the Microsoft post correctly, clang/LLVM support is currently for CMake based projects only, not for MSBuild based projects. They write "Support for MSBuild based C++ projects is on the roadmap and will be available soon in a future release". But what does "soon" mean? There seem to be quite some people who want this extension in VS 2019 now (see Q & A).
So why not offer two extensions? One for VS before 2017 and earlier, and one for 2019.
Comment 5 Hans Wennborg 2019-06-21 04:54:50 PDT
(In reply to Karsten H from comment #4)
> If I understand the Microsoft post correctly, clang/LLVM support is
> currently for CMake based projects only, not for MSBuild based projects.
> They write "Support for MSBuild based C++ projects is on the roadmap and
> will be available soon in a future release". But what does "soon" mean?

I think soon means the next preview, but I'm not sure.

> There seem to be quite some people who want this extension in VS 2019 now
> (see Q & A).
> So why not offer two extensions? One for VS before 2017 and earlier, and one
> for 2019.

The problem is that we don't even have anyone maintaining the current extension. So publishing another one doesn't seem like a good idea.
Comment 6 Karsten H 2019-06-22 02:12:05 PDT
(In reply to Hans Wennborg from comment #5)
> (In reply to Karsten H from comment #4)
> The problem is that we don't even have anyone maintaining the current
> extension. So publishing another one doesn't seem like a good idea.
Since no one maintains the extension, yet it is still available, I have to assume that its development is considered complete (just like VS 2017).

An additional extension for VS 2019 is considered complete, too, and declared obsolete with the Microsoft release. If there is anything to maintain in the meantime, you can instead hint at that "soon" Microsoft release. This is certainly not optimal, but still better than no extension at all. And if there was nothing to maintain in the meantime, it would be a temporary solution that just works.

There is also an alternative. It is very simple to make the extension work by just copying seven files from the wrong folder to the correct folder. Please see the post from the user "powerchord" (me) in the "Rating & Review" section. You could offer this solution in the "Overview" section to complement your hint at the Microsoft release. This, too, is certainly not optimal, but again better than nothing.

I see it this way: people want to use clang/LLVM in VS 2019 now and not "soon", maybe for very reasonable reasons (C++ conformance issues and still a lot of bugs in MSVC). If you asked them if they would accept a temporary unmaintained yet very probably working solution, I think no one would answer "no". I, too, was in this situation and was happy to have found the manual solution from above. Not only for my personal projects, but especially for the projects at work.
Comment 7 Hans Wennborg 2019-06-25 00:30:59 PDT
(In reply to Karsten H from comment #6)
> I see it this way: people want to use clang/LLVM in VS 2019 now and not
> "soon", maybe for very reasonable reasons (C++ conformance issues and still
> a lot of bugs in MSVC). If you asked them if they would accept a temporary
> unmaintained yet very probably working solution, I think no one would answer
> "no". I, too, was in this situation and was happy to have found the manual
> solution from above. Not only for my personal projects, but especially for
> the projects at work.

Anyone can publish that extension though, but someone has to do the work and we don't have anyone working on it at the moment.
Comment 8 Zufu Liu 2019-06-26 16:28:12 PDT
See https://github.com/zufuliu/llvm-utils

If you going to install into v160 folder, please possible consider install into v150 and ARM64 folder too.

It seems in order to build this extension (which just copy some files), the huge? Visual Studio SDK need to be installed.