[Ns-developers] Extenral Library Dependency
craigdo@ee.washington.edu
craigdo at ee.washington.edu
Tue Jul 15 12:41:13 PDT 2008
Hi All,
I am going to check some system threading and synchronization classes into
ns-3-dev shortly. There are dependencies on the pthreads library in these
classes, and I'm not really sure what the best way to handle this and
similar cases actually is when using waf.
In the case of pthreads, you need to link with librt. One way to do this is
to add something like,
variant_env.append_value('LINKFLAGS', '-L/lib -lrt')
in the "def configure(conf):" function of the top-level wscript. That seems
to be a brute force and awkwardness approach, though. There's got to be a
better way.
It would be nice to be able to add the dependency at the module level in
this case. For example, to be able to tell the core wscript that core now
needs to be linked against librt. I found something called "uselib" that
seems to do something like that but I haven't had any success in applying
this.
Another case I'm pondering is a device that might need to link against
libpcap. Again, it would not be very clever to add a dependency on pcap to
the whole system when many folks will never use the device in question. It
would be nice to be able to tell the wscript in src/devices/x that code
linking against this device needs also to link libpcap; and only actually
resolve references if a script needs to use the 'x' device.
This brings me to yet another point. Since we started monolithically
linking into a gargantuan libns-3 library, we seem to have lost track of how
we need to specify dependencies in the wscripts.
It used to be the case that we had to explicitly add libraries as in,
obj = bld.create_ns3_program('wifi-adhoc',
['core', 'simulator', 'mobility', 'wifi'])
but now, I believe that
obj = bld.create_ns3_program('wifi-adhoc')
works just as well; and some examples seem to have incomplete lists of
module dependencies.
Anyway, I'm not sure how this should all play out, and where the
declarations of library dependencies should actually go and whether or not
the lists in wscripts are meaningful. Can one of you waf guru-types give me
a hand doing this in a sane way?
Thanks,
-- Craig
More information about the Ns-developers
mailing list