Re: cURL 8.6.0 not compiling CentOS 7

Peter Krefting via curl-users <[email protected]>
Newsgroups gmane.comp.web.curl.general
Organization /universe/earth/europe/norway/oslo
Message-ID <[email protected]>
Hi!

> version.c: In function 'curl_version':
> version.c:215:5: error: implicit declaration of function 'psl_check_version_number' [-Werror=implicit-function-declaration]
>     int num = psl_check_version_number(0);
>     ^
> cc1: some warnings being treated as errors
[...]
> Anybody else with CentOS 7 seeing anything similar?

Yes. According to the API documentation [1] the function was added in 
libpsl 0.11.0. CentOS 7 contains version 0.7.0. Before 8.6.0, curl 
used a different API to get the version number.  This was changed in 
commit 72bd88adde0e8cf6e63644a7d6df1da01a399db4.

There is no macros available to check for the version in the libpsl 
version in CentOS 7, but newer versions seem to have them. Using them, 
one can do something like the attached to get it working again on 
CentOS 7. The --version display reverts back to the previous format:

   $ ./src/curl --version
   curl 8.6.0-DEV (x86_64-unknown-linux-gnu) libcurl/8.6.0-DEV OpenSSL/1.0.2k-fips zlib/1.2.7 brotli/1.0.7 zstd/1.5.2 libpsl/0.7.0 (+libicu/50.1.2)

[1] https://rockdaboot.github.io/libpsl/libpsl-Public-Suffix-List-functions.html#psl-check-version-number
-- 
\\// Peter - http://www.softwolves.pp.se/

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
0001-version-Allow-building-with-ancient-libpsl.patch (text/x-diff, 1.1 KB)
From 5b73858b9532d7243265902624e4179287940f59 Mon Sep 17 00:00:00 2001
From: Peter Krefting <[email protected]>
Date: Fri, 2 Feb 2024 23:22:32 +0100
Subject: [PATCH] version: Allow building with ancient libpsl

The psl_check_version_number() API was added in libpsl 0.11.0. CentOS 7
ships with version 0.7.0 which lacks this API. Revert to using the
older versioning API if we detect an old libpsl version.

Fixes: 72bd88adde0e8cf6e63644a7d6df1da01a399db4.
---
 lib/version.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/version.c b/lib/version.c
index 01c2a315e..5766dd709 100644
--- a/lib/version.c
+++ b/lib/version.c
@@ -212,9 +212,13 @@ char *curl_version(void)
 
 #ifdef USE_LIBPSL
   {
+#if defined PSL_VERSION_MAJOR && (PSL_VERSION_MAJOR > 0 || PSL_VERSION_MINOR >= 11)
     int num = psl_check_version_number(0);
     msnprintf(psl_version, sizeof(psl_version), "libpsl/%d.%d.%d",
               num >> 16, (num >> 8) & 0xff, num & 0xff);
+#else
+    msnprintf(psl_version, sizeof(psl_version), "libpsl/%s", psl_get_version());
+#endif
     src[i++] = psl_version;
   }
 #endif
-- 
2.39.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.