Webp and windows clang-cl 20

Howdy howdy!

On Windows with clang-cl from LLVM 19 or 20, the bundled libwebp SSE4.1 and AVX2 sources fail to compile for me, with:

C:\Program Files\LLVM\lib\clang\20\include\rtmintrin.h(36,1): error: attribute 'target' multiversioning cannot be combined with attribute 'always_inline'
C:\Program Files\LLVM\lib\clang\20\include\intrin.h(166,6): note: function multiversioning caused by this declaration

Meat proxy details:

  1. Each file wraps libwebp in #pragma clang attribute push (__attribute__ ((target ("sse4.1"))), apply_to=function). The AVX2 files use "avx2".
  2. libwebp’s src/utils/utils.h includes <intrin.h> when _MSC_VER is defined. So under clang-cl, that include happens inside the pragma region.
  3. In LLVM 19 and 20, intrin.h line 166 declares void _xend(void);. The pragma gives that declaration target("sse4.1").
  4. rtmintrin.h defines _xend with target("rtm") and always_inline. Clang reads the two target attributes as function multiversioning, which it can’t combine with always_inline.

My current workaround: WebP: Include <intrin.h> before the SIMD target attribute so clang-cl… · sudara/JUCE@d6c4023 · GitHub

Thank you for reporting this issue :wink:

I have a newer clang-cl on my machine but I think this patch should fix this problem. Can you check this with your clang-cl version?

fix.patch (1.6 KB)

I did manage to repro the issue and test the build using clang-cl 20.

1 Like

That patch does the trick for me. Thanks Attila!

A fix is now out on develop

1 Like