Package: ntdb
Version: 1.0-4
Severity: wishlist
Usertags: goto-cc

While building the package I noticed an unexpected

[...]
Checking compiler accepts -fvisibility=hidden                                   
  : yes
Checking for HAVE_VISIBILITY_ATTR                                               
  : not found

when using a compiler that does not have support for nested functions. Yet it
seems that these aspects should not interact, but the configure check in
lib/replace/wscript uses the following:

    if conf.CHECK_CFLAGS('-fvisibility=hidden'):
        conf.env.VISIBILITY_CFLAGS = '-fvisibility=hidden'
        conf.CHECK_CODE('''void vis_foo1(void) {}
                           __attribute__((visibility("default"))) void 
vis_foo2(void) {}''',
                        cflags=conf.env.VISIBILITY_CFLAGS,
                        define='HAVE_VISIBILITY_ATTR')

with buildtools/wafsamba/samba_autoconf.py doing the following:

    if addmain:
        fragment='%s\n%s\n int main(void) { %s; return 0; }\n' % (defs, hdrs, 
code)
    else:
        fragment='%s\n%s\n%s\n' % (defs, hdrs, code)

Hence the function vis_foo1 and vis_foo2 will end up being defined within main,
resulting in nested functions. This unnecessarily breaks the build using
compilers such as Clang.

To fix the problem, conf.CHECK_CODE should be called with link=False,
addmain=False.

Best,
Michael

PS.: This configuration bit appears to exist as literal copy in several
packages, the bug report will be cloned accordingly.

Attachment: pgpIzWP6Izt0C.pgp
Description: PGP signature

Reply via email to