LLVM in VCPKG and painful update


I’m not an expert in LLVM or VCPKG, but it seems to be quite painful in general to upgrade LLVM, in the case of VCPKG, literally a nightmare.

If my understanding is correct this is to do with solving the diamond library issue: two different libraries depends upon different LLVM major version (13 vs 15 let’s say).

My question is how to approach this and solve this issue?

I believe it is unrealistic to continue with the current approach: force the world to compile with the new version until the upgrade can be done, because this pushes to much pressure on the person trying to upgrade LLVM in VCPKG.

I think it is a better approach to allow multiple versions of LLVM to co-exist.

I believe the most problematic thing would be the symbol clash.
Does LLVM supports custom namespace? I mean during the configuration, we could specify the namespace to use for the LLVM sources and instead of doing:

namespace llvm { ... }

it would then do:

namespace LLVM_NAMESPACE { ... }

And LLVM_NAMESPACE could be llvm16 or even vendor_llvm16 which would allow to have multiple different version of LLVM running in the same process.


What do you think?


The usual solution to this problem is to distribute different versions of LLVM in different directories.

For example, on Fedora the current LLVM version (15) is installed in the usual system paths, while LLVM 14 is installed in /usr/lib64/llvm14, etc. During LLVM upgrades, we don’t rebuild other packages using LLVM, they switch to using the compatibility package for the previous version instead.

The exact scheme differs (e.g. I think Ubuntu installs all versions in a subdirectory, without “privileging” the latest one), but I think that’s basically what every distro does in one form or another.

I’m not familiar with vcpkg limitations, but I would expect that the same scheme would work there as well?

This doesn’t solve the diamond issue:

  • libA depends on llvm 13
  • libB depends on llvm 15
  • App depends on libA and libB

This is why it is impossible to update llvm in vcpkg because all the libs using llvm have to use the exact same version.

Cross posted to: How to improve LLVM situation? · Discussion #29391 · microsoft/vcpkg · GitHub