Bugzilla – Bug 1129
nsc library path setting is not robust
Last modified: 2011-06-15 17:47:19 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.
> > 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.
(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
Created attachment 1108 [details] patch 1
(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).
The changes from the patch have already been merged.