curl / curl-for-win

Reproducible curl binaries for Linux, macOS and Windows
https://curl.se/windows/
MIT License
686 stars 207 forks source link

Statically linked? #12

Closed jbfsoftware closed 4 years ago

jbfsoftware commented 4 years ago

https://curl.haxx.se/windows/ says cUrl was statically linked to a bunch of libraries. However if I try to use libcurl I still need the OpenSLL and the Zstd libraries. Isn't it so that cUrl was statically linked to the other libraries but (only) dynamically to these two? If so maybe make the download page more accurate to avoid confusion.

vszakats commented 4 years ago

@jbfsoftware:

These are the combinations covered in curl-for-win.

If anything, the third variant could likely be improved by relying on DLLs for all of its dependencies, but it would also require building e.g. nghttp2 in DLL form (it currently isn't), and/or tweaking the rest of the libcurl build to link the DLL variant where available. I'm open to PRs for that.

Another option is to build a full-static libcurl.dll, though I'm not certain how this behaves in apps having other libs linked that also require e.g. OpenSSL. It would also make libcurl.dll (and thus the curl.exe download archive) much larger without benefit for most users.

UPDATED: to cover the fact that some dependencies are statically linked to libcurl.dll.

jbfsoftware commented 4 years ago

Hi. Thanks for the swift reply. OK. It makes sense that your primary target is/was curl, not libcurl. I only use libcurl so I had a different focus on it. Am I correct to say that libcurl needs the openssl dlls and the zstd libraries, but that the nghttp2 and libssh2 dlls are statically built in this distribution?

vszakats commented 4 years ago

@jbfsoftware Yes, you're correct. [UPDATE: brotli is also part of libcurl.dll.]

Here's the relevant line from the build log, which lists all DLL dependencies of the freshly built libcurl.dll: https://ci.appveyor.com/project/curlorg/curl-for-win/build/1.0.1400/job/y243ie2mfucfkr5o#L11231

vszakats commented 4 years ago

I'm preparing patches to link zstd statically to libcurl.dll.

As for nghttp2, it not only requires building the lib itself as DLL, but needs to compile curl in a second round without the -DNGHTTP2_STATICLIB option.

vszakats commented 4 years ago

Build 7.72.0_2 is out, with zstd linked statically to libcurl.dll.

Ref: https://github.com/curl/curl-for-win/commit/d9b266afd2e5d3f5604483010ef62340b5918c89

jbfsoftware commented 4 years ago

@vszakats Thanks very much. I think this is a very welcome improvement and it works like a charm. I'm very happy with it and I appreciate your very swift actions. I will close the issue. You did more than I hoped for.