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: How to build libcurl with OpenSSL without installing the latter?

From: Timothe Litt <litt_at_acm.org>
Date: Mon, 8 Nov 2021 15:29:05 -0500

--with-xxx can be confusing at first.

The --with-openssl= doesn't point to the the openssl library, but to the
directory above it.

E.g. --with-openssl=/othersys means that openssl is found in:

/othersys/include/openssl

/othersys/lib/openssl

/othersys/share/openssl

The headers will be in /othersys/include

For a local (native) build, the default is --prefix=/usr/local. You can
install OpenSSL (and curl) there, then you would link
--with-openssl=/usr/local.  That won't mess up the system-wide copy -
PATH would need to include /usr/local/bin to get those utilities.  You
would need to run ldconfig to get the sharables indexed.  Or
/home/myinstall if you want a single-user copy.

For a cross-compilation, you need to distinguish where things are built
from where they'll live on the target.  But presumably you know about that.

While there are circumstances where a static library makes sense, in
general it creates more work, since you have to keep track of everything
that uses it, and rebuild them as well as the library when there's an
update.  You can use sharables with cross-compilation, and in most
embedded environments.


On 08-Nov-21 14:51, ellie via curl-library wrote:

Timothe Litt
ACM Distinguished Engineer
--------------------------
This communication may not represent the ACM or my employer's views,
if any, on the matters discussed.

> Hi everyone,
>
> How can I build libcurl from source with OpenSSL WITHOUT having an
> OpenSSL install? I tried pointing the --with-openssl=... path to the
> OpenSSL repository (with the library built, all .a files in place
> even) but it doesn't like that.
>
> I can't really install OpenSSL because this is a cross-compilation, so
> that inherently doesn't make sense. (Even for the native build I don't
> want to, because I statically link a local variant and installing it
> might mess up the system-wide copy I assume.)
>
> I also use --disable-shared and --enable-static anyway, so there is no
> point in linking. And I have the headers in the OpenSSL source tree,
> now I just need to know how to tell libcurl to use those, and not
> complain and just build. And I'm really very clueless how to. How does
> this work? Would also be nice if hints were to be added for this
> scenario (external SSL lib from source and NOT installed, all static
> builds) here: https://everything.curl.dev/source/build/tls
>
> Any ideas appreciated!
>
> Regards,
>
> Ellie
>
> PS: As a side note, is there a --without-any-libs switch? So I can
> disable every use of any possibly detected library, then add
> --with-... switches to enable them manually? Since this is a static
> build, linking anything from the OS is the opposite of what I want.

-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2021-11-08