Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH][gdb/build] Fix build with undefined CXX_STD_THREAD
Date: Tue, 7 Sep 2021 17:19:23 +0200	[thread overview]
Message-ID: <a30c92e2-cd35-8403-3382-d7dc32f90c8f@suse.de> (raw)
In-Reply-To: <20210907145006.GA4878@delia>

On 9/7/21 4:50 PM, Tom de Vries via Gdb-patches wrote:
> Hi,
> 
> When building gdb on openSUSE Leap 42.3, we trigger the case that
> CXX_STD_THREAD is undefined, and run into:
> ...
> gdb/maint.c: In function ‘void maintenance_show_worker_threads \
>   (ui_file*, int, cmd_list_element*, const char*)’:
> gdb/maint.c:877:14: error: ‘gdb::thread_pool’ has not been declared
>          gdb::thread_pool::g_thread_pool->thread_count ());
>               ^
> Makefile:1647: recipe for target 'maint.o' failed
> make[1]: *** [maint.o] Error 1
> ...
> 
> Fix this by handling the undefined CXX_STD_THREAD case in
> maintenance_show_worker_threads, such that we get:
> ...
> $ gdb -q -batch -ex "maint show worker-thread"
> The number of worker threads GDB can use is 0.
> ...
> 
> Tested on x86_64-linux.
> 
> Any comments?
> 

Btw, I just found a related issue.

I find:
...
CXX_DIALECT='-std=gnu++11'
...
in the config.log, but that setting is not used when checking for
CXX_STD_THREAD, so we have:
...
configure:14614: checking for std::thread
configure:14631: g++ -c -pthread -Wall -O2 -g     conftest.cpp >&5
In file included from /usr/include/c++/4.8/thread:35:0,
                 from conftest.cpp:167:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file
requires compiler and library support for the ISO C++ 2011 standard.
This support is currently experimental, and must be enabled with the
-std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
conftest.cpp: In function 'int main()':
conftest.cpp:172:1: error: 'thread' is not a member of 'std'
 std::thread t(callback);
 ^
conftest.cpp:172:13: error: expected ';' before 't'
 std::thread t(callback);
             ^
configure:14631: $? = 1
...

It could be that:
...
$ g++ -std=gnu++11 -c -pthread -Wall -O2 -g     conftest.cpp
...
actually would succeed.

Thanks,
- Tom


  reply	other threads:[~2021-09-07 15:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07 14:50 Tom de Vries via Gdb-patches
2021-09-07 15:19 ` Tom de Vries via Gdb-patches [this message]
2021-09-07 16:12   ` Christian Biesinger via Gdb-patches
2021-09-08  7:02     ` Tom de Vries via Gdb-patches
2021-09-08  8:06   ` Tom de Vries via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a30c92e2-cd35-8403-3382-d7dc32f90c8f@suse.de \
    --to=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox