Bug 40

Summary: Samples/Examples linked shared sometimes do nothing or hang
Product: ns-3 Reporter: Craig Dowell <craigdo>
Component: samplesAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: blocker CC: gjcarneiro, tomh
Priority: P1    
Version: pre-release   
Hardware: PC   
OS: Windows   

Description Craig Dowell 2007-06-19 17:07:43 UTC
One symptom is that programs appear to run, but don't do anything.  When run with a debugger, you see something like the following,  
 
(gdb) run
Starting program: /usr/craigdo/repos/ns-3-devx/build-dir/dbg-shared/bin/sample-ptr.exe
gdb: unknown target exception 0xc0000135 at 0x7c964ed1
 
Program received signal ?, Unknown signal.
 
Program exited with code 030000000465.
You can't do that without a process to debug.
(gdb)
 
The "signal" is a Microsoft HRESULT which corresponds to the error "The application failed to initialize properly (0xc0000135)."  This turned out in this case to mean that the (Cygwin) system could find the ns-3 DLLs but (Windows) couldn't load them.  This happened because the Windows environment needs to be pointed to the lib directory as well as the Cygwin environment.  I added 
 
;C:/cygwin/usr/craigdo/repos/ns-3-devx/build-dir/dbg-shared/bin
 
to the windows $PATH and the simpler samples started working correctly.  Unfortunately, sample-simple.exe and simple-p2p.exe now hang while trying to initialize DLLs.
Comment 1 Gustavo J. A. M. Carneiro 2007-06-19 18:31:01 UTC
Why do we even have to support cygwin if ns-3 builds and runs fine with mingw?  mingw is better because it doesn't use a fake libc and therefore produces native exe that requires no dll.
Comment 2 Tom Henderson 2007-06-19 19:41:25 UTC
*** Bug 31 has been marked as a duplicate of this bug. ***
Comment 3 Gustavo J. A. M. Carneiro 2007-08-02 10:14:30 UTC
Is this is fixed already?  I mean, this is the problem of the DLLs not having the ns3 prefix, right?  If so, should be fixed now.  If it's another problem then by all means leave it open.
Comment 4 Tom Henderson 2007-08-03 14:40:19 UTC
The prefix fix led to the discovery of another problem with shared libraries in Cygwin, where Craig initiated a small private thread on the topic:

"The problem is that a lot of other code relies on this specific c++
usage pattern where a class static member method contains a
function-scope static variable and we really cannot convert these
function-scope static variables to class static member variables because
of the initialization ordering problems I alluded to earlier. And even
if we did this, we would have to do this dreadful macro game to avoid
multiple definitions."

Mathieu told me that he is looking at solutions to this problem.
Comment 5 Gustavo J. A. M. Carneiro 2007-09-13 05:49:22 UTC
I think this is fixed already?
Comment 6 Tom Henderson 2007-09-14 01:05:56 UTC
this was fixed in previous release by Mathieu.