curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. 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 himself.

Re: Curl Configuration Weirdness for libz.a

From: Jeffrey Walton via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 31 Aug 2023 13:50:53 -0400

On Thu, Aug 31, 2023 at 1:41 PM Dan Fandrich via curl-library
<curl-library_at_lists.haxx.se> wrote:
>
> On Thu, Aug 31, 2023 at 11:09:58AM -0400, Jeffrey Walton via curl-library wrote:
> > I think you should change strategies. You should use sed to change
> > references from -lz to libz.a (and friends).
>
> While that would work, devs shouldn't need to do this. curl's configure is
> simply doing the wrong thing. I'll work on a patch.

Another sharp edge... You can use the proper linker flags to link to
the static archive rather than the shared object (like -l:libz.a*),
and it will work fine on Linux and Solaris. But Apple linkers will
still link to the shared object anyways. Even on iOS where shared
object runtime linking was forbidden.

In the Apple cases, I either (1) deleted the shared objects; or (2)
used sed to call out the archive.

[*] See the ld man page for -l:libz.a, https://linux.die.net/man/1/ld:

-l namespec
--library=namespec
    Add the archive or object file specified by namespec to the list
    of files to link. This option may be used any number of times. If
    namespec is of the form :filename, ld will search the library path
    for a file called filename, otherwise it will search the library path
    for a file called libnamespec.a.

Jeff
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-08-31