fix(nix): build kcov in the dev shell on macOS#9681
Open
jaredramirez wants to merge 1 commit into
Open
Conversation
af4569b to
b8c6dfa
Compare
b8c6dfa to
c8ffb09
Compare
c8ffb09 to
62fc94d
Compare
Anton-4
approved these changes
Jun 17, 2026
3d4d2a6 to
b658a07
Compare
`zig build build-ci` builds the custom kcov coverage tool from source on every platform, but the dev shell only provided kcov's link dependencies on Linux, so on macOS the build failed with "unable to find dynamic system library 'z'/'curl'". Provide curl/zlib/pkg-config on all platforms, and on macOS add libdwarf (kcov links it as "dwarf"). kcov resolves system libraries through pkg-config but asks for the module names "z"/"dwarf", which nixpkgs ships as "zlib"/"libdwarf"; add alias .pc files so those resolve (the nix pkg-config wrapper only reads .pc dirs from buildInputs, not an exported PKG_CONFIG_PATH). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b658a07 to
fe81053
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
zig build build-ci(theminiciflow) builds the custom kcov coverage tool from source on every platform, but the dev shell only provided kcov's link dependencies on Linux (++ optionals isLinux kcovBuildDeps). On macOS the build failed:Root cause
kcov links its system libraries via zig's
linkSystemLibrary, which resolves them through pkg-config. nixpkgs ships these as the moduleszlib/libcurl/libdwarf, but kcov asks forz/curl/dwarf.curlhappens to resolve;zanddwarfdo not. The nix pkg-config wrapper only reads.pcdirectories frombuildInputs(viaPKG_CONFIG_PATH_FOR_TARGET), not an exportedPKG_CONFIG_PATH, so the aliases must be real packages.Fix (
src/flake.nix)pkg-config/curl/zlibon all platforms (not just Linux)..pcpackages sopkg-config z→ zlib andpkg-config dwarf→ libdwarf resolve.libdwarf(kcov links it asdwarf); keepelfutilsLinux-only (kcov uses libdw/libelf there).Verification (macOS, inside
nix develop ./src)pkg-config zandpkg-config dwarfboth resolvezig build build-coverage-tools→ exit 0zig build build-ci --summary all --color off→ exit 0, no failures (kcov compiles + installs)🤖 Generated with Claude Code