Add custom library to use in NS3

107 views
Skip to first unread message

Mila Gorobets

unread,
Oct 22, 2014, 4:20:04 PM10/22/14
to ns-3-...@googlegroups.com
Hi everyone,

I'm (test) trying to add a library to use in my NS3 code.

I created this library in /home/cinnamon/libraries/libgpu/.
The path to the header file (called "one.h") is thus this: /home/cinnamon/libraries/libgpu/src/.
The path to the library (libgpu.a) is: /home/cinnamon/libraries/libgpu/Debug/.

I followed the instructions here to link it to my project. I made this wscript for the cinnamon.cc test I'm trying to do:

## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

def build(bld):
    obj
= bld.create_ns3_program('cinnamon', ['core', 'point-to-point', 'internet', 'applications'])
    obj
.source = 'cinnamon.cc'
    obj
.env.append_value("CXXFLAGS", "-I/home/cinnamon/libraries/libgpu/src")
    obj
.env.append_value("LINKFLAGS", ["-L/home/cinnamon/libraries/libgpu/Debug"])
    obj
.env.append_value("LIB", ["gpu"])

Now when I try to do a build, I get linker errors about one() (the only function in my library).

Maybe it's not running the script? If I do ./waf --no-task-lines -v, it doesn't seem to have the call to the library anywhere in the listing for "runner".

Mila Gorobets

unread,
Oct 22, 2014, 5:49:38 PM10/22/14
to ns-3-...@googlegroups.com
Well it definitely wasn't running the wscript. I made a module and it was running from wscript (was getting some linker errors from CUDA), and now it all stopped. Is there a way to force it to use wscript?

Jashan

unread,
Oct 24, 2014, 1:51:16 PM10/24/14
to ns-3-...@googlegroups.com
Maybe one probable cause is due to one pass linker. Otherwise I have also used external libraries using the very same method and they have worked well!!

Cheers 

 
Reply all
Reply to author
Forward
0 new messages