Bug 705 - netanim code does not build on win32
netanim code does not build on win32
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: general
ns-3-dev
PC Windows
: P2 normal
Assigned To: ns-bugs
:
Depends on: 691
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-05 10:18 UTC by Gustavo J. A. M. Carneiro
Modified: 2009-11-05 05:35 UTC (History)
4 users (show)

See Also:


Attachments
disable netanim if the includes are missing (2.29 KB, patch)
2009-10-05 10:18 UTC, Gustavo J. A. M. Carneiro
Details | Diff
start of patch (2.40 KB, patch)
2009-10-05 11:33 UTC, Gustavo J. A. M. Carneiro
Details | Diff
full patch (3.21 KB, patch)
2009-11-03 12:30 UTC, Josh Pelkey
Details | Diff
Patch to make mingw building works (2.81 KB, patch)
2009-11-04 13:03 UTC, Faker Moatamri
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo J. A. M. Carneiro 2009-10-05 10:18:31 UTC
Created attachment 618 [details]
disable netanim if the includes are missing

netanim code does not build on win32 (mingw) due to the missing includes (sys/socket.h for one).
Comment 1 Josh Pelkey 2009-10-05 11:06:25 UTC
This looks good to me.  I'll CC Dr. Riley to make sure he sees this one.  Thanks Gustavo.
Comment 2 George Riley 2009-10-05 11:14:22 UTC
Wouldn't it be better to just #ifdef out the socket output feature of
NetAnim if the socket includes can't be found?  
George
Comment 3 Gustavo J. A. M. Carneiro 2009-10-05 11:25:34 UTC
(In reply to comment #2)
> Wouldn't it be better to just #ifdef out the socket output feature of
> NetAnim if the socket includes can't be found?  
> George
> 

Possibly.  I do not know enough of the net-anim code to know for sure, I was just trying to make mingw compile again.  So you are telling me that net-anim is still useful without the socket code and should still be compiled?
Comment 4 Gustavo J. A. M. Carneiro 2009-10-05 11:33:39 UTC
Created attachment 619 [details]
start of patch

To bootstrap the second approach, here's a patch that disables the socket includes if they are not found.  But now someone more knowledgeable than me about netanim should figure out how to disable the rest of the code that uses sockets, and code to put as fallback.
Comment 5 George Riley 2009-10-05 16:20:09 UTC
(In reply to comment #4)
> Created an attachment (id=619) [details]
> start of patch
> 
> To bootstrap the second approach, here's a patch that disables the socket
> includes if they are not found.  But now someone more knowledgeable than me
> about netanim should figure out how to disable the rest of the code that uses
> sockets, and code to put as fallback.
> 

I posted this reply earlier today but for some reason appears to not have
gone through.  The short answer is that yes, the Animator is quite useful
without the sockets.  The sockets interface simply allows an animation
to connect to a "running" simulation and display the state as the simulation
progresses.  Without sockets, the animation interface can write to a file
(which I suspect is the most popular approach anyway).  After the simulation
completes the animator reads the file and animates after the fact.

George
Comment 6 Josh Pelkey 2009-11-03 12:30:43 UTC
Created attachment 644 [details]
full patch

Ok, all I've done is used Gustavo's patch and added in the ifdefs around AnimationInterface::SetServerPort and also in test-dumbbell where this function is potentially called.  I also moved the #include "ns3/net-anim-config.h" in animation-interface.cc to animation-interface.h, because I needed to ifdef out the where SetServerPort is defined.
Comment 7 Josh Pelkey 2009-11-03 12:32:39 UTC
(In reply to comment #6)
> Created an attachment (id=644) [details]
> full patch
> 
> Ok, all I've done is used Gustavo's patch and added in the ifdefs around
> AnimationInterface::SetServerPort and also in test-dumbbell where this function
> is potentially called.  I also moved the #include "ns3/net-anim-config.h" in
> animation-interface.cc to animation-interface.h, because I needed to ifdef out
> the where SetServerPort is defined.
> 

Also, using my patch will require that the "start of patch" that Gustavo posted be applied first (so I shouldn't have crossed it out).
Comment 8 Faker Moatamri 2009-11-04 13:03:16 UTC
Created attachment 645 [details]
Patch to make mingw building works

Hi all,
Here is a patch for this bug, I verified it works under linux and mingwin. Please take a look at it and if it is good, I will apply it to ns-3-dev.
Basically it contains the changes done by Gustavo, I removed the includes socket.h and in.h in point-to-point-dubbell-helper.cc (not used) and added an include fcntl.h conditional to MINGW platform in order to support the file operations. Josh you can if you want combine our patches and produce a final patch if you need to add anything else. The #if I put it inside AnimationInterface::SetServerPort sothat I don't need to put another one in test-dumbbell and it will return false under Mingw.
Best regards
Faker Moatamri
Comment 9 Faker Moatamri 2009-11-04 13:04:58 UTC
Hi all,
Here is a patch for this bug, I verified it works under linux and mingwin. Please take a look at it and if it is good, I will apply it to ns-3-dev.
Basically it contains the changes done by Gustavo, I removed the includes socket.h and in.h in point-to-point-dubbell-helper.cc (not used) and added an include fcntl.h conditional to MINGW platform in order to support the file operations. Josh you can if you want combine our patches and produce a final patch if you need to add anything else. The #if I put it inside AnimationInterface::SetServerPort sothat I don't need to put another one in test-dumbbell and it will return false under Mingw.
Best regards
Faker Moatamri
Comment 10 Faker Moatamri 2009-11-04 13:11:25 UTC
Sorry for duplicate posts and sorry Josh, I didn't know that you were working on it, can you please take a look at my patch and tell me if there are some changes that needs to be done?
Thanks
Comment 11 Josh Pelkey 2009-11-04 15:16:47 UTC
(In reply to comment #10)
> Sorry for duplicate posts and sorry Josh, I didn't know that you were working
> on it, can you please take a look at my patch and tell me if there are some
> changes that needs to be done?
> Thanks
> 

No problem.  I think your patch is better, and I am happy with the changes.  No objections from me.
Comment 12 Faker Moatamri 2009-11-05 05:35:41 UTC
changeset 5477	ff7b28fe6a5c