[Samba] Additional link libraries break Samba (crash after read_data in generate_random_data)

Andrew Bartlett abartlet at samba.org
Sat Nov 3 19:23:06 UTC 2018

On Sat, 2018-11-03 at 14:00 -0500, Michael Cronenworth via samba wrote:
> On 11/3/18 11:10 AM, Rowland Penny via samba wrote:
> > 
> > I think it may be because Debian uses libgnutls28-dev, whilst
> > Fedora
> > uses trousers
> It seems to be a Kodi CMake issue, but I would argue Samba or
> trousers need to 
> change the name of "read_data" to something more unique if it is
> going to be an 
> exported shared symbol.
> Kodi requires libmicrohttpd. The libmicrohttpd library uses gnutls
> and Fedora's 
> gnutls links against trousers. Fedora's gnutls pulls in trousers
> through dlopen(), 
> but CMake is pulling in libtspi as a compile-time link and the linker
> is using 
> read_data() from libtspi over the Samba copy.
> Versions 17.x of Kodi used autotools and didn't pull in libtspi.
> Version 18 relies 
> soley on CMake.
> I have worked[1] around the problem by filtering out "tspi" from
> being added to the 
> linker libraries in Kodi's CMake macros. Kodi no longer crashes.
> Thanks,
> Michael
> [1] 
> https://pkgs.rpmfusion.org/cgit/free/kodi.git/diff/kodi-18-trousers.p
> atch?id=005ee8fd5625beb9b95d06037ffe185c0e5e4fa0

OK, so the way I understand it, in this case:

A requires B, B requires C.

When linking A, it is incorrect to specify C to the linker as a
dependency.  That information is already found in B, which will have
bound to the strong symbol versions provided by C.

This prevents this kind of thing.

You may need to audit your Cmake rules more carefully to ensure you
only link Samba against libraries it directly uses.  Some pkg-config
files incorrectly list their own dependencies in --libs so must be

It is sort of the inverse, but also related to, this:


With this DSO change, the distinction I mention above now matters, and
the situation seem here can be avoided. 

I hope this helps,

Andrew Bartlett

Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

More information about the samba mailing list