Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000087Rosetta[All Projects] Crashpublic2012-08-23 16:572012-09-20 14:32
Reportersmlewis 
Assigned Tosmlewis 
PrioritynormalSeveritycrashReproducibilityunable to reproduce
StatusconfirmedResolutionopen 
PlatformFedora 17 with GCC 4.7OSFedoraOS Version17
Product Version3.4 
Fixed in Version 
Summary0000087: Compiler error for GCC 4.7: src/protocols/jd2/SingleFileBuffer.cc:148:13: error: 'sleep' was not declared in this scope
Descriptionhttp://www.rosettacommons.org/content/keyerror-unknown-version-number-47-compiler-gcc-fedora-17 [^]

Appears #include <unistd.h> will fix it, but I'm not sure that's the optimal fix for trunk
Additional InformationIs it worthwhile to mock up a 4.7-specific ifdef in this code? What about just including unistd.h in all cases (does that even work?) I assume from the nomenclature that it's a c header not a C++ standard library header so I'm loath to do that.
TagsNo tags attached.
Application(s) Affectedcompilation bug
Command Line Usedcompilation bug
Developer Options
Fixed in SVN Version
Attached Files

- Relationships

-  Notes
(0000084)
smlewis (Administrator)
2012-08-27 09:57

#include <unistd.h> allows compilation in this case.

I have not changed anything in SVN and am not marking this as fixed until/unless someone with GCC 4.7 can test out possibly-more-appropriate headers.
(0000085)
smlewis (Administrator)
2012-08-27 09:58

#include <unistd.h> allows compilation in this case.

I have not changed anything in SVN and am not marking this as fixed until/unless someone with GCC 4.7 can test out possibly-more-appropriate headers.
(0000107)
honda (Developer)
2012-09-20 11:53

How about providing a home-made sleep() using the standard C library's nanosleep()?

#include <time.h>
// sleep for secs seconds. return 0 if completes without interruption.
int sleep(int secs) {

   // time to sleep
   struct timespec req;
   req.tv_sec = secs;
   req.tv_nsec = 0;

   // remaining time in ns will be saved here if interrupted.
   // nothing will be saved when NULL.
   struct timespec * rem = NULL;

   // return 0 if successful. non-zero otherwise
   return nanosleep( &req, rem );
}
(0000108)
smlewis (Administrator)
2012-09-20 14:32

I spoke briefly with Andrew, who agrees that "#include <unistd.h>" is not a viable solution.

The bigger question is, what sleep() does SingleFileBuffer think it is calling, is it calling that function in all versions/compilers or is it accidentally miscompiling, and finally why does 4.7 treat it differently than other version?

I guess a locally-defined sleep() is a functional solution, but it implies that there really isn't a portable, STL-defined function that does that, which seems strange...

- Issue History
Date Modified Username Field Change
2012-08-23 16:57 smlewis New Issue
2012-08-27 09:57 smlewis Note Added: 0000084
2012-08-27 09:58 smlewis Note Added: 0000085
2012-08-27 09:58 smlewis Assigned To => smlewis
2012-08-27 09:58 smlewis Status new => confirmed
2012-09-20 11:53 honda Note Added: 0000107
2012-09-20 14:32 smlewis Note Added: 0000108


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker