Open gholmann16 opened 2 years ago
@TheAssassin
It seems to me like the libcurl version of Ubuntu 14.04 is propably to old. You can try to use a fetch content curl instead
My guess is CMake's FindCURL.cmake
is reporting things incorrectly there. Even though libcurl provides HTTP/HTTPS support, CMake's built-in check doesn't report this, even though compilation would succeed.
It seems to me like the libcurl version of Ubuntu 14.04 is propably to old. You can try to use a fetch content curl instead
I tried building it previously and that did not solve it
My guess is CMake's FindCURL.cmake is reporting things incorrectly there. Even though libcurl provides HTTP/HTTPS support, CMake's built-in check doesn't report this, even though compilation would succeed.
I do think this is definitely a cmake error, because the curl command is functioning for http links and reporting that it has http functionality.
I am getting the same error when trying to build cpr, in windows 10, using g++ 12.2.0 and cmake 3.23.1, I tried both building curl from source and getting libcurl from msys2 via pacman -S libcurl-devel
, but to no avail.
I then tried to use both cmake and make downloaded from msys2, this time cmake was able to create build files, but when trying to compile, i got fd_set and associated macros have been defined in sys/types. This can cause runtime problems with W32 sockets
, and then a compilation error, I am assuming because there is a collision between msys2's headers and windows's
This has got nothing to do with headers. Look at the CMake module's code https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindCURL.cmake (or better check your local version, modules get updated every now and then).
The workflow is easy to understand. First, CMake needs to find the library:
CURLConfig.cmake
(as far as I can see not available and therefore not used on Ubuntu, unlike FindCURL.cmake
this file would be part of a cURL distribution and not CMake)Assuming the package has been found in some way, it checks for the components. If pkg-config is used, it'll use its information, otherwise it will use curl-config
to check for the protocols.
This last check is unreliable if the information fed into it is incomplete or incorrect for obvious reasons. Hence, my workaround in some places is to just delete the pkg-config file and have it fall back to curl-config
, which is built along with the cURL code and therefore should be correct (the pkg-config file might be maintainer-provided and possibly outdated).
I get Could NOT find CURL (missing: HTTP) (found version "7.80.0")
.
Any update?
I get
Could NOT find CURL (missing: HTTP) (found version "7.80.0")
. Any update?
I fixed this issue by uninstalling currently installed curl (not sure if this is really required), then installing the latest curl from the tarball from https://github.com/curl/curl/releases, afther which i then installed cpr with -DCPR_USE_SYSTEM_CURL=ON
Hope it works for you.
I fixed this issue by uninstalling currently installed curl (not sure if this is really required), then installing the latest curl from the tarball from https://github.com/curl/curl/releases, afther which i then installed cpr with -DCPR_USE_SYSTEM_CURL=ON
Please beware that you shouldn't just install libraries from random places on productive systems.
The easiest workaround is shown here, which I already explained in my last comment. By deleting the pkg-config files from the build system (I wouldn't necessarily recommend this on a productive/development system), CMake will use curl-config
, which works as expected.
Someone needs to report this bug upstream with CMake. This is not a bug in CPR.
Description
When trying to compile cpr on Ubuntu 14.04 I run into the error that your CMake file cannot properly detect the supported protocols of libcurl. I know for sure that libcurl supports http due to a quick curl-config:
But the cmake fails to detect it ending with this error:
When I asked the same question over on this thread: https://github.com/AppImage/AppImageUpdate/issues/210 , I was recomended to manually edit my /usr/lib/x86_64-linux-gnu/pkgconfig/libcurl.pc file and to make sure HTTP was supported as so:
supported_protocols="DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS LDAP LDAPS MQTT POP3 POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP"
But even upon doing so I still got the same error.
Expected Behavior
Seeing as I have the latest cmake and all necessary libraries as far as I know, it should be compiling normally, and yet it does not.
Actual Behavior
Fails to compile, gives error I pasted above.
Possible Fix
Wave check in CMake? This is a horrible fix but it might be necessary.
Steps to Reproduce
Context
In order to be backwards compatible on linux, you must compile on an older distribution than the one you want to support. So if I wanted to support Ubuntu 14.04 and up, that means I must compile my program on Ubuntu 14.04. One of my dependencies is AppImageUpdate (https://github.com/AppImage/AppImageUpdate), which relies on libcpr. While attempting to compile that I got this error.
Your Environment