_PUBLIC_ in installed tdb/talloc headers used by Samba build

Andrew Bartlett abartlet at samba.org
Sun Mar 27 23:57:14 UTC 2022

On Sat, 2022-03-26 at 18:22 +0300, Michael Tokarev wrote:
> I got it finally. 3 days (but with only minor work ;) )
> tdb.h, talloc.h etc now has _PUBLIC_ definition near every
> symbol they declare.  By default it defines to something
> reasonable. But samba defines it to attribute(visibility(hidden)).
> Which does not work when *importing* these symbols from a
> shared library..
> I think we'll have to patch tdb.h to remove these _PUBLIC_
> marks. Or else it will be difficult to deal with.
> This happened in the few latest versions of samba.

I think this might mean we need to extend the work to pre-process these
files before we install them.  See

The original work was justified as:

commit aacd3ecb45ab04cb2f8a38a385a45bdca6d88cd2
Author: Günther Deschner <gd at samba.org>
Date:   Fri Jul 16 17:29:40 2021 +0200

    tdb: Fix invalid syntax in tdb.h
    Defining _PUBLIC_ in the same way as in talloc.h resolves an issue
    a previous fix for Solaris Studio compiler 12.4 that prefixed all
    in tdb.h with _PUBLIC_.  Thanks to Lukas Slebodnik
    <lslebodn at redhat.com>.
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=14762
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 3c1013caf4b57c6af5a5d210df232c08a1227a17
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Mar 7 12:50:29 2019 +0100

    tdb: fix studio compiler build
    Solaris Studio compiler 12.4 is pedantic about prototypes in
headers having
    the external visibility declarations too. It throws errors like:
    redeclaration must have the same or more restrictive linker
scoping: ...
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Andrew Bartlett

Andrew Bartlett (he/him)       https://samba.org/~abartlet/
Samba Team Member (since 2001) https://samba.org
Samba Team Lead, Catalyst IT   https://catalyst.net.nz/services/samba

Samba Development and Support, Catalyst IT - Expert Open Source

More information about the samba-technical mailing list