Bug 41 - Statically linked simple-p2p and simple-p2p.exe assert
Statically linked simple-p2p and simple-p2p.exe assert
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: samples
pre-release
PC Windows
: P3 normal
Assigned To: Mathieu Lacage
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-19 17:11 EDT by Craig Dowell
Modified: 2009-11-23 08:26 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Dowell 2007-06-19 17:11:55 EDT
The symptom while running simple-p2p (either cygwin or linux) is 

Invalid value: Queue=DropTailQueue 
Segmentation fault 

This is the output of an assert that fires during Bind().  The root cause is that the following (global constructor) code in drop-tail-queue.cc is not executed:

const ClassId DropTailQueue::cid = 
  MakeClassId<DropTailQueue> ("DropTailQueue", Queue::iid); 

This code is not executed since simple-p2p doesn't directly reference drop-tail-queue.o and therefore the linker optimizes out the calls to initialize the constructors.

If I add the following code to simple-p2p.cc 

  DropTailQueue *q = new DropTailQueue; 
  delete q; 

The linker figures out that I'm interested in drop-tail-queue.o and will run the global constructor and the Bind() will succeed, but another assert fires at a later time,

No Scheduler factory registered 
Segmentation fault 

Presumably due to the same "feature."

Generally the answer to problems like this is to use shared libraries.  Unfortunately, shared library versions don't work on Cygwin (see bug 40)
Comment 1 Tom Henderson 2007-10-08 00:50:43 EDT
this does not seem to be a blocker because it doesn't seem that we are going to easily fix this and it doesn't seem to bother anyone.

Should we change to WONTFIX?
Comment 2 Mathieu Lacage 2007-10-08 03:05:10 EDT
I think that the bug could be fixed and that there are some pretty good reasons to fix this bug in the long term. It is just a matter of not enough manpower for now for such a not-so-immediately useful feature.
Comment 3 Tom Henderson 2008-06-05 10:51:18 EDT
changed to P3; not a blocker.
Comment 4 Mathieu Lacage 2009-11-23 08:26:50 EST
This bug got fixed when we added real support for static optimized builds. i.e., -Wl,--whole-archive is the link-time option we used to deal with this.