ns3 help required regarding the modification of wscript file to link the externally created dynamic library

224 views
Skip to first unread message

ns3...@gmail.com

unread,
Aug 22, 2013, 10:54:22 PM8/22/13
to ns-3-...@googlegroups.com
Hi all,
I am new to ns3 and I have checked and implemented the examples present in ns3. 

I have to implement a project for which i have created a QT dynamic library using IDE netbeans.I have read the help present in this forum (especially answers of Gustavo Carneiro and Tom Henderson,those were really helpful) and the ns3 nsnam website. What i figured out is that in order to use that library i need to create a module.so I created the module by executing the create-module.py which create some templates and wscript file.Now in order to link the library i need to modify wscript.py file.Can anybody please help me how to modify this python file because i donot have experience of python???
thanks in advance for your help


Message has been deleted

ns3...@gmail.com

unread,
Aug 23, 2013, 1:44:20 PM8/23/13
to ns-3-...@googlegroups.com
To link the library i made following changes in the wscript.py file

        bld.env.append_value("LINKFLAGS", ["-L/home/a/NetBeansProjects/QDynLib/dist/Debug/GNU-Linux-x86"])
        bld.env.append_value("LIB", ["libQDynLib"])

but still building is not successful and i am getting the following errors(complete build error is attached):
.
.
.
[1705/1995] cxx: examples/energy/energy-model-example.cc -> build/examples/energy/energy-model-example.cc.1.o
[1706/1995] cxx: examples/udp-client-server/udp-trace-client-server.cc -> build/examples/udp-client-server/udp-trace-client-server.cc.2.o
[1707/1995] cxxshlib: build/src/core/model/time.cc.1.o build/src/core/model/event-id.cc.1.o build/src/core/model/scheduler.cc.1.o build/src/core/model/list-scheduler.cc.1.o build/src/core/model/map-scheduler.cc.1.o build/src/core/model/heap-scheduler.cc.1.o build/src/core/model/calendar-scheduler.cc.1.o build/src/core/model/event-impl.cc.1.o build/src/core/model/simulator.cc.1.o build/src/core/model/simulator-impl.cc.1.o build/src/core/model/default-simulator-impl.cc.1.o build/src/core/model/timer.cc.1.o build/src/core/model/watchdog.cc.1.o build/src/core/model/synchronizer.cc.1.o build/src/core/model/make-event.cc.1.o build/src/core/model/log.cc.1.o build/src/core/model/breakpoint.cc.1.o build/src/core/model/type-id.cc.1.o build/src/core/model/attribute-construction-list.cc.1.o build/src/core/model/object-base.cc.1.o build/src/core/model/ref-count-base.cc.1.o build/src/core/model/object.cc.1.o build/src/core/model/test.cc.1.o build/src/core/model/random-variable.cc.1.o build/src/core/model/random-variable-stream.cc.1.o build/src/core/model/rng-seed-manager.cc.1.o build/src/core/model/rng-stream.cc.1.o build/src/core/model/command-line.cc.1.o build/src/core/model/type-name.cc.1.o build/src/core/model/attribute.cc.1.o build/src/core/model/boolean.cc.1.o build/src/core/model/integer.cc.1.o build/src/core/model/uinteger.cc.1.o build/src/core/model/enum.cc.1.o build/src/core/model/double.cc.1.o build/src/core/model/int64x64.cc.1.o build/src/core/model/string.cc.1.o build/src/core/model/pointer.cc.1.o build/src/core/model/object-ptr-container.cc.1.o build/src/core/model/object-factory.cc.1.o build/src/core/model/global-value.cc.1.o build/src/core/model/trace-source-accessor.cc.1.o build/src/core/model/config.cc.1.o build/src/core/model/callback.cc.1.o build/src/core/model/names.cc.1.o build/src/core/model/vector.cc.1.o build/src/core/model/fatal-impl.cc.1.o build/src/core/model/system-path.cc.1.o build/src/core/model/unix-system-wall-clock-ms.cc.1.o build/src/core/model/int64x64-128.cc.1.o build/src/core/model/realtime-simulator-impl.cc.1.o build/src/core/model/wall-clock-synchronizer.cc.1.o build/src/core/model/system-thread.cc.1.o build/src/core/model/unix-fd-reader.cc.1.o build/src/core/model/unix-system-mutex.cc.1.o build/src/core/model/unix-system-condition.cc.1.o -> build/libns3.16-core-debug.so
/usr/bin/ld: cannot find -llibQDynLib
collect2: ld returned 1 exit status
Waf: Leaving directory `/home/a/Documents/ns-allinone-3.16/ns-3.16/build'
Build failed
 -> task in 'ns3-core' failed (exit status 1): 
{task 43849872: cxxshlib time.cc.1.o,event-id.cc.1.o,scheduler.cc.1.o,list-scheduler.cc.1.o,map-scheduler.cc.1.o,heap-scheduler.cc.1.o,calendar-scheduler.cc.1.o,event-impl.cc.1.o,simulator.cc.1.o,simulator-impl.cc.1.o,default-simulator-impl.cc.1.o,timer.cc.1.o,watchdog.cc.1.o,synchronizer.cc.1.o,make-event.cc.1.o,log.cc.1.o,breakpoint.cc.1.o,type-id.cc.1.o,attribute-construction-list.cc.1.o,object-base.cc.1.o,ref-count-base.cc.1.o,object.cc.1.o,test.cc.1.o,random-variable.cc.1.o,random-variable-stream.cc.1.o,rng-seed-manager.cc.1.o,rng-stream.cc.1.o,command-line.cc.1.o,type-name.cc.1.o,attribute.cc.1.o,boolean.cc.1.o,integer.cc.1.o,uinteger.cc.1.o,enum.cc.1.o,double.cc.1.o,int64x64.cc.1.o,string.cc.1.o,pointer.cc.1.o,object-ptr-container.cc.1.o,object-factory.cc.1.o,global-value.cc.1.o,trace-source-accessor.cc.1.o,config.cc.1.o,callback.cc.1.o,names.cc.1.o,vector.cc.1.o,fatal-impl.cc.1.o,system-path.cc.1.o,unix-system-wall-clock-ms.cc.1.o,int64x64-128.cc.1.o,realtime-simulator-impl.cc.1.o,wall-clock-synchronizer.cc.1.o,system-thread.cc.1.o,unix-fd-reader.cc.1.o,unix-system-mutex.cc.1.o,unix-system-condition.cc.1.o -> libns3.16-core-debug.so}
['/usr/bin/g++', '-Wl,--soname=libns3.16-core-debug.so', '-shared', '-pthread', 'src/core/model/time.cc.1.o', 'src/core/model/event-id.cc.1.o', 'src/core/model/scheduler.cc.1.o', 'src/core/model/list-scheduler.cc.1.o', 'src/core/model/map-scheduler.cc.1.o', 'src/core/model/heap-scheduler.cc.1.o', 'src/core/model/calendar-scheduler.cc.1.o', 'src/core/model/event-impl.cc.1.o', 'src/core/model/simulator.cc.1.o', 'src/core/model/simulator-impl.cc.1.o', 'src/core/model/default-simulator-impl.cc.1.o', 'src/core/model/timer.cc.1.o', 'src/core/model/watchdog.cc.1.o', 'src/core/model/synchronizer.cc.1.o', 'src/core/model/make-event.cc.1.o', 'src/core/model/log.cc.1.o', 'src/core/model/breakpoint.cc.1.o', 'src/core/model/type-id.cc.1.o', 'src/core/model/attribute-construction-list.cc.1.o', 'src/core/model/object-base.cc.1.o', 'src/core/model/ref-count-base.cc.1.o', 'src/core/model/object.cc.1.o', 'src/core/model/test.cc.1.o', 'src/core/model/random-variable.cc.1.o', 'src/core/model/random-variable-stream.cc.1.o', 'src/core/model/rng-seed-manager.cc.1.o', 'src/core/model/rng-stream.cc.1.o', 'src/core/model/command-line.cc.1.o', 'src/core/model/type-name.cc.1.o', 'src/core/model/attribute.cc.1.o', 'src/core/model/boolean.cc.1.o', 'src/core/model/integer.cc.1.o', 'src/core/model/uinteger.cc.1.o', 'src/core/model/enum.cc.1.o', 'src/core/model/double.cc.1.o', 'src/core/model/int64x64.cc.1.o', 'src/core/model/string.cc.1.o', 'src/core/model/pointer.cc.1.o', 'src/core/model/object-ptr-container.cc.1.o', 'src/core/model/object-factory.cc.1.o', 'src/core/model/global-value.cc.1.o', 'src/core/model/trace-source-accessor.cc.1.o', 'src/core/model/config.cc.1.o', 'src/core/model/callback.cc.1.o', 'src/core/model/names.cc.1.o', 'src/core/model/vector.cc.1.o', 'src/core/model/fatal-impl.cc.1.o', 'src/core/model/system-path.cc.1.o', 'src/core/model/unix-system-wall-clock-ms.cc.1.o', 'src/core/model/int64x64-128.cc.1.o', 'src/core/model/realtime-simulator-impl.cc.1.o', 'src/core/model/wall-clock-synchronizer.cc.1.o', 'src/core/model/system-thread.cc.1.o', 'src/core/model/unix-fd-reader.cc.1.o', 'src/core/model/unix-system-mutex.cc.1.o', 'src/core/model/unix-system-condition.cc.1.o', '-o', '/home/a/Documents/ns-allinone-3.16/ns-3.16/build/libns3.16-core-debug.so', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-llibQDynLib', '-lrt', '-lgsl', '-lgslcblas', '-lm']
make: *** [all] Error 1


BUILD FAILED (exit value 2, total time: 2m 55s)


can anybody help me please?location of my library file isthanks in advance for help

location of the dynamic library:
home/a/NetBeansProjects/QDynLib/dist/Debug/GNU-Linux-x86
name of library file:libQDynLib
ns3 build error detail.rtf

ns3...@gmail.com

unread,
Aug 27, 2013, 10:11:36 PM8/27/13
to ns-3-...@googlegroups.com

I have resolved that issue after spending some time.I am providing the solution so that it can be helpful to save time:


In order to integrate ns3 and Qt, I;

1)-created the dynamic library of the code written in Qt using IDE netbeans.

2)-In order to link and use that library I place the header file in the build/project folder so that I can use it easily.After that to link the dynamic library in ns3, I added following lines in the script file:


module.ccflags=['-wall','-O3'] 

module.lib=['QDynLib'] 

module.libpath=['/home/a/Documents/ns-allinone-3.16/ns-3.16/src/propagation/QDynLib/dist/Debug/GNU-Linux-x86'] 

module.linkflag=['-g'] #module.install_path=['/home/a/Documents/ns-allinone-3.16/ns-3.16/src/propagation/QDynLib/dist/Debug/GNU-Linux-x86']

module.rpath=['/home/a/Documents/ns-allinone-3.16/ns-3.16/src/propagation/QDynLib/dist/Debug/GNU-Linux-x86']


Here,I used the absolute path to locate the dynamic library.


Location of the Dynamic library;

/home/a/Documents/ns-allinone-3.16/ns-3.16/src/propagation/QDynLib/dist/Debug/GNU-Linux-x86/

Name of the library File:

libQDynLib.so


to find the explanation and detail of these command please refer to the link:

http://docs.waf.googlecode.com/git/book_15/single.html#_c_and_c_projects




Reply all
Reply to author
Forward
0 new messages