libcpr / cpr

C++ Requests: Curl for People, a spiritual port of Python Requests.
https://docs.libcpr.org/
Other
6.49k stars 924 forks source link

1.10.x+ Install fails with CURL_PROGRESSFUNC_CONTINUE was not declared when CPR_USE_SYSTEM_CURL=ON is used #932

Closed motlaghreyhan closed 9 months ago

motlaghreyhan commented 1 year ago

Description

Installation fails at cmake build with the error listed below on 2 separate Rocky 8 machines.

I've tried to use 1.9.x but CPR_USE_SYSTEM_CURL doesn't appear to exist in that version, which provides the CMake files I need according to this https://github.com/offa/influxdb-cxx/issues/200#issuecomment-1587586390

cmake --build .
Scanning dependencies of target cpr
[  3%] Building CXX object cpr/CMakeFiles/cpr.dir/accept_encoding.cpp.o
[  6%] Building CXX object cpr/CMakeFiles/cpr.dir/async.cpp.o
In file included from /opt/cpr/cpr/include/cpr/ssl_options.h:11,
                 from /opt/cpr/cpr/include/cpr/response.h:15,
                 from /opt/cpr/cpr/include/cpr/async_wrapper.h:8,
                 from /opt/cpr/cpr/include/cpr/async.h:4,
                 from /opt/cpr/cpr/cpr/async.cpp:1:
/opt/cpr/cpr/include/cpr/util.h: In function ‘int cpr::util::progressUserFunction(const T*, cpr::cpr_pf_arg_t, cpr::cpr_pf_arg_t, cpr::cpr_pf_arg_t, cpr::cpr_pf_arg_t)’:
/opt/cpr/cpr/include/cpr/util.h:26:36: error: ‘CURL_PROGRESSFUNC_CONTINUE’ was not declared in this scope
     static_assert(cancel_retval != CURL_PROGRESSFUNC_CONTINUE);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/cpr/cpr/include/cpr/util.h:26:36: note: suggested alternative: ‘CURLOPT_PROGRESSFUNCTION’
     static_assert(cancel_retval != CURL_PROGRESSFUNC_CONTINUE);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                    CURLOPT_PROGRESSFUNCTION
gmake[2]: *** [cpr/CMakeFiles/cpr.dir/build.make:96: cpr/CMakeFiles/cpr.dir/async.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:135: cpr/CMakeFiles/cpr.dir/all] Error 2
gmake: *** [Makefile:150: all] Error 2

Example/How to Reproduce

  1. git clone https://github.com/libcpr/cpr.git (also occurs with --branch=1.10.x as well)
  2. cd cpr && mkdir build && cd build
  3. cmake .. -DCPR_USE_SYSTEM_CURL=ON
  4. cmake --build .

Possible Fix

No response

Where did you get it from?

GitHub (branch e.g. master)

Additional Context/Your Environment

COM8 commented 1 year ago

@motlaghreyhan Thanks for reporting! As mentioned here, cpr 1.9.x supports CPR_USE_SYSTEM_CURL: https://github.com/libcpr/cpr/blob/a814567a98ab0ff70224ac9e37d71839c0738544/CMakeLists.txt#L40

It looks like CURL_PROGRESSFUNC_CONTINUE got removed in your version of libcurl since on the curl page it states: "Deprecated since 7.32.0."

I will look into this further ~at the end of the month after my vacation.

motlaghreyhan commented 1 year ago

Thanks for the help! I was able to build 1.9.x on rhel8 with that flag no problem. influx-cxx seems to work with 1.9.x for me, so I'm in no rush for this issue at this point.

COM8 commented 1 year ago

Short update from my side. I can reproduce the issue inside a rocky 8 docker image the issue and this is something that affects libcurl releases around 7.61.0.