Skip to content

clang/LLVM for Windows build failures #3581

Open
@walbourn

Description

@walbourn

Describe the bug

Building with clang/LLVM for Windows 15.0.1 fails with the following error on every file:

C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\Llvm\x64\bin\clang-cl.exe   -DCXPLAT_TLS_SECRETS_SUPPORT=1 -DQUIC_DISABLE_CLIENT_CERT_TESTS -DQUIC_EVENTS_STUB -DQUIC_LOGS_STUB -DSECURITY_WIN32 -DVER_BUILD_ID=0 -DVER_SUFFIX=-private -DWIN32_LEAN_AND_MEAN -ID:\vcpkg\buildtrees\ms-quic\src\v1.2.0-19ce393c24.clean\src\inc /nologo /DWIN32 /D_WINDOWS /W3 /utf-8  -m64 /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  -MDd /analyze /W4 /sdl /showIncludes /Fosrc\core\CMakeFiles\core.dir\listener.c.obj /Fdsrc\core\CMakeFiles\core.dir\core.pdb -c -- D:\vcpkg\buildtrees\ms-quic\src\v1.2.0-19ce393c24.clean\src\core\listener.c
clang-cl: error: no such file or directory: '/analyze'; did you mean '/analyze-'?

The problem is that in the CMake files, you are assuming /analyze is supported by all 'MSVC-like' compilers which is not the case.

Change in your three CMake project files:

if (MSVC)
    target_compile_options(core PRIVATE /analyze)
endif()
...
if (MSVC AND (QUIC_TLS STREQUAL "openssl" OR QUIC_TLS STREQUAL "schannel"))
    target_compile_options(platform PRIVATE /analyze)
endif()

to

if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
    target_compile_options(core PRIVATE /analyze)
endif()
...
if ((CMAKE_CXX_COMPILER_ID MATCHES "MSVC") AND (QUIC_TLS STREQUAL "openssl" OR QUIC_TLS STREQUAL "schannel"))
    target_compile_options(platform PRIVATE /analyze)
endif()

Affected OS

  • Windows
  • Linux
  • macOS
  • Other (specify below)

Additional OS information

No response

MsQuic version

release/1.1

Steps taken to reproduce bug

Using clang-cl to build the library with VCPKG. Note it's actually using "v1.2.0" but the issue is present in the mainline as well.

Expected behavior

Should build.

Actual outcome

Fails to build.

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Should be written

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions