Skip to content

Conversation

mstorsjo
Copy link
Member

This fixes building LLDB for mingw with libstdc++, after 8ae30a3.

Previously, building errored out with errors like these:

In file included from llvm-project/lldb/include/lldb/Protocol/MCP/Transport.h:12,
                 from llvm-project/lldb/include/lldb/Protocol/MCP/Server.h:16,
                 from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.h:15,
                 from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp:9:
llvm-project/lldb/include/lldb/Host/JSONTransport.h:608:23: error: field ‘replied’ has incomplete type ‘std::atomic<bool>’
  608 |     std::atomic<bool> replied = {false};
      |                       ^~~~~~~
In file included from gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/bits/shared_ptr_atomic.h:33,
                 from gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/memory:78,
                 from llvm-project/lldb/include/lldb/Host/Socket.h:12,
                 from llvm-project/lldb/include/lldb/Core/ProtocolServer.h:13,
                 from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.h:12:
gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/bits/atomic_base.h:162:12: note: declaration of ‘struct std::atomic<bool>’
  162 |     struct atomic;
      |            ^~~~~~

@mstorsjo mstorsjo requested a review from ashgti October 10, 2025 09:05
@llvmbot llvmbot added the lldb label Oct 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 10, 2025

@llvm/pr-subscribers-lldb

Author: Martin Storsjö (mstorsjo)

Changes

This fixes building LLDB for mingw with libstdc++, after 8ae30a3.

Previously, building errored out with errors like these:

In file included from llvm-project/lldb/include/lldb/Protocol/MCP/Transport.h:12,
                 from llvm-project/lldb/include/lldb/Protocol/MCP/Server.h:16,
                 from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.h:15,
                 from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp:9:
llvm-project/lldb/include/lldb/Host/JSONTransport.h:608:23: error: field ‘replied’ has incomplete type ‘std::atomic&lt;bool&gt;’
  608 |     std::atomic&lt;bool&gt; replied = {false};
      |                       ^~~~~~~
In file included from gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/bits/shared_ptr_atomic.h:33,
                 from gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/memory:78,
                 from llvm-project/lldb/include/lldb/Host/Socket.h:12,
                 from llvm-project/lldb/include/lldb/Core/ProtocolServer.h:13,
                 from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.h:12:
gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/bits/atomic_base.h:162:12: note: declaration of ‘struct std::atomic&lt;bool&gt;’
  162 |     struct atomic;
      |            ^~~~~~

Full diff: https://github.com/llvm/llvm-project/pull/162809.diff

1 Files Affected:

  • (modified) lldb/include/lldb/Host/JSONTransport.h (+1)
diff --git a/lldb/include/lldb/Host/JSONTransport.h b/lldb/include/lldb/Host/JSONTransport.h
index 1453316e96fb4..29b40421575ac 100644
--- a/lldb/include/lldb/Host/JSONTransport.h
+++ b/lldb/include/lldb/Host/JSONTransport.h
@@ -35,6 +35,7 @@
 #include <utility>
 #include <variant>
 #include <vector>
+#include <atomic>
 #if __cplusplus >= 202002L
 #include <concepts>
 #endif

Copy link

github-actions bot commented Oct 10, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

This fixes building LLDB for mingw with libstdc++, after
8ae30a3.

Previously, building errored out with errors like these:

    In file included from llvm-project/lldb/include/lldb/Protocol/MCP/Transport.h:12,
                     from llvm-project/lldb/include/lldb/Protocol/MCP/Server.h:16,
                     from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.h:15,
                     from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp:9:
    llvm-project/lldb/include/lldb/Host/JSONTransport.h:608:23: error: field ‘replied’ has incomplete type ‘std::atomic<bool>’
      608 |     std::atomic<bool> replied = {false};
          |                       ^~~~~~~
    In file included from gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/bits/shared_ptr_atomic.h:33,
                     from gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/memory:78,
                     from llvm-project/lldb/include/lldb/Host/Socket.h:12,
                     from llvm-project/lldb/include/lldb/Core/ProtocolServer.h:13,
                     from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.h:12:
    gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/bits/atomic_base.h:162:12: note: declaration of ‘struct std::atomic<bool>’
      162 |     struct atomic;
          |            ^~~~~~
@mstorsjo mstorsjo force-pushed the lldb-missing-atomic branch from 31bf67e to 8983730 Compare October 10, 2025 09:10
Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the "include what you use" basis, this LGTM.

@mstorsjo mstorsjo merged commit 31d2602 into llvm:main Oct 10, 2025
10 checks passed
@mstorsjo mstorsjo deleted the lldb-missing-atomic branch October 10, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants