[PROF-7056] Remove dependency on pkg-config system tool for native extension builds#5469
Conversation
…extension builds
**What does this PR do?**
This PR removes the dependency on the `pkg-config` system tool when
building the native extensions that link to libdatadog.
Previously, we used mkmf's `pkg_config("datadog_profiling_with_rpath")`
which shells out to the `pkg-config` binary to discover include paths,
library paths, and linker flags from libdatadog's `.pc` file.
Now, we directly set the mkmf global variables (`$INCFLAGS`, `$LDFLAGS`,
`$libs`) with the paths computed from `Libdatadog.pkgconfig_folder`,
which we already have access to via the libdatadog gem.
**Motivation:**
The `pkg-config` tool has been a recurring source of support issues
(see JIRA tickets). Customers on minimal Docker images, certain CI
environments, or systems where pkg-config is misconfigured would hit
cryptic build failures during gem installation.
Since we control both dd-trace-rb and libdatadog, we know the exact
directory structure and don't need pkg-config's generic discovery
mechanism. This is one less external dependency we don't have control
over.
**Change log entry**
Yes. Core: Remove dependency on `pkg-config` system tool for native extension builds.
**Additional Notes:**
The generated Makefile is identical to the previous pkg-config approach.
**How to test the change?**
Green CI is good, as usual.
Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 2d3f84a | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
…g helper This consolidates all libdatadog linkage configuration into the `configure_libdatadog` helper method, reducing code duplication between the two extconf.rb files. Also renames `current_folder:` parameter to `extconf_folder:` for clarity, and adds `gem_dir:` parameter for testability. Co-Authored-By: Claude Opus 4.5 <[email protected]>
BenchmarksBenchmark execution time: 2026-03-18 11:34:34 Comparing candidate commit 2d3f84a in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 0 unstable metrics.
|
|
I forgot to add in the PR description that this is a bit fiddly, but in practice, if it's wrong, we should see it fail loudly (from e.g. the extension not building) so if tests are passing we should be good to go + we have existing support to gracefully handle failures in compilation so worst case we have a backstop here to not impact customers. |
I don't think it's that fiddly, I've been using plain paths in libv8-node (and libv8 before it) and it's been perfectly fine for what, over half a decade? |
As of version [2.30.0](https://github.com/DataDog/dd-trace-rb/releases/tag/v2.30.0) of the Ruby library, we've [removed the need for the pkg-config tool](DataDog/dd-trace-rb#5469).
As of version [2.30.0](https://github.com/DataDog/dd-trace-rb/releases/tag/v2.30.0) of the Ruby library, we've [removed the need for the pkg-config tool](DataDog/dd-trace-rb#5469). Co-authored-by: jeff-morgan-dd <[email protected]>
As of version [2.30.0](https://github.com/DataDog/dd-trace-rb/releases/tag/v2.30.0) of the Ruby library, we've [removed the need for the pkg-config tool](DataDog/dd-trace-rb#5469). Co-authored-by: jeff-morgan-dd <[email protected]>
What does this PR do?
This PR removes the dependency on the
pkg-configsystem tool when building the native extensions that link to libdatadog.Previously, we used mkmf's
pkg_config("datadog_profiling_with_rpath")which shells out to thepkg-configbinary to discover include paths, library paths, and linker flags from libdatadog's.pcfile.Now, we directly set the mkmf global variables (
$INCFLAGS,$LDFLAGS,$libs) with the paths computed fromLibdatadog.pkgconfig_folder, which we already have access to via the libdatadog gem.Motivation:
The
pkg-configtool has been a recurring source of support issues (see JIRA tickets). Customers on minimal Docker images, certain CI environments, or systems where pkg-config is misconfigured would hit cryptic build failures during gem installation.Since we control both dd-trace-rb and libdatadog, we know the exact directory structure and don't need pkg-config's generic discovery mechanism. This is one less external dependency we don't have control over.
Change log entry
Yes. Core: Remove dependency on
pkg-configsystem tool for native extension builds.Additional Notes:
The generated Makefile is identical to the previous pkg-config approach.
How to test the change?
Green CI is good, as usual.