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 <>
Date: Thu, 31 Aug 2023 11:09:58 -0400

On Thu, Aug 31, 2023 at 10:49 AM Randall via curl-library
<> wrote:
> On Wednesday, August 30, 2023 7:43 PM, Fandrich wrote:
> > [...]
> >If you can confirm that behaviour, then IMHO, configure should be changed
> to stop
> >doing that. If pkg-config has successfully found zlib, then configure
> shouldn't be
> >adding its own libraries and link flags to what pkg-config says is correct.
> When using a modified zlib.pc, the warning goes away, but -lz is added back
> by configure. The zlib.a is ignored, which is not the desired outcome. My
> zlib.pc as the Libs: line modified as follows (libz.a has to come first but
> does not take effect this way):
> Libs: ${libdir}/libz.a -L${libdir} -L${sharedlibdir}
> Instead of the original
> Libs: -L${libdir} -L${sharedlibdir} -lz

I think you should change strategies. You should use sed to change
references from -lz to libz.a (and friends).

What I have found from bootstrapping Wget on older systems that run
from non-standard locations [1]:

* use sed to change -l<lib> to point to the archive in configure [2]
* run configure
* use sed to change -l<lib> to point to the archive in the Makefiles [3]

When I say "point to the archive", I mean the absolute path to the
archive (though a relative path may work, if you are mindful of cwd
during command invocations).

After the configure/make/make check cycle, you will have an executable
that can run from anywhere without the need for RPATHs, RUNPATHs,
LD_PRELOAD and LD_LIBRARY_PATH tricks because there are no special
shared object dependencies. You will still depend on some shared
objects, but they are system shared objects like and

After I get Wget bootstrapped, I can build other programs, like cURL,
Git, OpenSSH, etc.

I bootstrap Wget instead of cURL because Wget only has two
dependencies - OpenSSL and libunistring. After I get a modern Wget on
a machine, I can build more complex programs like cURL or a fully
featured Wget.


Received on 2023-08-31