Bug 1129 - nsc library path setting is not robust
nsc library path setting is not robust
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: build system
pre-release
All All
: P5 normal
Assigned To: Gustavo J. A. M. Carneiro
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-06 14:51 EDT by Tom Henderson
Modified: 2011-06-15 17:47 EDT (History)
3 users (show)

See Also:


Attachments
patch 1 (1.52 KB, patch)
2011-05-11 12:28 EDT, John Abraham
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Henderson 2011-05-06 14:51:54 EDT
I've seen intermittent failures of dlopen() when trying to run this example:  tcp-nsc-zoo

msg="liblinux2.6.18.so: cannot open shared object file: No such file or directory", file=../src/internet/model/nsc-tcp-l4-protocol.cc, line=144

despite nsc being in the usual place and liblinux2.6.18.so being there.

I looked into one such case today and found that if I set LD_LIBRARY_PATH to include ../nsc/linux-2.6.18, it would clear the error.

looking into src/internet/wscript, I found this:

    lib_to_check = 'liblinux2.6.26.so'

    found = False
    for path in ['.', 'lib', 'lib64', 'linux-2.6.26']:
        if os.path.exists(os.path.join(conf.env['WITH_NSC'], path, lib_to_check)):
            # append the NSC kernel dir to the module path so that this dir
            # will end up in the LD_LIBRARY_PATH, thus allowing the NSC NS-3
            # module to find the necessary NSC shared libraries.
            found = True
            conf.env.append_value('NS3_MODULE_PATH',
                                  os.path.abspath(os.path.join(conf.env['WITH_NSC'], path)))

and later in the build, LD_LIBRARY_PATH will get the paths in NS3_MODULE_PATH

My read of the above is that waf will append 

One brute force method is to extend the above to include also liblinux2.6.18.so, which I would recommend (over doing nothing) for the release.  However, I would rather recommend that the above code just be future-proofed to allow for different nsc directories in the future, so perhaps just append all subdirectories of ../nsc to NS3_MODULE_PATH.
Comment 1 Tom Henderson 2011-05-06 14:52:59 EDT
> 
> My read of the above is that waf will append 
> 
My read of the above is that waf will append ../nsc/linux-2.6.26 to LD_LIBRARY_PATH (for later dlopen()) but will not catch ../nsc/linux-2.6.18 or others.
Comment 2 John Abraham 2011-05-11 12:27:46 EDT
(In reply to comment #1)
> > 
> > My read of the above is that waf will append 
> > 
> My read of the above is that waf will append ../nsc/linux-2.6.26 to
> LD_LIBRARY_PATH (for later dlopen()) but will not catch ../nsc/linux-2.6.18 or
> others.

I am not sure why the original author used both *26 and *18. Unless there is a specific reason to use *18 andd *26 "so" files, the patch I attached should be enough
Comment 3 John Abraham 2011-05-11 12:28:42 EDT
Created attachment 1108 [details]
patch 1
Comment 4 Tom Henderson 2011-05-11 13:54:59 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > > 
> > > My read of the above is that waf will append 
> > > 
> > My read of the above is that waf will append ../nsc/linux-2.6.26 to
> > LD_LIBRARY_PATH (for later dlopen()) but will not catch ../nsc/linux-2.6.18 or
> > others.
> 
> I am not sure why the original author used both *26 and *18. Unless there is a
> specific reason to use *18 andd *26 "so" files, the patch I attached should be
> enough

*26 did not exist when the example was created.

I would be fine with your patch for ns-3.11 and punting the general issue of more extensible NSC integration for further work (when the bake/bakefile system comes along).
Comment 5 Mitch Watrous 2011-06-15 17:47:19 EDT
The changes from the patch have already been merged.