-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: improve c-ares version extraction method #2480
Conversation
191667e
to
9a80252
Compare
Out of curiosity, what happens if you just remove your Findc-ares.cmake completely? c-ares distributes both package config and cmake files when it is installed. And the default cmake FindPackage(c-ares) should automatically set c_ares_VERSION (as well as c_ares_VERSION_MAJOR, c_ares_VERSION_MINOR, and c_ares_VERSION_PATCH). |
@bradh352 hi Brad, it depends. on my fedora 41 box, if i remove this file, $ rpm -ql c-ares-devel | grep cmake
/usr/lib64/cmake/c-ares
/usr/lib64/cmake/c-ares/c-ares-config-version.cmake
/usr/lib64/cmake/c-ares/c-ares-config.cmake
/usr/lib64/cmake/c-ares/c-ares-targets-noconfig.cmake
/usr/lib64/cmake/c-ares/c-ares-targets.cmake but unfortunately, the latest debian stable release (bookworm) still does not package them, see https://debian.pkgs.org/12/debian-main-amd64/libc-ares-dev_1.18.1-3_amd64.deb.html .
thank you for the excellent CMake integration. but before the popular distros include these files, i think we should at least fall back to searching c-ares in the module mode. even if we can use these two modes when searching for c-ares, i still want to avoid the workaround like seastar/cmake/SeastarDependencies.cmake Lines 154 to 168 in 54e25a9
find_package() without worrying about which mode it uses.
so, IMHO, a simpler approach before debian stable's libc-ares-dev includes the CMake config files is still to keep thank you for pointing this out. i created #2485 to track this cleanup. |
this change enhances the version extraction process to handle both literal and macro-based version definitions in c-ares. in 5d53fb6, we extract the c-ares version by looking for `ARES_VERSION_STR` and matching the version numbers in it. as, in c-ares 1.32, the line looks like: ```c #define ARES_VERSION_STR "1.33.0" ``` but this method fails for c-ares 1.33+ due to non-literal `ARES_VERSION_STR` definitionin. as in c-ares 1.33+, it looks like ```c #define ARES_VERSION_STR \ ARES_STRINGIFY(ARES_VERSION_MAJOR) \ "." ARES_STRINGIFY(ARES_VERSION_MINOR) "." ARES_STRINGIFY(ARES_VERSION_PATCH) ``` this fails the parser. and the version number is always empty. in this change, we match the MAJOR, MINOR and PATCH version components separately. this approach increases resilience. after this change, Seastar is able to detect the versions of both c-ares 1.32 and 1.33. Refs 5d53fb6 Signed-off-by: Kefu Chai <[email protected]>
9a80252
to
e6b3de4
Compare
@gjasny since you maintain the debian packaging of c-ares can you look into distributing the cmake files for c-ares on debian? I guess they're missing. |
The version detection should also happen at runtime, not compile time. At least in Debian your scylladb package won’t get recompiled for a new c-ares package and also older c-ares Debian packages might satisfy the deb package dependency. Edit: if it’s only the missing header that blocks support, compile time looks right. |
hi Gregor , thank you for your comment. my concern is to enable users to build seastar from source on popular distributions, instead of enabling them to use precompiled seastar package like but in the case above, since
ahh, you are talking about "libseastar-dev" then. this package does not exist yet. so...
|
@scylladb/seastar-maint hello maintainers, could you help review this change? |
this change enhances the version extraction process to handle both literal and macro-based version definitions in c-ares.
in 5d53fb6, we extract the c-ares version by looking for
ARES_VERSION_STR
and matching the version numbers in it. as, in c-ares 1.32, the line looks like:but this method fails for c-ares 1.33+ due to non-literal
ARES_VERSION_STR
definitionin. as in c-ares 1.33+, it looks likethis fails the parser. and the version number is always empty.
in this change, we match the MAJOR, MINOR and PATCH version components separately. this approach increases resilience. after this change, Seastar is able to detect the versions of both c-ares 1.32 and 1.33.
Refs 5d53fb6
Signed-off-by: Kefu Chai [email protected]