Bugzilla – Full Text Bug Listing |
Summary: | real time scheduler not compiling in MingW | ||
---|---|---|---|
Product: | ns-3 | Reporter: | Gustavo J. A. M. Carneiro <gjcarneiro> |
Component: | core | Assignee: | ns-bugs <ns-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P3 | ||
Version: | pre-release | ||
Hardware: | PC | ||
OS: | Windows | ||
Attachments: | mingw fix |
Description
Gustavo J. A. M. Carneiro
2008-08-28 07:35:43 UTC
same problem in os x powerpc: [262/487] cxx: src/simulator/wall-clock-synchronizer.cc -> build/debug/src/simulator/wall-clock-synchronizer_1.o ../src/simulator/wall-clock-synchronizer.cc: In constructor 'ns3::WallClockSynchronizer::WallClockSynchronizer()': ../src/simulator/wall-clock-synchronizer.cc:60: error: 'CLOCK_REALTIME' was not declared in this scope ../src/simulator/wall-clock-synchronizer.cc:60: error: 'clock_getres' was not declared in this scope Build failed -> task failed (err #129): [bld:///scratch/hg/ns-3-dev/src/simulator/wall-clock-synchronizer_1.o] same on osX works now on cygwin, osx but don't have mingw to test on. Does mingw not even know what a struct timespec is? confirm fix on osX intel. Created attachment 243 [details]
mingw fix
I have code ready to commit that leaves out the real time simulator components if the include file "<sched.h>" is not available. OK to commit?
The file <sched.h> (posix process priority and cpu affiniity) really doesn't have anything to do with this, right? The important part is that MinGW apparently doesn't know what a timespec is, right? I'm installing MinGW to see for myself, but if this was the problem, I just checked in some code to not use timespec at all in the case that CLOCK_REALTIME isn't defined. Please check it for me since I cannot yet. [269/533] cxx: src\simulator\wall-clock-synchronizer.cc -> build\debug\src\simul ator\wall-clock-synchronizer_1.o ..\src\simulator\wall-clock-synchronizer.cc:21:19: sched.h: No such file or dire ctory Build failed -> task failed (err #129): [bld://P:\ns\ns-3-dev\src\simulator\wall-clock-synch ronizer_1.o] About your commit, you can #ifdef out certain methods and the real time scheduler still works? If so, what is the point of having those methods? OK, two more data points: 1. Removing the #include <sched.h> makes the code compile both in mingw and linux. Apparently sched.h is only used for some code inside #if 0 ... #endif. 2. In wall-clock-synchronizer.h you use #ifdef CLOCK_REALTIME. However, since that header file doesn't include <time.h> won't CLOCK_REALTIME be always undefined (unless by luck whoever includes wall-clock-synchronizer.h had already included time.h first) ? 3. The "#ifdef CLOCK_REALTIME"'ed methods, TimespecToNs and TimespecAdd are protected and currently unused, so I reiterate my suggestion to remove them completely; they are causing portability problems and have no use. Removed the high resolution clocks since the expected use case did not materialize. Verified builds correctly on MinGW-5.1.4 |