curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

Is libcurl.pc correct?

From: Paul Smith via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 12 Sep 2024 17:26:30 -0400

Examining the libcurl.pc file when I install my own build (curl 8.9.1)
I'm not sure it is correct, and I wonder if there are opinions here.

FYI, I'm on GNU/Linux and I'm building all libraries statically and
only installing the static versions, no shared libs.

As I understand the Libs: variable is shown if you run pkg-config with
--libs, and BOTH Libs: and Libs.private: are shown if you run
pkg-config with --libs --static.

So for example, if I have libfoo.pc:

  Libs: -L${libdir} -lfoo
  Libs.private: -pthread

then I get this result:

  $ pkg-config --libs foo
  -L/my/lib/path -lfoo

  $ pkg-config --libs --static foo
  -L/my/lib/path -lfoo -pthread

The libcurl.pc file seems strange to me because the libraries are all
repeated in Libs.private (and also the prerequisites are duplicated in
Requires.private):

  Requires: zlib,libzstd,openssl
  Requires.private: zlib,libzstd,openssl

  Libs: -L${libdir} -lcurl -lssl -lcrypto -lssl -lcrypto -ldl -pthread -lzstd -lzstd -lz -pthread
  Libs.private: -lssl -lcrypto -lssl -lcrypto -ldl -pthread -lzstd -lzstd -lz -pthread

This leads to a lot of duplication when --static is used:

  $ pkg-config --libs --static libcurl
  -L/my/lib/path -lcurl -lssl -lcrypto -lssl -lcrypto -ldl -pthread -lzstd -lz -pthread -lssl -lcrypto -lssl -lcrypto -ldl -pthread -lzstd -lz -pthread -lz -lzstd -pthread -lssl -lcrypto -ldl -pthread

I mean, in the grand scheme of things duplicating libraries is not a
big deal it just increases the link time a bit.

Is this something to be considered? Or "don't really care"?

Looking at the .pc.in file I didn't quite follow the uses of the
LIBCURL_NO_SHARED and LIBCURL_LIBS metavariables.
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2024-09-13