[libnice] Small patch to avoid symbol clash with openSSL
Philip Withnall
philip at tecnocode.co.uk
Mon Oct 27 04:34:38 PDT 2014
Ah, you’re absolutely right. I’d forgotten that symbol visibility cannot
be controlled for static libraries (since they’re basically just a
concatenation of .o files).
I’ve pushed your patch to master with a suitable commit message. Thanks
a lot. :-)
commit 3bc28d43a5189e561087f9340467ef2bd314c7fb
Author: Curieux Tres <trescurieux at yahoo.fr>
Date: Mon Oct 27 11:32:17 2014 +0000
stun: Rename a symbol to avoid a naming clash with OpenSSL
The symbol is not exported, but nevertheless leaks in the static
version
of libnice, due to limitations on symbol visibilities with static
libraries. OpenSSL has a symbol named RAND_bytes(), which ours
clashes
with if the two are linked together statically.
Avoid this by prefixing ours with ‘nice_’.
stun/rand.c | 4 ++--
stun/rand.h | 2 +-
stun/stunhmac.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
Philip
On Sun, 2014-10-26 at 06:40 +0000, Curieux Tres wrote:
> Hi,
> Looks like when used as static lib, the symbol is fully exported
> nm -AC libnice.a | grep RAND
> libnice.a:rand.o:0000000000000050 T RAND_bytes
>
> libnice.a:stunhmac.o: U RAND_bytes
>
>
> (It has been built with regular autoconf/automake with
> --enable-static)
>
>
> Thanks
> Fx
>
>
>
>
>
>
>
> Le Samedi 25 octobre 2014 20h10, Philip Withnall
> <philip at tecnocode.co.uk> a écrit :
>
>
>
> It really depends entirely on how you’re building libnice. What linker
> flags are you passing in via cmake?
>
> Rather than reinventing the libnice build system, a better approach is
> to build libnice using its own build system for all the platforms
> you’re
> interested in (potentially producing a static library), then link to
> that from the build system of whatever final project you’re using.
>
> I did this recently using Cerbero[1] to build a project for multiple
> desktop and mobile platforms. The project used libnice, and used its
> existing automake build system without linker problems.
>
> Philip
>
> [1]: http://cgit.freedesktop.org/gstreamer/cerbero/
>
> On Sat, 2014-10-25 at 18:47 +0100, Curieux Tres wrote:
> > we have all the cmake based tool to build for all platforms (i.e.
> > desktop & mobile).
> > Won't the problem happen if libnice is used as static lib ?
> >
> >
> > Thanks
> > Fx
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Le Vendredi 24 octobre 2014 20h47, Philip Withnall
> > <philip at tecnocode.co.uk> a écrit :
> >
> >
> >
> > It certainly will. Why are you not using automake?
> >
> > Philip
> >
> > On Fri, 2014-10-24 at 18:54 +0100, Curieux Tres wrote:
> > >
> > >
> > > Hi
> > > Maybe my fault, i'm not using the autoconf/automake build
> > > but a cmake one, it might expose things a little bit differently
> > >
> > >
> > >
> > > Le Vendredi 24 octobre 2014 17h57, Philip Withnall
> > > <philip at tecnocode.co.uk> a écrit :
> > >
> > >
> > >
> > > Hi,
> > >
> > > How are you encountering this symbol clash? RAND_bytes is exposed
> in
> > > the
> > > libstun.la helper library, but that is not installed, and when
> it’s
> > > linked in to libnice.so, RAND_bytes becomes a local, non-exported
> > > symbol.
> > >
> > > e.g.
> > > $ nm -g nice/.libs/libnice.so | grep RAND
> > > $ # no results
> > >
> > > Philip
> > >
> > > On Thu, 2014-10-16 at 15:10 +0100, Curieux Tres wrote:
> > > > Hi
> > > > RAND_bytes is also used/exported by openSSL
> > > > Small patch attached to rename it to nice_RAND_bytes
> > > >
> > > >
> > > > Thanks
> > > > Fx
> > > >
> > > >
> > > > _______________________________________________
> > > > nice mailing list
> > > > nice at lists.freedesktop.org
> > > > http://lists.freedesktop.org/mailman/listinfo/nice
> > >
> > >
> > >
> > >
> >
> >
> > _______________________________________________
> > nice mailing list
> > nice at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/nice
> >
> >
> >
> >
> > _______________________________________________
> > nice mailing list
> > nice at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/nice
>
>
> _______________________________________________
> nice mailing list
> nice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nice
>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/nice/attachments/20141027/11a3b013/attachment.sig>
More information about the nice
mailing list