Skip to content

build: fix iOS/macOS C-linkage on HCWebSocketOptions; Android compileSdk 34; Linux WSC dl/pthread; UWP ARM64; GDK asio#987

Merged
v-patrickpe merged 2 commits into
mainfrom
user/v-patrickpe/android-sdk34-uwp-arm64-linux-dl
Jun 5, 2026
Merged

build: fix iOS/macOS C-linkage on HCWebSocketOptions; Android compileSdk 34; Linux WSC dl/pthread; UWP ARM64; GDK asio#987
v-patrickpe merged 2 commits into
mainfrom
user/v-patrickpe/android-sdk34-uwp-arm64-linux-dl

Conversation

@v-patrickpe
Copy link
Copy Markdown
Contributor

Resubmitted from a branch in microsoft/libHttpClient (was #985 from a fork) so ADO CI (libHttpClient.CI.yml) can auto-trigger. Same commits (8c4efc0 + 2817f2e); #985 will be closed in favor of this PR.

Summary

Fixes 4 build regressions and 1 latent GDK build hazard surfaced by PlayFab.SDKs.All TestDrop build 148660743. TestDrop runs with checkoutSubmodulesAsLatestCommit: true, so it builds libHttpClient main HEAD against PlayFab.SDKs.All's iOS/macOS/Linux/GDK toolchains — exposing platform regressions that this repo's MSVC-only PR CI does not catch.

Why these weren't caught upstream

libHttpClient libHttpClient.CI.yml builds primarily on MSVC/Windows. clang -Wreturn-type-c-linkage (Xcode iOS/macOS) and the Linux WebSocketCompressionTests link (-ldl -lpthread) never gated PR #965. Captured as follow-up: AB#62563305.

Commits

8c4efc0 — Android compileSdk 34 + UWP ARM64 warning + Linux WSC dl libs

  • Build/libHttpClient.Android/build.gradle — compileSdk → 34 — AB#62563300
  • Build/libHttpClient.Linux/CMakeLists.txt — add dl pthread to WSC test link — AB#61359145
  • Samples/UWP-Http/Http.vcxproj — ARM64 -W4/-Werror suppression — AB#62563301

2817f2e — iOS/macOS extern C++ wrap; GDK asio serial-port disable

  • Include/httpClient/httpClient.h (line 1046) — wrap DEFINE_ENUM_FLAG_OPERATORS(HCWebSocketOptions) in extern ""C++"" { } so the C++ operator overloads aren't inside the file-wide extern ""C"" block (clang -Wreturn-type-c-linkage -Werror reject) — AB#62563298
  • Build/libHttpClient.GDK.props — add ASIO_DISABLE_SERIAL_PORT to PreprocessorDefinitions; GDK NOSERIALCOMM removes DCB which breaks asio's win_iocp_serial_port_service (pulled in via websocketpp) — AB#62563299

Repro (iOS/macOS)

httpClient.h:1046:1: error: 'operator|=' has C-linkage specified, but
  returns user-defined type 'HCWebSocketOptions &' which is incompatible
  with C [-Werror,-Wreturn-type-c-linkage]

Introduced by #965 (b19d186) placing the macro inside the file-wide extern ""C"" { (opened L24, closed L1496). MSVC and gcc tolerate it; clang -Werror does not. Minimal fix preserves C linkage for the entire public API surface and only flips to C++ for the 1-line macro expansion.

Risk

  • extern ""C++"" around a macro is standard C++; supported by MSVC/clang/gcc. No ABI impact — operator overloads were never callable from C.
  • ASIO_DISABLE_SERIAL_PORT only removes a transport we never use. No runtime behavior change. asio config knob at External/asio/asio/include/asio/detail/config.hpp:1066-1080.

Validation

Pre-merge validated via PFSDKAll TestDrop build 148684233 (with this tip pinned as the libHttpClient submodule). All 4 in-scope fixes confirmed:

  • iOS/macOS operator-linkage — Xcode jobs green
  • Linux WSC dl pthread — libHttpClient static builds clean
  • GDK ASIO_DISABLE_SERIAL_PORT — applies; full GDK still blocked separately on NuGet feed gap
  • Android compileSdk 34 / UWP ARM64 — assemble paths reached

Related ADO work items

  • AB#62563298 — iOS/macOS HCWebSocketOptions C-linkage
  • AB#62563299 — GDK asio NOSERIALCOMM/DCB
  • AB#62563300 — Android compileSdk 34
  • AB#62563301 — UWP ARM64 warning
  • AB#61359145 — Linux WSC dl/pthread (Raul)
  • AB#62563305 — Follow-up: libHttpClient CI gate-job gap

v-patrickpe and others added 2 commits May 28, 2026 16:32
…libs

Bundles three independent low-risk additions:

Build/libHttpClient.Android/build.gradle
  Bumps `compileSdkVersion` from 31 to 34. Required by downstream
  consumers (Bumblelion) being upgraded to current AGP/Gradle. SDK
  bump only - no runtime API change.

Samples/UWP-Http/Http.vcxproj
  Suppresses `TreatWarningAsError` for `Release|ARM64` to unblock
  ARM64 sample builds while a separate cleanup of the underlying
  warning is pursued.

Build/libHttpClient.Linux/CMakeLists.txt
  Adds `\` to the `WebSocketCompressionTests.Linux`
  target_link_libraries so the test binary links cleanly. The
  WebSocket Compression support (#965) addition introduced an
  unresolved `dlopen`/`dlsym` reference via linked crypto in some
  agent configurations. This surfaced in downstream consumer pipeline
  PlayFab.SDKs.All TestDrop (Microsoft ADO def 137186) on 2026-05-28
  after Linux clang/dpkg fixes unblocked the prior failure mode.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rial-port on GDK

Fixes two regressions surfaced by PlayFab.SDKs.All TestDrop run 148660743
against latest libHttpClient main (post #965 WebSocket Compression):

1) Include/httpClient/httpClient.h
   DEFINE_ENUM_FLAG_OPERATORS(HCWebSocketOptions) was placed inside the
   file-wide extern `"C"` block. The macro expands to inline operators
   returning HCWebSocketOptions&, which clang rejects under
   -Wreturn-type-c-linkage -Werror on Xcode iOS/macOS builds:

     error: 'operator|=' has C-linkage specified, but returns user-defined
     type 'HCWebSocketOptions &' which is incompatible with C

   Wrap only the macro call in extern `"C++"` so the operators get C++
   linkage while the rest of the public surface stays C-linked.

2) Build/libHttpClient.GDK.props
   GDK builds compile with NOSERIALCOMM (no DCB struct), but asio (pulled
   in via websocketpp) tries to instantiate win_iocp_serial_port_service.
   Add ASIO_DISABLE_SERIAL_PORT to the GDK PreprocessorDefinitions; we
   never use asio's serial-port transport.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread Build/libHttpClient.GDK.props
Comment thread Samples/UWP-Http/Http.vcxproj
@v-patrickpe v-patrickpe merged commit e79302c into main Jun 5, 2026
19 checks passed
@v-patrickpe v-patrickpe deleted the user/v-patrickpe/android-sdk34-uwp-arm64-linux-dl branch June 5, 2026 00:00
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.

2 participants