Skip to content

fix(Net): Add POCO_HAS_UNIX_SOCKET guards to fix build without Unix sockets #5064#5089

Merged
matejk merged 1 commit intomainfrom
fix/5064-unix-socket-build
Dec 16, 2025
Merged

fix(Net): Add POCO_HAS_UNIX_SOCKET guards to fix build without Unix sockets #5064#5089
matejk merged 1 commit intomainfrom
fix/5064-unix-socket-build

Conversation

@matejk
Copy link
Copy Markdown
Contributor

@matejk matejk commented Dec 15, 2025

Summary

When POCO_HAS_UNIX_SOCKET is not defined (e.g., older Windows SDKs lacking afunix.h, or when POCO_NET_NO_UNIX_SOCKET is explicitly defined), the build failed because:

  • HTTPSession::connect() referenced SocketAddress::UNIX_LOCAL
  • SocketAddress::init() called newLocal() which is only declared when POCO_HAS_UNIX_SOCKET is defined
  • WebSocketImpl constructor referenced SocketAddress::UNIX_LOCAL

Changes

  1. Net/src/HTTPSession.cpp - Added #if defined(POCO_HAS_UNIX_SOCKET) guard around UNIX_LOCAL check
  2. Net/src/SocketAddress.cpp - Added guard around isUnixLocal() and newLocal() call
  3. Net/src/WebSocketImpl.cpp - Added guard around UNIX_LOCAL check
  4. Net/include/Poco/Net/SocketDefs.h - Use POCO_HAVE_CPP17_COMPILER macro instead of direct __cplusplus >= 201703L check for consistency
  5. Data/ODBC/include/Poco/Data/ODBC/ODBC.h - Same consistency improvement
  6. Foundation/include/Poco/Platform_POSIX.h - Simplified thread-safe local static init check since POCO requires C++17 (which guarantees this since C++11)

Closes #5064

@matejk matejk force-pushed the fix/5064-unix-socket-build branch from 916e690 to 220ed54 Compare December 15, 2025 20:45
@matejk
Copy link
Copy Markdown
Contributor Author

matejk commented Dec 15, 2025

Updated: Changed item 6 - instead of simplifying the POCO_LOCAL_STATIC_INIT_IS_THREADSAFE macro check, the entire macro has been removed as it is dead code (defined but never used anywhere in the codebase). Thread-safe local static initialization is guaranteed since C++11.

@matejk matejk merged commit 227f84f into main Dec 16, 2025
80 checks passed
@matejk matejk deleted the fix/5064-unix-socket-build branch December 16, 2025 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Net: Build fails when POCO_HAS_UNIX_SOCKET is not defined

1 participant