Defining a subsystem conditionally in waf ...

Richard Sharpe realrichardsharpe at gmail.com
Sat Jan 10 08:54:29 MST 2015


On Sat, Jan 10, 2015 at 7:11 AM, Richard Sharpe
<realrichardsharpe at gmail.com> wrote:
> On Sat, Jan 10, 2015 at 12:24 AM, Ralph Böhme <rb at sernet.de> wrote:
>> On Fri, Jan 09, 2015 at 09:51:57PM -0800, Richard Sharpe wrote:
>>> On Fri, Jan 9, 2015 at 7:10 PM, Richard Sharpe
>>> <realrichardsharpe at gmail.com> wrote:
>>> > Hi folks,
>>> >
>>> > I am trying to define the zookeeper stuff this way in waf but it is not working:
>>> >
>>> > bld.SAMBA3_LIBRARY('smbregistry',
>>> >                    source='''registry/reg_api.c
>>> >                    registry/reg_dispatcher.c
>>> >                    registry/reg_cachehook.c
>>> >                    registry/reg_objects.c
>>> >                    registry/reg_util_internal.c
>>> >                    lib/util_nttoken.c
>>> >                    registry/reg_backend_db.c
>>> >                    registry/reg_parse_internal.c
>>> >                    lib/cbuf.c
>>> >                    lib/srprs.c
>>> >                    registry/reg_init_basic.c''',
>>> >                    deps='''smbd_shim tdb-wrap3 NDR_SECURITY util_tdb talloc
>>> >                    replace util_reg samba-util samba-security
>>> >                    errors3 dbwrap samba3-util REG_ZOOKEEPER''',
>>> >                    allow_undefined_symbols=True,
>>> >                    private_library=True)
>>> >
>>> > bld.SAMBA3_SUBSYSTEM('REG_SMBCONF',
>>> >                     source='''registry/reg_backend_smbconf.c
>>> >                     registry/reg_init_smbconf.c
>>> >                     registry/reg_util_token.c
>>> >                     registry/reg_api_util.c''',
>>> >                     deps='smbregistry')
>>> >
>>> > bld.SAMBA3_SUBSYSTEM('REG_ZOOKEEPER',
>>> >                     source='''registry/reg_backend_zookeeper.c''',
>>> >                     includes='/usr/local/include/zookeeper',
>>> >                     deps='zookeeper_st smbregistry',
>>> >                     enabled=bld.env.enable_zookeeper)
>>
>> looks like a circular dependency: smbregistry->REG_ZOOKEEPER->smbregistry.
>>
>>> > I keep getting:
>>> >
>>> > default/source3/libsmbregistry-samba4.so: undefined reference to
>>> > `zookeeper_reg_ops'
>>> >
>>> > How do I work around this?
>>>
>>> Well, it seems that I have to tell waf that I need to link with
>>> libzookeeper_st, but I cannot see how to do that ...
>>
>> You have zookeeper_st as dep, but do you actually have check for it ?
>> Eg
>>
>>   conf.CHECK_FUNCS_IN('some_zookeeper_func', 'zookeeper_st')
>
> Yeah, this is what I have in my wscript_configure_system_zookeeper file:
>
> import Logs, Options, sys
>
> Logs.info("Looking for Zookeeper features")
>
> conf.CHECK_HEADERS('zookeeper/zookeeper.h', lib='zookeeper_st')
>
> conf.CHECK_FUNCS_IN('zookeeper_init', 'zookeeper_st')
>
> conf.CHECK_LIB('zookeeper_st', shlib=True)
>
> if conf.CONFIG_SET('HAVE_ZOOKEEPER_ZOOKEEPER_H'):
>     Logs.info("Setting HAVE_ZOOKEEPER")
>     conf.DEFINE('HAVE_ZOOKEEPER', '1')
> else:
>     Logs.info("Not setting HAVE_ZOOKEEPER")
>     conf.undefine('HAVE_ZOOKEEPER')

Sigh. I think it was a case of fumble-fingers or brain fart, in that I
had rerun configure without adding --with-zookeeper.

However, the more serious question is how to conditionally add the
appropriate libraries, which seems to come down to defining the list
of deps as a variable in python and adding my new deps only if
--with-zookeeper has been set.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list