Page MenuHomePhabricator

[Nix] Provide c-ares cmake config
ClosedPublic

Authored by jon on Sep 13 2022, 4:26 PM.
Tags
None
Referenced Files
F3353670: D5128.id16644.diff
Sat, Nov 23, 10:49 AM
Unknown Object (File)
Sat, Nov 9, 9:26 PM
Unknown Object (File)
Sat, Nov 9, 6:24 PM
Unknown Object (File)
Sat, Nov 9, 6:15 PM
Unknown Object (File)
Sat, Nov 9, 3:20 PM
Unknown Object (File)
Sat, Nov 9, 7:21 AM
Unknown Object (File)
Oct 10 2024, 4:16 PM
Unknown Object (File)
Oct 10 2024, 4:16 PM
Subscribers

Details

Reviewers
atul
varun
abosh
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rCOMM264a7f504ba1: [Nix] Provide c-ares cmake config
Summary

Nixpkgs provides just a file, however, this doesn't get picked up
automatically by cmake during the configuration step (e.g. cmake ..).
Installing the file at <store path>/lib/cmake/c-ares/c-ares-config.cmake makes
it readily available.

This fixes the issue where cmake will then try other locations to find the file
which causes it to pick up on other installed packages such as c-ares installed
install through homebrew. Similar to D5106.

Example failures: https://buildkite.com/comm/tunnelbroker-unittests/builds/1#01833852-6772-424a-9e9b-332fe70fce85
Example success with this fix: https://buildkite.com/comm/tunnelbroker-unittests/builds/2#_

Test Plan

Build succeeds: https://buildkite.com/comm/tunnelbroker-unittests/builds/2#_

Or, test locally:

nix develop
cd services/tunnelbroker
rm -rf build && mkdir build && cd build && cmake ..
# should see "-- Found c-ares: /nix/store/.../c-ares-config.cmake (found version "1.18.1")"

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a reviewer: Restricted Owners Package.Sep 13 2022, 4:27 PM

Actually, just use cmake to build c-ares

atul accepted this revision.EditedSep 13 2022, 7:15 PM

Got the following as expected:

-- Found c-ares: /nix/store/1axpb3xdsicc3fcchak26mkblcbsigvg-c-ares-1.18.1/lib/cmake/c-ares/c-ares-config.cmake (found version "1.18.1")

However, no idea what nativeBuildInputs = (o.nativeBuildInputs or []) ++ [ prev.cmake ]; means (I just don't know enough nix), so will defer to the O1: Nix blocking reviewers on that.

This revision is now accepted and ready to land.Sep 13 2022, 11:04 PM

However, no idea what nativeBuildInputs = (o.nativeBuildInputs or []) ++ [ prev.cmake ];

Pretty much, "take the previous nativeBuildInputs, if there are any, and add cmake to it"

This revision was automatically updated to reflect the committed changes.

Just wondering, what do we need c-ares for?

Just wondering, what do we need c-ares for?

We don't directly consume it. But when you do find_package(gRPC), it eventually will look for c-ares as well. Essentially it's a transitive dependency.

This was an attempt in having the cmake "fallback" logic picking up something from homebrew.