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: configure options for various libcurl builds

From: Dan Fandrich via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 21 Aug 2021 12:43:12 -0700

On Sat, Aug 21, 2021 at 05:42:47PM +0000, Anmol Mishra via curl-library wrote:
> Could there be some guidance about a simple libcurl static build for

Static building is tricky because the entire chain of static dependencies
resulting from all libcurl dependencies needs to be added to the final link
command. pkgconfig is supposed to help with this, but not everything uses it.
In short, it's much easier with dynamic linking.

> a. send email via smtp

You'll want the --enable-smtp option to configure.

> and
> b. downloading a file from a url

--enable-http although that's on by default (not sure about smtp).

> These may be the majority of uses for libcurl.

I'm not sure how many people want SMTP or static linking, but I guess you do.

> I tried the various ./configure options for a couple of days - but its not
> trivial to isolate just these two functions.

Start with plain "./configure --enable-smtp --enable-http --with-openssl" Once
you get that working, you can start optimizing, because that's all it is. Try
disabling all the other protocols that you don't need; this command will give
you something to start from:

  ./configure --help |grep -- '-disable.*support'

You'll probably also want to disable some features (like --without-zlib) to
avoid even more dependencies.

To get static linking working, appending something like this to the configure
command-line will get you started:

  … CFLAGS='-static' LIBS='<all the static library dependencies you will need>'

At minimum, you'll need static versions of libc and OpenSSL libraries
available, and possibly more.

> As a reference, is it enough to specify -–with-openssl and --enable-file and
> --enable-smtp ?

That should be enough to give you something that works.

> Is there a way to disable all the other options if unspecified during configure
> ?

Yes—just add all the --disable-FEATURE lines for those features you don't want
(see above).

Dan
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-08-21