Page MenuHomePhabricator

[Nix] Provide c-ares cmake config
ClosedPublic

Authored by jon on Sep 13 2022, 4:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 4, 7:06 PM
Unknown Object (File)
Wed, Nov 27, 3:36 AM
Unknown Object (File)
Wed, Nov 27, 1:14 AM
Unknown Object (File)
Nov 23 2024, 1:38 PM
Unknown Object (File)
Nov 23 2024, 10:49 AM
Unknown Object (File)
Nov 9 2024, 9:26 PM
Unknown Object (File)
Nov 9 2024, 6:24 PM
Unknown Object (File)
Nov 9 2024, 6:15 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
No Lint Coverage
Unit
No Test Coverage

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.