2017-03-28 06:22 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004657MPDBuildpublic2017-03-01 16:41
Reporterc_14 
Assigned Tocirrus 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Versiongit 
Target VersionFixed in Version0.20 
Summary0004657: Cannot build mpd >=0.20 due to error with dynamic cast of exception when building with gcc 4.9
DescriptionWhen trying to build mpd newer than 0.19 (starting with the 0.20 release)
it throws an error during compilation of CommandError.cxx.

I was able to reproduce using both the 0.20 release and git HEAD (e9e853b19ab8989c639e7f431ede7a377a427579) when using gcc 4.9.4,
but was unable to reproduce when compiling using gcc 5.4.0 nor
with clang 3.9 so it semes to be gcc 4.9 only.
Steps To Reproduce1. git clone git://git.musicpd.org/master/mpd.git
2. cd mpd
3. ./autogen.sh
4. ./configure
5. make
Additional Informationg++ -std=c++14 -DHAVE_CONFIG_H -I. -DNDEBUG -I./src -I/usr/include -DSYSTEM_CONFIG_FILE_LOCATION='"/usr/local/etc/mpd.conf"' -D_GNU_SOURCE -pthread -g -O2 -fvisibility=hidden -fno-threadsafe-statics -fmerge-all-constants -ffast-math -ftree-vectorize -ffunction-sections -fdata-sections -Wall -Wextra -Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wsign-compare -MT src/command/libmpd_a-CommandError.o -MD -MP -MF src/command/.deps/libmpd_a-CommandError.Tpo -c -o src/command/libmpd_a-CommandError.o `test -f 'src/command/CommandError.cxx' || echo './'`src/command/CommandError.cxx
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/g++-v4/exception:163:0,
                 from src/command/CommandError.hxx:25,
                 from src/command/CommandError.cxx:21:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/g++-v4/bits/nested_exception.h: In instantiation of ‘static const std::nested_exception* std::__get_nested_helper<_Ex>::_S_get(const _Ex&) [with _Ex = std::__exception_ptr::exception_ptr]’:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/g++-v4/bits/nested_exception.h:104:51: required from ‘const std::nested_exception* std::__get_nested_exception(const _Ex&) [with _Ex = std::__exception_ptr::exception_ptr]’
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/g++-v4/bits/nested_exception.h:148:73: required from ‘void std::rethrow_if_nested(const _Ex&) [with _Ex = std::__exception_ptr::exception_ptr]’
src/command/CommandError.cxx:114:29: required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/include/g++-v4/bits/nested_exception.h:90:59: error: cannot dynamic_cast ‘& __ex’ (of type ‘const class std::__exception_ptr::exception_ptr*’) to type ‘const class std::nested_exception*’ (source type is not polymorphic)
       { return dynamic_cast<const nested_exception*>(&__ex); }
                                                           ^
make[1]: *** [Makefile:10015: src/command/libmpd_a-CommandError.o] Error 1
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0010386

razamatan (reporter)

i hit this issue on my gentoo box running amd64 stable which uses gcc-4.9.4 and mpd-0.20.4.

i've outlined a workaround in https://bugs.gentoo.org/show_bug.cgi?id=609618

would this generally work? the crux of the issue appears that we're using an exception_ptr instead of a nested_exception subtype reference....

the gentoo bug has a very simple patch.

~0010387

cirrus (administrator)

This patch compiles, build will lead to an endless loop at runtime, if this code path ever gets executed!

DO NOT USE THIS PATCH!

Thanks for pointing to this - if I ever get a freeze bug report from a Gentoo user, I'll know why.

~0010388

razamatan (reporter)

is it better to just comment out the rethrow? i think i see your point as to why it's going to loop :)

~0010399

cirrus (administrator)

e22a4fdba4fe06e3595145d75b31a81c3ce22a23

Not a MPD bug - this is a bug in GCC, and I updated MPD's workaround to be compatible with GCC 4.9.4.
+Notes

-Issue History
Date Modified Username Field Change
2017-02-27 17:45 c_14 New Issue
2017-02-27 17:45 c_14 Status new => assigned
2017-02-27 17:45 c_14 Assigned To => cirrus
2017-02-28 09:15 razamatan Note Added: 0010386
2017-02-28 09:17 cirrus Note Added: 0010387
2017-02-28 09:47 razamatan Note Added: 0010388
2017-03-01 16:41 cirrus Status assigned => resolved
2017-03-01 16:41 cirrus Resolution open => fixed
2017-03-01 16:41 cirrus Fixed in Version => 0.20
2017-03-01 16:41 cirrus Note Added: 0010399
+Issue History