Skip to content

Windows CMake build with clang-cl fails on main #240

Open

Description

@RieBi

Summary

The Windows CMake build of gfxstream_backend fails on main with clang-cl. There are two
errors.

Environment

  • Visual Studio 2026 with "C++ Clang tools for Windows" (clang-cl 20).
  • Windows SDK 10.0.26100.
  • cmake -S . -B build -G "Visual Studio 18 2026" -A x64 -T ClangCL
  • cmake --build build --config Release --target gfxstream_backend

Result

  1. common/base/windows/src/time.cpp:
    ws2def.h(246,16): error : redefinition of 'sockaddr' and more redefinitions.
    time.cpp includes <Windows.h> before <sys/time.h>. Windows.h includes the older
    winsock.h. Then sys/time.h includes WinSock2.h, which redefines the same types.
  2. host/vulkan/vk_common_operations.cpp:1948:
    error : cannot pass object of non-trivial type 'const std::string' through variadic function; call will abort at runtime [-Wnon-pod-varargs].
    The code passes getReason(), a std::string, to %s in GFXSTREAM_INFO(). This is
    undefined behavior on all compilers. The code is in an _WIN32 block, so only Windows builds
    compile it.

Expected result

The build completes.

Proposed fix

  1. In time.cpp, include <sys/time.h> before <Windows.h>.
  2. Pass getReason().c_str().

With these two changes, a clean build with default flags completes. PR: #242.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions