Skip to content

CMAKE_USE_SYSTEM_CURL builds broken by latest curl

In the build sequences for some of my docker containers, I rebuild cmake after building curl from source and then rebuild cmake from sourcewith CMAKE_USE_SYSTEM_CURL to pick up that curl.

I now see I get errors:

#14 65.84 /usr/bin/c++ -DLIBARCHIVE_STATIC -I/home/****/.local_bld/cmake-3.31.5/Source -I/home/****/.local_bld/cmake-3.31.5/Source/LexerParser -isystem /home/****/.local_bld/cmake-3.31.5/Utilities/std -isystem /home/****/.local_bld/cmake-3.31.5/Utilities -std=c++17 -MD -MT Source/CMakeFiles/CMakeLib.dir/cmCurl.cxx.o -MF Source/CMakeFiles/CMakeLib.dir/cmCurl.cxx.o.d -o Source/CMakeFiles/CMakeLib.dir/cmCurl.cxx.o -c /home/****/.local_bld/cmake-3.31.5/Source/cmCurl.cxx
#14 65.84 In file included from /home/****/.local_bld/cmake-3.31.5/Utilities/cm3p/curl/curl.h:8,
#14 65.84                  from /home/****/.local_bld/cmake-3.31.5/Source/cmCurl.h:12,
#14 65.84                  from /home/****/.local_bld/cmake-3.31.5/Source/cmCurl.cxx:3:
#14 65.84 /home/****/.local_bld/cmake-3.31.5/Source/cmCurl.cxx: In function ‘std::string cmCurlSetNETRCOption(CURL*, const std::string&, const std::string&)’:
#14 65.84 /home/****/.local_bld/cmake-3.31.5/Source/cmCurl.cxx:178:26: error: invalid conversion from ‘long int’ to ‘CURL_NETRC_OPTION’ [-fpermissive]
#14 65.84   178 |       curl_netrc_level = CURL_NETRC_OPTIONAL;
#14 65.84       |                          ^~~~~~~~~~~~~~~~~~~
#14 65.84       |                          |
#14 65.84       |                          long int
#14 65.84 /home/****/.local_bld/cmake-3.31.5/Source/cmCurl.cxx:180:26: error: invalid conversion from ‘long int’ to ‘CURL_NETRC_OPTION’ [-fpermissive]
#14 65.84   180 |       curl_netrc_level = CURL_NETRC_REQUIRED;
#14 65.84       |                          ^~~~~~~~~~~~~~~~~~~
#14 65.84       |                          |
#14 65.84       |                          long int
#14 65.84 /home/****/.local_bld/cmake-3.31.5/Source/cmCurl.cxx:182:26: error: invalid conversion from ‘long int’ to ‘CURL_NETRC_OPTION’ [-fpermissive]
#14 65.84   182 |       curl_netrc_level = CURL_NETRC_IGNORED;
#14 65.84       |                          ^~~~~~~~~~~~~~~~~~
#14 65.84       |                          |
#14 65.84       |                          long int

As far as I can tell the issue is https://github.com/curl/curl/pull/16482 and is a deliberate change in libcurl. The curl ticket mentions "reduce the risk that this breaks the compile for any existing user" but they obviously acknowledge there may be issues. This seems to be done of them.

I would suggest casting the enums to curl_netrc_level.

Edited by John Forrest
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information