[Buildroot] [PATCH 2/2] package/sngrep: fix static build with gnutls

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Wed May 24 06:47:33 UTC 2017


Hello,

On Tue, 23 May 2017 23:20:14 +0200, Romain Naour wrote:

> I think this patch is not necessary anymore since gnutls shouldn't be linked
> statically, see [1].
> 
> The code use __attribute__((constructor)) and __attribute__((destructor)) to
> call constructor/desctructor when a shared library is loaded.
> Constructor/desctructor are not used when a static library is used (except when
> if -Wl,--whole-archive -lgnutls -Wno-whole-archive is used, not tested).
> 
> Even if gnutls initialization (_gnutls_global_init()) may be called manually,
> the maintainer said it's not supported.
> 
> So we should add !BR2_STATIC_LIBS for gnutls package ?
> Doing so, it will avoid all static linking issues with gnutls (taskd, ffmpeg,
> sngrep...)

Yes, I believe we should add !BR2_STATIC_LIBS, of course propagated to
all reverse dependencies (but there are not too many of them).

A side question is: is there a way to detect/error out when some code
is using this constructor/destructor mechanism in a way that doesn't
work for static linking? It would be useful to check if other packages
are affected.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com



More information about the buildroot mailing list