andelf / go-curl

golang curl(libcurl) binding.
Apache License 2.0
487 stars 130 forks source link

library not supporting curl version 8.0.X or higher #84

Open Laeri opened 1 year ago

Laeri commented 1 year ago

I get following error when trying to compile with the go-curl library:

          # github.com/andelf/go-curl
          In file included from ../../../go/pkg/mod/github.com/andelf/go-curl@v0.0.0-20200630032108-fd49ff24ed97/const.go:5:
          ./compat.h:423:2: error: #error your version is TOOOOOOOO low
            423 | #error your version is TOOOOOOOO low
                |  ^~~~~

          exit status 1

I have curl version 8.0.1 see output of the curl --version

curl 8.0.1 (x86_64-pc-linux-gnu) libcurl/8.0.1 OpenSSL/3.0.8 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.10.0 nghttp2/1.52.0

The problem seems to be, that the file compat.h only supports version with major version 7.10 or higher. As for as I have seen the 8.0.0 and 8.0.1 release should not break anything present in the 7.X+ release as the changelog is rather small. In addition, curl does not follow semver semantics so the upgrade to 8 is not necessarily breaking in this case.

I have a change in my fork right now on the compatgen.py file which I am testing right now. I had to modify it as rerunning it does not create a correct compat.h file as there is a fixed reference within it to curl versions 7.

sprive commented 4 months ago

This impacts me as well, and I solved it in a different way:

In compat.h, I changed the version TOO low check to:

#if (LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR == 10 && LIBCURL_VERSION_PATCH < 1) || (LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR < 10)
#error your version is TOOOOOOOO low

I'll also comment this on the PR. My fix is not going to be sufficient (likely that LIBCURL_VERSION_MAJOR needs to be added to every line in the file, especially given that compat.h pre-dates curl 8, but I don't want to make changes I can not test)