C++ standard library is compiled with nanosleep and yield switched OFF
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-4.6 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
INTRODUCTION
-------
The C++ library has internal macros called _GLIBCXX_
Normally the macros are defined in x86_64-
When _GLIBCXX_
Specifically, in "thread" there is a section which begins with "#ifdef _GLIBCXX_
The _GLIBCXX_
PROBLEM
-------
C++ code which depends on the relevant parts of the C++ standard simply cannot be compiled.
There is no known and reliable workaround for this problem.
WHY IT HAPPENED
-------
I am not 100% sure, but there seem to be a bug in a test program which check for the presence of nanosleep. It is a part of "configure", which is in turn generated from acinclude.m4.
In order to test for nanosleep the following program is used:
#include <unistd.h>
#include <time.h>
int
main ()
{
#if _POSIX_TIMERS > 0 && defined(
timespec tp;
#endif
clock_
;
return 0;
}
The program is missing "struct" before "timespec tp;". In fact, there are three places in the file where the "struct" is missing.
As for "yield", I am not sure yet why it is missing but the reason is probably similar.
SCOPE
-------
Both macros are NOT enabled in Ubuntu releases after 12.04 LTS, including the to-be-released Ubuntu 14.04 LTS.
For example, on Ubuntu 13.10:
rtvd@localhost $ pwd
/usr/include/c++
rtvd@localhost $ grep -r _GLIBCXX_
4.6/thread:#ifdef _GLIBCXX_
4.6/x86_
4.6/x86_
4.6.4/
4.6.4/
4.6.4/
4.7/thread:#ifdef _GLIBCXX_
4.7.3/
4.8/thread:#ifdef _GLIBCXX_
4.8.1/
On Ubuntu 12.04 LTS (notice #define ...) everything is good:
rtvd@localhost $ pwd
/usr/include/c++
rtvd@localhost $ grep -r _GLIBCXX_
4.6/x86_
4.6/x86_
4.6/thread:#ifdef _GLIBCXX_
4.6.3/
4.6.3/
4.6.3/
On Debian 7.3 the macros are defined (notice #define ... in each version of the library), so C++ library is good there too:
rtvd@debiantes
/usr/include/c++
rtvd@debiantes
4.6/x86_
4.6/x86_
4.6/thread:#ifdef _GLIBCXX_
4.6.3/
4.6.3/
4.6.3/
4.7/x86_
4.7/x86_
4.7/thread:#ifdef _GLIBCXX_
4.7.2/
4.7.2/
4.7.2/
To be clear, gcc-4.6 is affected starting from gcc-4.6.4. gcc-4.6.3 which comes with Ubuntu 12.04 LTS is still good.
Also, gcc-4.7 and gcc-4.8 are affected.