Skip to content

Update dd-trace-cpp#45

Merged
xlamorlette-datadog merged 4 commits intomainfrom
xlamorlette/update-dd-trace-cpp
Mar 24, 2026
Merged

Update dd-trace-cpp#45
xlamorlette-datadog merged 4 commits intomainfrom
xlamorlette/update-dd-trace-cpp

Conversation

@xlamorlette-datadog
Copy link
Copy Markdown
Contributor

@xlamorlette-datadog xlamorlette-datadog commented Mar 18, 2026

It was needed to update dd-trace-cpp because the local build was failing because of a too old version of nlohmann/json.

Details About the Old nlohmann/json Dependency Issue

We got:

cmake -B build -DCMAKE_BUILD_TYPE=Release -DHTTPD_SRC_DIR=httpd .
[…]
CMake Error at build/_deps/json-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

This came from deps/dd-trace-cpp/cmake/deps/json.cmake:

  URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz

which was actually incoherent with deps/dd-trace-cpp/src/datadog/json.hpp:

// |  |  |__   |  |  | | | |  version 3.12.0

Tricky Technical Change for Linking dd-trace-cpp

In October 2025, dd-trace-cpp introduced the following building change, line 229 of CMakeLists.txt:

set_target_properties(dd-trace-cpp-objects
  PROPERTIES
    VERIFY_INTERFACE_HEADER_SETS ON
    POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}
)

This makes POSITION_INDEPENDENT_CODE on only when building a shared lib.
But in the Apache plugin, we use the static library that gets linked into mod_datadog.so, which is loaded via dlopen. And any object file that ends up in .so file loaded via dlopen must be compiled with -fPIC, even when going through a static library intermediary. (Else, we get a linker error because initial-exec TLS relocation are incompatible with dlopen.)
This is fixed by overriding POSITION_INDEPENDENT_CODE after add_subdirectory(dd-trace-cpp) in deps/CMakeLists.txt.

@xlamorlette-datadog xlamorlette-datadog force-pushed the xlamorlette/update-dd-trace-cpp branch from 8a38a94 to 7aa30f1 Compare March 18, 2026 16:09
@xlamorlette-datadog xlamorlette-datadog force-pushed the xlamorlette/update-dd-trace-cpp branch from d398f82 to ace1f1b Compare March 19, 2026 09:27
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.12%. Comparing base (43b48ff) to head (bf29d88).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #45   +/-   ##
=======================================
  Coverage   63.12%   63.12%           
=======================================
  Files           7        7           
  Lines         377      377           
  Branches       49       49           
=======================================
  Hits          238      238           
  Misses        101      101           
  Partials       38       38           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xlamorlette-datadog xlamorlette-datadog force-pushed the xlamorlette/update-dd-trace-cpp branch from ace1f1b to 1713b63 Compare March 19, 2026 09:56
@xlamorlette-datadog xlamorlette-datadog marked this pull request as ready for review March 23, 2026 17:50
@xlamorlette-datadog xlamorlette-datadog requested a review from a team as a code owner March 23, 2026 17:50
@xlamorlette-datadog xlamorlette-datadog requested review from dubloom and removed request for a team March 23, 2026 17:50
@pawelchcki pawelchcki self-requested a review March 24, 2026 12:28
@xlamorlette-datadog xlamorlette-datadog merged commit 62ed0d8 into main Mar 24, 2026
10 checks passed
@xlamorlette-datadog xlamorlette-datadog deleted the xlamorlette/update-dd-trace-cpp branch March 24, 2026 16:28
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.

4 participants