[Ns-developers] Extenral Library Dependency

Gustavo Carneiro gjcarneiro at gmail.com
Tue Jul 15 15:29:04 PDT 2008


2008/7/15 <craigdo at ee.washington.edu>:

>
> > > 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')
>
> > Aren't there some systems that require -lpthread?
> >
> > George
>
> Posix clocks are in librt, and librt depends on libpthread; so pthreads
> come
> for free in this case.  Yes, if you just want pthreads you can just link to
> libpthread.
>
> I guess I wasn't explicit enough in describing why I need which external
> library; but the larger issue of how to deal with external libraries
> remains
> a question mark.


Craig, it's rather simple.  Just do what I demonstrated doing with my patch
for libpcap.

   conf.env.append_value('LIBS_RT', 'rt')

[...]

   sim = bld.create_ns3_module(...)
   [...]
   sim.uselib = 'RT'


If you want to automatically detect if librt is available in the system (as
you should), do the conf.create_library_configurator() thing like I did with
pcap.

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list