public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* glibc test tst-thread_local1.cc fails to compile with latest GCC
@ 2016-10-19 17:45 Ellcey, Steve
  2016-10-19 17:51 ` Andrew Pinski
  2016-10-21 16:03 ` Jonathan Wakely
  0 siblings, 2 replies; 4+ messages in thread
From: Ellcey, Steve @ 2016-10-19 17:45 UTC (permalink / raw)
  To: libc-alpha, gcc

I have built the latest glibc sources with a ToT GCC and am trying to run the glibc testsuite now.  I ran into a couple of
new warnings that I fixed (locally) and am now looking at nptl/tst-thread_local1.cc which dies with:

tst-thread_local1.cc:172:7: error: ‘thread’ is not a member of ‘std’
       std::thread thr{[func] {func (nullptr);}};

Does anyone know what is going on here?  If I compile a small test program:

#include <thread>
int main(int, char **){
    std::thread tt;
}

With G++ 5.4 (using -std=c++11) this test program compiles. but with ToT GCC, it dies with:

g++ -std=c++11 thread.cc -lpthread -o x
thread.cc: In function ‘int main(int, char**)’:
thread.cc:5:5: error: ‘thread’ is not a member of ‘std’
     std::thread tt;
     ^~~
thread.cc:5:5: note: suggested alternative: ‘fread’
     std::thread tt;
     ^~~
     fread


Is there some C++ standard change that I am not aware of or some other header file I need to include?

Steve Ellcey

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: glibc test tst-thread_local1.cc fails to compile with latest GCC
  2016-10-19 17:45 glibc test tst-thread_local1.cc fails to compile with latest GCC Ellcey, Steve
@ 2016-10-19 17:51 ` Andrew Pinski
  2016-10-21 16:03 ` Jonathan Wakely
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Pinski @ 2016-10-19 17:51 UTC (permalink / raw)
  To: Ellcey, Steve; +Cc: libc-alpha, gcc

On Wed, Oct 19, 2016 at 10:45 AM, Ellcey, Steve <Steve.Ellcey@cavium.com> wrote:
> I have built the latest glibc sources with a ToT GCC and am trying to run the glibc testsuite now.  I ran into a couple of
> new warnings that I fixed (locally) and am now looking at nptl/tst-thread_local1.cc which dies with:
>
> tst-thread_local1.cc:172:7: error: ‘thread’ is not a member of ‘std’
>        std::thread thr{[func] {func (nullptr);}};
>
> Does anyone know what is going on here?  If I compile a small test program:
>
> #include <thread>
> int main(int, char **){
>     std::thread tt;
> }
>
> With G++ 5.4 (using -std=c++11) this test program compiles. but with ToT GCC, it dies with:
>
> g++ -std=c++11 thread.cc -lpthread -o x
> thread.cc: In function ‘int main(int, char**)’:
> thread.cc:5:5: error: ‘thread’ is not a member of ‘std’
>      std::thread tt;
>      ^~~
> thread.cc:5:5: note: suggested alternative: ‘fread’
>      std::thread tt;
>      ^~~
>      fread

I Just tested it with revision 241328 of GCC, it works ...

apinski@apinski-ss1:~/src/local4$ ./tools/bin/g++ t88.cc -std=c++11  -mabi=ilp32
apinski@apinski-ss1:~/src/local4$ ./a.out


Thanks,
Andrew

>
>
> Is there some C++ standard change that I am not aware of or some other header file I need to include?
>
> Steve Ellcey

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: glibc test tst-thread_local1.cc fails to compile with latest GCC
  2016-10-19 17:45 glibc test tst-thread_local1.cc fails to compile with latest GCC Ellcey, Steve
  2016-10-19 17:51 ` Andrew Pinski
@ 2016-10-21 16:03 ` Jonathan Wakely
  2016-10-21 16:07   ` Steve Ellcey
  1 sibling, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2016-10-21 16:03 UTC (permalink / raw)
  To: Ellcey, Steve; +Cc: libc-alpha, gcc

On 19 October 2016 at 18:45, Ellcey, Steve wrote:
> I have built the latest glibc sources with a ToT GCC and am trying to run the glibc testsuite now.  I ran into a couple of
> new warnings that I fixed (locally) and am now looking at nptl/tst-thread_local1.cc which dies with:
>
> tst-thread_local1.cc:172:7: error: ‘thread’ is not a member of ‘std’
>        std::thread thr{[func] {func (nullptr);}};
>
> Does anyone know what is going on here?  If I compile a small test program:
>
> #include <thread>
> int main(int, char **){
>     std::thread tt;
> }
>
> With G++ 5.4 (using -std=c++11) this test program compiles. but with ToT GCC, it dies with:
>
> g++ -std=c++11 thread.cc -lpthread -o x
> thread.cc: In function ‘int main(int, char**)’:
> thread.cc:5:5: error: ‘thread’ is not a member of ‘std’
>      std::thread tt;
>      ^~~
> thread.cc:5:5: note: suggested alternative: ‘fread’
>      std::thread tt;
>      ^~~
>      fread
>
>
> Is there some C++ standard change that I am not aware of or some other header file I need to include?

No, what probably happened is GCC didn't detect a usable Pthreads
implementation and so doesn't define std::thread. The <thread> header
uses this condition around the definition of std::thread:

#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: glibc test tst-thread_local1.cc fails to compile with latest GCC
  2016-10-21 16:03 ` Jonathan Wakely
@ 2016-10-21 16:07   ` Steve Ellcey
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Ellcey @ 2016-10-21 16:07 UTC (permalink / raw)
  To: Jonathan Wakely, Ellcey, Steve; +Cc: libc-alpha, gcc

On Fri, 2016-10-21 at 17:03 +0100, Jonathan Wakely wrote:
> 
> > Is there some C++ standard change that I am not aware of or some
> > other header file I need to include?
> No, what probably happened is GCC didn't detect a usable Pthreads
> implementation and so doesn't define std::thread. The <thread> header
> uses this condition around the definition of std::thread:
> 
> #if defined(_GLIBCXX_HAS_GTHREADS) &&
> defined(_GLIBCXX_USE_C99_STDINT_TR1)

Yes, I finally realized I had built a GCC with '--enable-threads=no'
and was using that GCC to build GLIBC.  Once I rebuilt GCC with threads
I could build GLIBC and not get this error.

Steve Ellcey

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-21 16:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-19 17:45 glibc test tst-thread_local1.cc fails to compile with latest GCC Ellcey, Steve
2016-10-19 17:51 ` Andrew Pinski
2016-10-21 16:03 ` Jonathan Wakely
2016-10-21 16:07   ` Steve Ellcey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).