[ndnSIM] Trying to re-compile ndnSIM class Forwarder

John Baugh jpbaugh at umich.edu
Sun May 21 21:03:56 PDT 2017

Spyros et al.,

I tend to think I have a reasonable grasp of compilation and linking in
general, which is precisely why some of what is going on is so
frustrating.  Originally, before running ./waf distclean, I was getting a
compiler error.  Now that I ran distclean, I get a linker error which seems
to imply the object file is simply not being build or in a location of
which my scenario is unaware.

I have been reading through the Waf Book online carefully, and looking
through the wscripts as well.

I do appreciate your patience.  I have bits and pieces of Linux-based
development in my career as both a software engineer in industry as well as
my Masters thesis research, but this is a far larger scale, and I was
previously not familiar with the WAF tool at all, and some of the setup.

However, *per your question*, I have a link to a folder on my Google Docs
to the following files (as a full repository share would probably be a bit
- forwarder.hpp
- forwarder.cpp
- ndn-simple2.cpp (my rather simple scenario)

The Forwarder object is obtained, as present in ndn-simple2.cpp but
replicated here for convenience, thusly:

*  /**

*      JPB - Added 5/18/2017      Testing forwarder compilation and
method(s)  */  //get l3protocol  Ptr<ndn::L3Protocol> l3protocol =
(nodes.Get(0))->GetObject<ndn::L3Protocol>();  //get forwarder
nfd::Forwarder& forwarder = *l3protocol->getForwarder();

I appreciate your help!



On Sun, May 21, 2017 at 11:00 PM, Spyridon (Spyros) Mastorakis <
mastorakis at cs.ucla.edu> wrote:

> Hi John,
> first of all, I would suggest that you take a look at how an NDN code
> repository is built and installed on your system. I would also suggest that
> you take a look at how a compiler and linker work and how you should write
> wscripts.
> For all the opens-source software projects that I have seen so far, there
> is the common convention that code under the src/ directory is supposed to
> be modified and compiled, while the compiled code and most probably the
> included header files are supposed to be under the build/ directory.
> It is not clear to me what is wrong in your case. I have followed a
> similar approach a number of times and it worked fine.
> How do you get the Forwarder instance of a simulated node in your
> simulation scenario?
> Thanks,
> Spyridon (Spyros) Mastorakis
> Personal Website: http://cs.ucla.edu/~mastorakis/
> Internet Research Laboratory
> Computer Science Department
> On May 21, 2017, at 3:43 PM, John Baugh <jpbaugh at umich.edu> wrote:
> Still no progress since last night sadly.
> If any of you have a suggestion or answers to any of my questions below
> please give your input.  I think I'm fairly close, but I'm missing
> something I believe.
> Thanks
> John
> On May 21, 2017 2:25 AM, "John Baugh" <jpbaugh at umich.edu> wrote:
> Greetings again friends,
> After some good advice from Ashlesh, I was able to get a different error
> (seems to be a linker error now instead of a compiler error... progress is
> progress I suppose.)
> So, related to this:
> 1.)  There appear to be multiple waf copies in different directories.
> Under what circumstances would you run, say, the waf inside the *NFD *directory
> as opposed to the one at the top level *ns-3* directory?
> 2.)  I ran the following from the *ns-3 *directory:
> * ./waf distclean
> * ./waf configure
> *./waf
> *sudo waf install
>     If you recall, I modified the *forwarder.cpp* file and the *forwarder.hpp
> *file in the src/ndnSIM/NFD/daemon/fw directory to contain a
> *printMessage* method.  I made sure it was public.
>     After the ./waf commands aforementioned, I checked the
> ns-3/build/ns3/ndnSIM/NFD/daemon/fw directory, and the *forwarder.hpp *file
> *does seem to be a copy *of the one from the src/ndnSIM/NFD....
> directory.
>     But I am *now getting a linker error:*
>     "... scenarios/ndn-simple2.cpp:120: undefined reference to
> 'nfd::Forwarder::printMessage()
>          collect2: error: ld returned 1 exit status"
> Ideas?
> Thanks,
> John
> On Fri, May 19, 2017 at 2:35 AM, John Baugh <jpbaugh at umich.edu> wrote:
>> Greetings again friends,
>> I'm up working on this trying to get my scenario to work with a custom
>> forwarder again at nearly 3 a.m. *on my birthday*.  I'm not sure if
>> that's dedication or insanity.  ;)
>> I spent another 4-5 hours trying to figure out this specific problem
>> tonight, but with no luck.  I have found the following:
>> 1.  forwarder.hpp lives in *both *ns-3/build/ns3/ndnSIM/NFD/daemon/fw *as
>> well as *ns-3/src/ndnSIM/NFD/daemon/fw
>>      The later also has a forwarder.cpp in it.
>> 2.  Which one of the copies (?) of forwarder.hpp mentioned above am I
>> supposed to change / modify for my scenarios to use it instead of the
>> default one?  Where is the corresponding forwarder.cpp file for the one in
>> ns-3/build path (there is one in the ns-3/src path, but none to be found in
>> ns-3/build path mentioned above)
>> 3.  Why is there a *waf *in so many different directories?  They seem to
>> be specialized to the different components of ndnSIM, such as NFD, ndn-cxx,
>> and specific scenarios -  Perhaps I'm using the wrong one(s)?
>> 4.  My scenarios are still saying that the Forwarder class doesn't have a
>> printMessageForTest method, even though I have it declared in both the
>> copies of forwarder.hpp, and have it defined in forwarder.cpp.  I tried
>> recompiling using ./waf in various directories, and I cannot find a
>> solution to this problem.
>> I appreciate your patience again.  This is a really irritating situation,
>> and I'm fairly certain there's something simple I'm missing.  Any help
>> would be greatly appreciated.
>> Thanks,
>> John
>> On Thu, May 18, 2017 at 2:47 AM, John Baugh <jpbaugh at umich.edu> wrote:
>>> Greetings ndnSIM friends,
>>> I've spent the last few days working on trying to modify the Forwarder
>>> class (which I did - I modified *ns-3/src/ndnSIM/NFD/daemon/fw/forwarder.[hpp,
>>> cpp]*)
>>> However, ./waf doesn't seem to work properly.  I even did a ./waf clean
>>> and ./waf build.  On one of the runs of ./waf I did notice it (apparently?)
>>> successfully re-build the forwarder.cpp file.
>>> What I did was add a method (the prototype to .hpp and definition to
>>> .cpp) called *printMessageForTest())*
>>> I would assume that after ndnSIM was rebuilt with ./waf that my
>>> scenario, which calls printMessageForTest on the forwarder would actually
>>> work, but it doesn't recognize it.
>>> Any clue what's going on?
>>> Alternatively, if anyone could give an appropriate procedure for
>>> ensuring all changes make it into the system when modifications of actual
>>> ndnSIM files are made, it would be appreciated.
>>> Looking forward to hearing from you,
>>> John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170522/b66d538c/attachment.html>

More information about the ndnSIM mailing list