Ruben Van Boxem
2011-07-26 19:04:47 UTC
Isn't that email subject a mouthful :)
In light of the previous discussion and my attempts to build a posix
threaded GCC, I have been looking through commit lists to find where the
checks are being done in the configury that do not enable libstdc++ threads
at the time of its compilation.
Let's gather up the facts:
C++0x std::thread is not automagically enabled. Specifically, I
commits (git version):
http://repo.or.cz/w/official-gcc.git/commit/968fd835d6eba899f937a1342b0a497b6188177e
http://repo.or.cz/w/official-gcc.git/commit/d5be2d8e8a35f4328f58d80debab5889dd68e32f
http://repo.or.cz/w/official-gcc.git/commit/a4290503e56ed1a53e90bccc4a6518b89b7c1e7a
http://repo.or.cz/w/official-gcc.git/commit/9b0cec020065c5d0df370d14e6b5c0b8e18b6c79
(they are listed newest to oldest)
These are all commits relating to setting some libstdc++ defines to enable
threading. I'm hoping there's a simple !mingw-like check that's easy to fix
in case of posix threaded gcc on all platforms, but the define relies on
several features (all related to atomic and threading functions/features
like nanosleep and condition variables) I do not know are available to us
when using winpthreads.
The checks need to be enabled for mingw targets, so the undefined reference
goes away when linking a program using std::thread. I hope the error
constant will magically also fix itself when this is fixed.
I do not know enough of autotools to figure this out though, any help is
appreciated.
I'll see if I can get a test build of GCC 4.6 (with Kai's posix threading
patches) built and uploaded soon.
Thanks!
Ruben
In light of the previous discussion and my attempts to build a posix
threaded GCC, I have been looking through commit lists to find where the
checks are being done in the configury that do not enable libstdc++ threads
at the time of its compilation.
Let's gather up the facts:
C++0x std::thread is not automagically enabled. Specifically, I
needed to perform the following manual steps (taken from K. Frank's
http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTihttp://repo.or.cz/w/official-gcc.git/commit/9b0cec020065c5d0df370d14e6b5c0b8e18b6c79kwrRkzOuUdKOO2ShYSG7zqt8qq3QmXPfZsYhGa%40mail.gmail.com&forum_name=mingw-w64-public<http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTikwrRkzOuUdKOO2ShYSG7zqt8qq3QmXPfZsYhGa%40mail.gmail.com&forum_name=mingw-w64-public>
- Add "-D_POSIX_TIMEOUTS -D_GLIBCXX__PTHREADS
-D_GLIBCXX_HAS_GTHREADS" to the commandline, along with "-std=c++0x"
of course.
- Uncomment the line in bits/error_constants.h (strange, Explorer
won't show this file, but grep found it anyways... it's not hidden
either)
- And that ends up in an undefined reference to "std::thread::join()".
These all smell like bad configury at libstdc++ build time. I found thesehttp://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTihttp://repo.or.cz/w/official-gcc.git/commit/9b0cec020065c5d0df370d14e6b5c0b8e18b6c79kwrRkzOuUdKOO2ShYSG7zqt8qq3QmXPfZsYhGa%40mail.gmail.com&forum_name=mingw-w64-public<http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTikwrRkzOuUdKOO2ShYSG7zqt8qq3QmXPfZsYhGa%40mail.gmail.com&forum_name=mingw-w64-public>
- Add "-D_POSIX_TIMEOUTS -D_GLIBCXX__PTHREADS
-D_GLIBCXX_HAS_GTHREADS" to the commandline, along with "-std=c++0x"
of course.
- Uncomment the line in bits/error_constants.h (strange, Explorer
won't show this file, but grep found it anyways... it's not hidden
either)
- And that ends up in an undefined reference to "std::thread::join()".
commits (git version):
http://repo.or.cz/w/official-gcc.git/commit/968fd835d6eba899f937a1342b0a497b6188177e
http://repo.or.cz/w/official-gcc.git/commit/d5be2d8e8a35f4328f58d80debab5889dd68e32f
http://repo.or.cz/w/official-gcc.git/commit/a4290503e56ed1a53e90bccc4a6518b89b7c1e7a
http://repo.or.cz/w/official-gcc.git/commit/9b0cec020065c5d0df370d14e6b5c0b8e18b6c79
(they are listed newest to oldest)
These are all commits relating to setting some libstdc++ defines to enable
threading. I'm hoping there's a simple !mingw-like check that's easy to fix
in case of posix threaded gcc on all platforms, but the define relies on
several features (all related to atomic and threading functions/features
like nanosleep and condition variables) I do not know are available to us
when using winpthreads.
The checks need to be enabled for mingw targets, so the undefined reference
goes away when linking a program using std::thread. I hope the error
constant will magically also fix itself when this is fixed.
I do not know enough of autotools to figure this out though, any help is
appreciated.
I'll see if I can get a test build of GCC 4.6 (with Kai's posix threading
patches) built and uploaded soon.
Thanks!
Ruben