Skip to content
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

cpr use system default curl? #1043

Closed
bethebest0622 opened this issue Apr 11, 2024 · 8 comments
Closed

cpr use system default curl? #1043

bethebest0622 opened this issue Apr 11, 2024 · 8 comments

Comments

@bethebest0622
Copy link

bethebest0622 commented Apr 11, 2024

Is your feature request related to a problem?

i am trying to use cpr in centos stream 8, with default curl.

My system curl is 8.2.1.

but without component http and https.

If i dont turn on CPR_USE_SYSTEM_CURL, cpr seems will compile a curl version, which will mess up.

image

Possible Solution

how can i set up cpr without install or complieing a new curl version?

@COM8
Copy link
Member

COM8 commented Apr 13, 2024

I do not really get your question there. What I understand is you want to use cpr with your system curl, but without setting CPR_USE_SYSTEM_CURL?

@bethebest0622
Copy link
Author

bethebest0622 commented Apr 13, 2024

I use CPR_USE_SYSTEM_CURL, but error was: system curl no component http https found, use system curl failed.

And i cant use the download version, so CPR_USE_SYSTEM_CURL is a must for me

@COM8
Copy link
Member

COM8 commented Apr 13, 2024

Ah, then curl on your system is not properly configured to include the http and https components. How did you install libcurl on your system?

@COM8
Copy link
Member

COM8 commented Apr 13, 2024

Did you install libcurl-devel?

@bethebest0622
Copy link
Author

yes, i do, i used centos stream 8

@COM8
Copy link
Member

COM8 commented Apr 18, 2024

What I did:

podman run -i -t quay.io/centos/centos:stream8 /bin/bash

To get a docker container with centos8 stream.

Then I build cpr and got the same error as you.

git clone https://github.com/libcpr/cpr.git
cd cpr
mkdir build && cd build
dnf install -y gcc clang cmake gdb git libcurl-devel openssl-devel
cmake .. -DCMAKE_BUILD_TYPE=Release -DCPR_USE_SYSTEM_CURL=ON -DCPR_BUILD_TESTS=ON -DCPR_BUILD_TESTS_SSL=ON -DCPR_ENABLE_SSL=ON

But this one can be fixed with the following patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5af3657..d41271c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -173,7 +173,7 @@ endif()
 # Curl configuration
 if(CPR_USE_SYSTEM_CURL)
     if(CPR_ENABLE_SSL)
-        find_package(CURL COMPONENTS HTTP HTTPS)
+        find_package(CURL)
         if(CURL_FOUND)
             message(STATUS "Curl ${CURL_VERSION_STRING} found on this system.")
             # To be able to load certificates under Windows when using OpenSSL:

This patch should work since I still had an too old version of curl installed (7.61.1).

@COM8
Copy link
Member

COM8 commented Apr 18, 2024

Just make sure curl-config --protocols supports HTTP and HTTPS

@COM8
Copy link
Member

COM8 commented May 15, 2024

Closing for no response.

@COM8 COM8 closed this as completed May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants