Skip to content

block/curl.c uses curl features deprecated in curl 7.55.0 and 7.85.0

Report from IRC from a user compiling QEMU on Archlinux, which has a pretty new libcurl.

QEMU's block/curl.c uses a couple of options which have been deprecated in newer libcurl; this results in compile time warnings from -Wdeprecated-declarations, which in turn means a compile failure unless you turn off -Werror.

We should put in codepaths to use the newer alternatives. (At some point newer Fedora etc will get this libcurl and we'll see the problem there too.)

The offending options are:

  • CURLINFO_CONTENT_LENGTH_DOWNLOAD, deprecated since curl 7.55.0 (replacement: CURLINFO_CONTENT_LENGTH_DOWNLOAD_T)
  • CURLOPT_PROTOCOLS, deprecated since curl 7.85.0 (replacement: CURLOPT_PROTOCOLS_STR)
  • CURLOPT_REDIR_PROTOCOLS, deprecated since curl 7.85.0 (replacement: CURLOPT_REDIR_PROTOCOLS_STR)

Full compiler warning barf:

../../src/qemu/block/curl.c: In function ‘curl_init_state’:
../../src/qemu/block/curl.c:515:9: error: ‘CURLOPT_PROTOCOLS’ is deprecated: since 7.85.0. Use CURLOPT_PROTOCOLS_STR [-Werror=deprecated-declarations]
   515 |         if (curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, PROTOCOLS) ||
       |         ^~
In file included from ../../src/qemu/block/curl.c:34:
/usr/include/curl/curl.h:1749:3: note: declared here
  1749 |   CURLOPTDEPRECATED(CURLOPT_PROTOCOLS, CURLOPTTYPE_LONG, 181,
       |   ^~~~~~~~~~~~~~~~~
../../src/qemu/block/curl.c:516:13: error: ‘CURLOPT_REDIR_PROTOCOLS’ is deprecated: since 7.85.0. Use CURLOPT_REDIR_PROTOCOLS_STR [-Werror=deprecated-declarations]
   516 |             curl_easy_setopt(state->curl, CURLOPT_REDIR_PROTOCOLS, PROTOCOLS)) {
       |             ^~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:1755:3: note: declared here
  1755 |   CURLOPTDEPRECATED(CURLOPT_REDIR_PROTOCOLS, CURLOPTTYPE_LONG, 182,
       |   ^~~~~~~~~~~~~~~~~
../../src/qemu/block/curl.c: In function ‘curl_open’:
../../src/qemu/block/curl.c:799:5: error: ‘CURLINFO_CONTENT_LENGTH_DOWNLOAD’ is deprecated: since 7.55.0. Use CURLINFO_CONTENT_LENGTH_DOWNLOAD_T [-Werror=deprecated-declarations]
   799 |     if (curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d)) {
       |     ^~
/usr/include/curl/curl.h:2853:3: note: declared here
  2853 |   CURLINFO_CONTENT_LENGTH_DOWNLOAD
       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Edited by Peter Maydell
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information