cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl on Android colliding with other openssl in the same .so

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 14 Mar 2016 22:53:30 +0100 (CET)

On Mon, 14 Mar 2016, JOHAN LANTZ wrote:

> I had no issues precompiling libcurl.a but when adding it to my existing
> Android.mk I get a bunch of multiple definition errors like this one:

> armeabi/libcurl.a(cryptlib.o): multiple definition of 'CRYPTO_get_new_lockid'

Interesting, the actual function CRYPTO_get_new_lockid is not even used by
libcurl so it seems you have OpenSSL somehow linked into your libcurl.a.
That's certainly not a standard way of doing .a files on ordinary linux
systems and I know very little about how Android builds are usually done so I
can't say if that's expected there or not.

But if "everyone" brings their own openssl lib, of course they will collide on
symbols then.

> I assume this is because pjsip is also relying on openssl.

It is becaused they also bundle and include the openssl lib, not just use it.

> If I compile libcurl using -without-ssl it links fine into my existing .so.

Right, so if you don't bundle openssl within libcurl.a there's only the single
one from pjsip and then things are good.

> Does anyone have any recommendation on how to solve this in a good way?
> Somehow it feels like both pjsip and libcurl should be able to share the
> openssl code. I guess the problem might come from them both being prebuilt
> and then introduced into the same .so in the end.

This seems Android specifc and/or specific to the particular builds of libcurl
and pjsip you use. In any other linux system you'd simple link with curl,
pjsip and openssl (and possibly additional dependency libraries) and that
would be fine.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-03-14