#2871: Fails to build with GCC 6: declaration of ... has a different exception
specifier
-----------------------+-------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.4
Component: Compiling | Version: 7.0.2
Keywords: | CPU: Unspecified
Platform: Linux |
-----------------------+-------------------------
As reported by Martin Michlmayr in [https://bugs.debian.org/811886 Debian
Bug #811886]:
> This package fails to build with GCC 6. GCC 6 has not been released
yet, but it's expected that GCC 6 will become the default compiler for
stretch.
>
> Note that only the first error is reported; there might be more. You
can find a snapshot of GCC 6 in experimental. To build with GCC 6, you
can set CC=gcc-6 CXX=g++-6 explicitly.
>
> You may be able to find out more about this issue at
> https://gcc.gnu.org/gcc-6/changes.html
> {{{
> sbuild (Debian sbuild) 0.67.0 (26 Dec 2015) on dl580gen9-02.hlinux
> ...
> c++ -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong
-Wformat -Werror=format-security -fPIC -I/<<PKGBUILDDIR>>/dist.x86_64-pc-
linux-gnu/include -I/<<PKGBUILDDIR>>/dist.x86_64-pc-linux-gnu/include
-DPACKAGE=\""grasslibs"\" -I/<<PKGBUILDDIR>>/dist.x86_64-pc-linux-
gnu/include -I/<<PKGBUILDDIR>>/dist.x86_64-pc-linux-gnu/include
-DRELDIR=\"lib/iostream\" -o OBJ.x86_64-pc-linux-gnu/rtimer.o -c
rtimer.cpp
> mm.cpp: In function 'void* operator new (size_t)':
> mm.cpp:279:7: error: declaration of 'void* operator new (size_t) throw
(std::bad_alloc)' has a different exception specifier
> void* operator new (size_t sz) throw(std::bad_alloc) {
> ^~~~~~~~
>
> In file included from mm.cpp:49:0:
> /<<PKGBUILDDIR>>/dist.x86_64-pc-linux-
gnu/include/grass/iostream/mm.h:132:17: note: from previous declaration
'void* operator new (std::size_t)'
> friend void * operator new(size_t) throw(std::bad_alloc);
> ^~~~~~~~
>
> mm.cpp: In function 'void* operator new(size_t)':
> mm.cpp:330:7: error: declaration of 'void* operator new(size_t) throw
(std::bad_alloc)' has a different exception specifier
> void* operator new (size_t sz) throw(std::bad_alloc) {
> ^~~~~~~~
>
> In file included from mm.cpp:49:0:
> /<<PKGBUILDDIR>>/dist.x86_64-pc-linux-
gnu/include/grass/iostream/mm.h:131:17: note: from previous declaration
'void* operator new(std::size_t)'
> friend void * operator new(size_t) throw(std::bad_alloc);
> ^~~~~~~~
>
> ../../include/Make/Compile.make:35: recipe for target 'OBJ.x86_64-pc-
linux-gnu/mm.o' failed
> }}}
#2871: Fails to build with GCC 6: declaration of ... has a different exception
specifier
--------------------------+-------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.4
Component: Compiling | Version: 7.0.2
Resolution: | Keywords:
CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
#2871: Fails to build with GCC 6: declaration of ... has a different exception
specifier
--------------------------+-------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.4
Component: Compiling | Version: 7.0.2
Resolution: | Keywords:
CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Comment (by neteler):
I don't know much about C++ but is the suggestion given here of any use?
#2871: Fails to build with GCC 6: declaration of ... has a different exception
specifier
--------------------------+-------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.4
Component: Compiling | Version: 7.0.2
Resolution: | Keywords:
CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Comment (by sebastic):
My understanding of C++ is not sufficient to judge that either. It does
seem like a good suggestion.
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
------------------------+---------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.0.4
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream
CPU: All | Platform: Linux
------------------------+---------------------------------
Comment (by neteler):
Replying to [comment:5 glynn]:
> Note that the exception specification was added in r50130 in response to #1533 specifically
> because omitting it resulted in compilation failures.
I see (somehow).. but how to solve the new compilation error? Or is it
"only" related to the compiler flags used by default?
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
------------------------+---------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.0.4
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream
CPU: All | Platform: Linux
------------------------+---------------------------------
Comment (by glynn):
Replying to [comment:6 neteler]:
> I see (somehow).. but how to solve the new compilation error? Or is it
"only" related to the compiler flags used by default?
It seems to be related to either the compiler version or the language
version or some combination of those.
In the worst case, we may need to use preprocessor tests to either include
or omit the exception specification depending on various macros. But I
really have no idea what it should be testing for.
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
------------------------+---------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 7.0.4
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream
CPU: All | Platform: Linux
------------------------+---------------------------------
Changes (by martinl):
* priority: blocker => major
Comment:
Downgrading the priority, GCC 6 is experimental version...
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
------------------------+---------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 7.1.0
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream
CPU: All | Platform: Linux
------------------------+---------------------------------
Changes (by martinl):
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
------------------------+---------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 7.2.0
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream
CPU: All | Platform: Linux
------------------------+---------------------------------
Comment (by sebastic):
Replying to [comment:8 martinl]:
> Downgrading the priority, GCC 6 is experimental version...
The severity of the bugreport in Debian has been raised to Release
Critical because the GCC maintainers intend to switch to GCC 6 for the
upcoming stretch release.
GRASS will be removed from testing (and upcoming stretch release) if this
build failure with GCC 6 remains unfixed.
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
------------------------+---------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.2.0
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream
CPU: All | Platform: Linux
------------------------+---------------------------------
Comment (by neteler):
Replying to [comment:11 sebastic]:
> GRASS will be removed from testing (and upcoming stretch release) if
this build failure with GCC 6 remains unfixed.
That decision sounds a bit harsh given that 1% ? of the functionality is
affected.
There is not too much which depends on lib/iostream/.
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
------------------------+---------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.2.0
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream
CPU: All | Platform: Linux
------------------------+---------------------------------
Comment (by sebastic):
Removing GRASS is not my choice, that's enforced by the Release Team in
Debian. Packages with Release Critical bugs get removed from testing after
a month without a fix for the RC bugs.
If we can disable the problematic functionality, that would be a perfectly
acceptable sort term solution.
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
------------------------+---------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.2.0
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream
CPU: All | Platform: Linux
------------------------+---------------------------------
Comment (by wenzeslaus):
In [changeset:"68818" 68818]:
{{{
#!CommitTicketReference repository="" revision="68818"
use exception specifiers only for C++ versions older than C++11
Tested using GCC 5.2.1.
No exception specifiers (throw(...)) fail with -std=c++98 -fexceptions.
Omitting noexcept (or throw()) fails with -std=c++11 and -std=c++14.
Using __cplusplus to get C++ standard version which defines
how the definitions in the standard library look like
and using GRASS_MM_USE_EXCEPTION_SPECIFIER we then use the right ones.
This contains old fix for -fexceptions with GCC 4.7 (see #1533, r50130)
and new fix for GCC 6 where -std=gnu++14 is by default (see #2871
and Debian Bug 811886).
The GCC message is pretty confusing because it points to two places with
the same specification claiming that the specification is different and
showing previous declaration coming from library I suppose. Anyway, it
seems that it all depends on the version of the standard used. C++11 and
higher wants no specifiers (they are depreciated in C++) while C++98
standard with GCC option `-fexceptions` requires them. I don't know how to
explain that the standard drafts around C++ don't specify `noexcept` for
`delete operator` but there is no difference when using GCC 5.2 with
-std=c++11 or -std=c++14; perhaps the library version is the same. I used
`__cplusplus` to figure out the C++ standard in use, it seems that it is
good enough (for g++ and clang).
The graph in the Debian bug report says 7.0.4, so this means that we need
to eventually backport it to 70 unless they switch to 72. Can somebody
conveniently test it with GCC 6?
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
-------------------------+-------------------------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.2.0
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream, gcc, -fexceptions, throw,
| noexcept
CPU: All | Platform: Linux
-------------------------+-------------------------------------------------
Comment (by sebastic):
I've added a patch with the changes from r68818 to the GRASS 7.0.4 Debian
package, and built is successfully with GCC 6 (6.1.1) in Debian unstable.
I'll upload the package shortly to close the RC bug and keep GRASS in
testing and the next stable release.
We'll updated to GRASS 7.2 in Debian as soon as possible after it's
released. If the release is before January 5th 2017
([https://release.debian.org/ Soft freeze]) we should be able to include
it in the stretch release. Otherwise it'll find its way into testing for
the subsequent buster release.
Backporting the changes to the 7.0 branch is very welcome, but I don't
mind carrying the patch in the Debian package either.
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
-------------------------+-------------------------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.2.0
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream, gcc, -fexceptions, throw,
| noexcept
CPU: All | Platform: Linux
-------------------------+-------------------------------------------------
Comment (by wenzeslaus):
Replying to [comment:17 sebastic]:
> built it successfully with GCC 6 (6.1.1) in Debian unstable... I'll
upload the package shortly
Great, thanks!
> We'll update to GRASS 7.2 in Debian... If the release is before January
5th 2017
Good to know.
> Backporting the changes to the 7.0 branch is very welcome, but I don't
mind carrying the patch in the Debian package either.
It seems that Fedora/EPEL needs it too (see #2956), so I think we'll
backport. One apparently never knows with these changes. Let's wait till
the next commit which will trigger OSX build on Travis
([https://www.traviscistatus.com/incidents/rqb906yypnk0 which was broken
while ago]).
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
-------------------------+-------------------------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.2.0
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream, gcc, -fexceptions, throw,
| noexcept
CPU: All | Platform: Linux
-------------------------+-------------------------------------------------
Comment (by sebastic):
For Debian the backport to 7.0 is not really required, the Debian package
includes the required changes as a patch, and the 7.2 release should
happen soon enough.