public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/28318] New: [gdb/build] std::thread support configure check does not used CXX_DIALECT
@ 2021-09-08  7:49 vries at gcc dot gnu.org
  2021-09-08  8:04 ` [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT vries at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-08  7:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28318

            Bug ID: 28318
           Summary: [gdb/build] std::thread support configure check does
                    not used CXX_DIALECT
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

As reported here
(https://sourceware.org/pipermail/gdb-patches/2021-September/181862.html ):
...
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.
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT
  2021-09-08  7:49 [Bug build/28318] New: [gdb/build] std::thread support configure check does not used CXX_DIALECT vries at gcc dot gnu.org
@ 2021-09-08  8:04 ` vries at gcc dot gnu.org
  2021-09-08  8:48 ` vries at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-08  8:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28318

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[gdb/build] std::thread     |[gdb/build] std::thread
                   |support configure check     |support configure check
                   |does not used CXX_DIALECT   |does not use CXX_DIALECT
                 CC|                            |palves at sourceware dot org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
We have a custom implementation of AX_CXX_COMPILE_STDCXX at
gdb/ax_cxx_compile_stdcxx.m4:
...
    Use AX_CXX_COMPILE_STDCXX to detect if the compiler supports C++11,
    and if -std=xxx switches are necessary to enable C++11.

    We need to tweak AX_CXX_COMPILE_STDCXX a bit though.  Pristine
    upstream AX_CXX_COMPILE_STDCXX appends -std=gnu++11 to CXX directly.
    That doesn't work for us, because the top level Makefile passes CXX
    down to subdirs, and that overrides whatever gdb/Makefile may set CXX
    to.  The result would be that a make invocation from the build/gdb/
    directory would use "g++ -std=gnu++11" as expected, while a make
    invocation at the top level would not.

    So instead of having AX_CXX_COMPILE_STDCXX set CXX directly, tweak it
    to AC_SUBST a separate variable -- CXX_DIALECT -- and use '$(CXX)
    (CXX_DIALECT)' to compile/link.
...
which introduced the CXX_DIALECT.

If we would use the regular AX_CXX_COMPILE_STDCXX, AFAIU the problem would not
occur.

So, either:
- we add CXX_DIALECT to all uses of CXX in the configure script, or 
- we add CXX_DIALECT to CXX directly.  AFAIU, that wouldn't break anything
  though it would result in confusing double options in command lines.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT
  2021-09-08  7:49 [Bug build/28318] New: [gdb/build] std::thread support configure check does not used CXX_DIALECT vries at gcc dot gnu.org
  2021-09-08  8:04 ` [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT vries at gcc dot gnu.org
@ 2021-09-08  8:48 ` vries at gcc dot gnu.org
  2021-09-08  8:51 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-08  8:48 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28318

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 13657
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13657&action=edit
[gdb/build] Add CXX_DIALECT to CXX

(In reply to Tom de Vries from comment #1)
> - we add CXX_DIALECT to CXX directly.  AFAIU, that wouldn't break anything
>   though it would result in confusing double options in command lines.

Patch implementing this.

Indeed now we have:
...
configure:8916: checking for std::thread
configure:8933: g++ -std=gnu++11 -c -pthread -Wall -O2 -g     conftest.cpp >&5
configure:8933: $? = 0
configure:8940: result: yes
...
but indeed in the build/gdb/Makefile:
...
CXX = g++ -std=gnu++11
CXX_DIALECT = -std=gnu++11
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT
  2021-09-08  7:49 [Bug build/28318] New: [gdb/build] std::thread support configure check does not used CXX_DIALECT vries at gcc dot gnu.org
  2021-09-08  8:04 ` [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT vries at gcc dot gnu.org
  2021-09-08  8:48 ` vries at gcc dot gnu.org
@ 2021-09-08  8:51 ` vries at gcc dot gnu.org
  2021-09-08 12:16 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-08  8:51 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28318

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> but indeed in the build/gdb/Makefile:
> ...
> CXX = g++ -std=gnu++11
> CXX_DIALECT = -std=gnu++11
> ...

As well as:
...
CC = gcc -std=gnu99
...

It seems we have CXX_DIALECT but not C_DIALECT.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT
  2021-09-08  7:49 [Bug build/28318] New: [gdb/build] std::thread support configure check does not used CXX_DIALECT vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-09-08  8:51 ` vries at gcc dot gnu.org
@ 2021-09-08 12:16 ` vries at gcc dot gnu.org
  2021-10-04 16:56 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-08 12:16 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28318

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2021-September/181876.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT
  2021-09-08  7:49 [Bug build/28318] New: [gdb/build] std::thread support configure check does not used CXX_DIALECT vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-09-08 12:16 ` vries at gcc dot gnu.org
@ 2021-10-04 16:56 ` cvs-commit at gcc dot gnu.org
  2021-10-04 16:58 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-04 16:56 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28318

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The gdb-11-branch branch has been updated by Tom de Vries
<vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9b4d030ed52b52fe208edaa8be640f4dd359defc

commit 9b4d030ed52b52fe208edaa8be640f4dd359defc
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Oct 4 18:56:42 2021 +0200

    [gdb/build] Add CXX_DIALECT to CXX

    Say we use a gcc version that (while supporting c++11) does not support
c++11
    by default, and needs an -std setting to enable it.

    If gdb would use the default AX_CXX_COMPILE_STDCXX from autoconf-archive,
then
    we'd have:
    ...
    CXX="g++ -std=gnu++11"
    ...

    That mechanism however has the following problem (quoting from commit
    0bcda685399):
    ...
    the top level Makefile passes CXX down to subdirs, and that overrides
whatever
    gdb/Makefile may set CXX to.  The result would be that a make invocation
from
    the build/gdb/ directory would use "g++ -std=gnu++11" as expected, while a
    make invocation at the top level would not.
    ...

    Commit 0bcda685399 fixes this by using a custom AX_CXX_COMPILE_STDCXX which
    does:
    ...
    CXX=g++
    CXX_DIALECT=-std=gnu++11
    ...

    The problem reported in PR28318 is that using the custom instead of the
    default AX_CXX_COMPILE_STDCXX makes the configure test for std::thread
    support fail.

    We could simply add $CXX_DIALECT to the test for std::thread support, but
    that would have to be repeated for each added c++ support test.

    Instead, fix this by doing:
    ...
    CXX="g++ -std=gnu++11"
    CXX_DIALECT=-std=gnu++11
    ...

    This is somewhat awkward, since it results in -std=gnu++11 occuring twice
in
    some situations:
    ...
    $ touch src/gdb/dwarf2/read.c
    $ ( cd build/gdb; make V=1 dwarf2/read.o )
    g++-4.8 -std=gnu++11 -x c++ -std=gnu++11 ...
    ...

    However, both settings are needed:
     - the switch in CXX for the std::thread tests (and other tests)
     - the switch in CXX_DIALECT so it can be appended in Makefiles, to
       counteract the fact that the top-level Makefile overrides CXX

    The code added in gdb/ax_cxx_compile_stdcxx.m4 is copied from the default
    AX_CXX_COMPILE_STDCXX from autoconf-archive.

    Tested on x86_64-linux.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28318

    gdb/ChangeLog:

    2021-10-04  Tom de Vries  <tdevries@suse.de>

            PR build/28318
            * ax_cxx_compile_stdcxx.m4: Add CXX_DIALECT to CXX.
            * configure: Regenerate.

    gdbserver/ChangeLog:

    2021-10-04  Tom de Vries  <tdevries@suse.de>

            PR build/28318
            * configure: Regenerate.

    gdbsupport/ChangeLog:

    2021-10-04  Tom de Vries  <tdevries@suse.de>

            PR build/28318
            * configure: Regenerate.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT
  2021-09-08  7:49 [Bug build/28318] New: [gdb/build] std::thread support configure check does not used CXX_DIALECT vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-10-04 16:56 ` cvs-commit at gcc dot gnu.org
@ 2021-10-04 16:58 ` vries at gcc dot gnu.org
  2021-10-04 18:31 ` brobecker at gnat dot com
  2021-10-04 18:58 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-04 16:58 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28318

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
This should be closed with target milestone 11.2, waiting for milestone to
become available.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT
  2021-09-08  7:49 [Bug build/28318] New: [gdb/build] std::thread support configure check does not used CXX_DIALECT vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-10-04 16:58 ` vries at gcc dot gnu.org
@ 2021-10-04 18:31 ` brobecker at gnat dot com
  2021-10-04 18:58 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: brobecker at gnat dot com @ 2021-10-04 18:31 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28318

Joel Brobecker <brobecker at gnat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.2
                 CC|                            |brobecker at gnat dot com

--- Comment #7 from Joel Brobecker <brobecker at gnat dot com> ---
Adding the 11.2 milestone to indicate that this was fixed in that version.
Otherwise, we'll be missing this item from the 11.2 release announcement.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT
  2021-09-08  7:49 [Bug build/28318] New: [gdb/build] std::thread support configure check does not used CXX_DIALECT vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-10-04 18:31 ` brobecker at gnat dot com
@ 2021-10-04 18:58 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-04 18:58 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28318

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #8 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch committed to trunk and gdb-11-branch, marking resolved-fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-10-04 18:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08  7:49 [Bug build/28318] New: [gdb/build] std::thread support configure check does not used CXX_DIALECT vries at gcc dot gnu.org
2021-09-08  8:04 ` [Bug build/28318] [gdb/build] std::thread support configure check does not use CXX_DIALECT vries at gcc dot gnu.org
2021-09-08  8:48 ` vries at gcc dot gnu.org
2021-09-08  8:51 ` vries at gcc dot gnu.org
2021-09-08 12:16 ` vries at gcc dot gnu.org
2021-10-04 16:56 ` cvs-commit at gcc dot gnu.org
2021-10-04 16:58 ` vries at gcc dot gnu.org
2021-10-04 18:31 ` brobecker at gnat dot com
2021-10-04 18:58 ` vries at gcc dot gnu.org

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).