#108698 - 02/01/17 04:18 AM
mame appears to fail to build with gcc-7
|
Joined: Mar 2004
Posts: 604
belegdol
Senior Member
|
Senior Member

Joined: Mar 2004
Posts: 604
Switzerland
|
Hello, Fedora rawhide has recently been updated to gcc-7. As a result, mame-0.182 no longer builds: https://apps.fedoraproject.org/koschei/package/mame?collection=f26The errors seem to be of the following type: g++ -MMD -MP -MP -DPTR64=1 -DNDEBUG -DCRLF=2 -DLSB_FIRST -DXMD_H -DFLAC__NO_DLL -DNATIVE_DRC=drcbe_x64 -DLUA_COMPAT_ALL -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -I../../../../../src/osd -I../../../../../src/emu -I../../../../../src/devices -I../../../../../src/lib/netlist -I../../../../../src/mame -I../../../../../src/lib -I../../../../../src/lib/util -I../../../../../3rdparty -I../../../../generated/emu -I../../../../generated/emu/layout -I../../../../../scripts -I../../../../../3rdparty/asio/include -m64 -pipe -Wno-deprecated-declarations -O2 -fno-strict-aliasing -O2 -g1 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -Wno-unknown-pragmas -Wall -Wcast-align -Wundef -Wformat-security -Wwrite-strings -Wno-sign-compare -Wno-conversion -Wno-unused-result -Wno-array-bounds -m64 -x c++ -std=c++14 -Woverloaded-virtual -Wsuggest-override -flifetime-dse=1 -include ../../../../linux_gcc/obj/x64/Release/emu.h -o "../../../../linux_gcc/obj/x64/Release/src/devices/bus/sunkbd/hlekbd.o" -c "../../../../../src/devices/bus/sunkbd/hlekbd.cpp" ../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type4_device::hle_type4_device(const machine_config&, const char*, device_t*, uint32_t)': ../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1140:12: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context __FILE__) ^ ../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here hle_device_base::hle_device_base( ^~~~~~~~~~~~~~~ ../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_device::hle_type5_device(const machine_config&, const char*, device_t*, uint32_t)': ../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1179:12: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context __FILE__) ^ ../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here hle_device_base::hle_device_base( ^~~~~~~~~~~~~~~ ../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_gb_device::hle_type5_gb_device(const machine_config&, const char*, device_t*, uint32_t)': ../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1218:12: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context __FILE__) ^ ../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here hle_device_base::hle_device_base( ^~~~~~~~~~~~~~~ ../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_se_device::hle_type5_se_device(const machine_config&, const char*, device_t*, uint32_t)': ../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1257:12: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context __FILE__) ^ ../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here hle_device_base::hle_device_base( ^~~~~~~~~~~~~~~ ../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_jp_device::hle_type5_jp_device(const machine_config&, const char*, device_t*, uint32_t)': ../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1296:12: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context __FILE__) ^ ../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here hle_device_base::hle_device_base( ^~~~~~~~~~~~~~~ make[2]: *** [optional.make:13532: ../../../../linux_gcc/obj/x64/Release/src/devices/bus/sunkbd/hlekbd.o] Error 1
|
|
|
#108706 - 02/02/17 07:06 AM
Re: mame appears to fail to build with gcc-7
[Re: belegdol]
|
Joined: Mar 2004
Posts: 604
belegdol
Senior Member
|
Senior Member

Joined: Mar 2004
Posts: 604
Switzerland
|
Thanks for the pointer! I checked https://gcc.gnu.org/gcc-7/changes.html and found the following: The default semantics of inherited constructors has changed in all modes, following P0136. Essentially, overload resolution happens as if calling the inherited constructor directly, and the compiler fills in construction of the other bases and members as needed. Most uses should not need any changes. The old behavior can be restored with -fno-new-inheriting-ctors, or -fabi-version less than 11. Could this be related?
|
|
|
#108709 - 02/02/17 09:53 AM
Re: mame appears to fail to build with gcc-7
[Re: belegdol]
|
Joined: Feb 2004
Posts: 1,939
Vas Crabb
Very Senior Member
|
Very Senior Member

Joined: Feb 2004
Posts: 1,939
Sydney, Australia
|
Yes, it's likely related to that, but I can't see anything in the updated wording in P0136 that makes what we're doing illegal. The protection levels are fine, look at the inheritance: - hle_device_base has a protected constructor - this is accessible by all directly derived classes, that's the point of protected members
- hle_type4_device_base derives from hle_device_base inherits the constructor with a using statement in its protected section, making it accessible to derived classes
- hle_type4_device_base has no data members without default constructors to prevent the inherited constructor from being used (it has no data members at all)
- The concrete Type 4/5 device classes derive from hle_type4_device_base and call its inherited constructor from their public constructors
- Initialisation of bases/members is in class scope, so protected members of bases are accessible
It's a compiler bug, take it up with the GCC people.
|
|
|
#108744 - 02/06/17 06:37 PM
Re: mame appears to fail to build with gcc-7
[Re: belegdol]
|
Joined: Mar 2004
Posts: 604
belegdol
Senior Member
|
Senior Member

Joined: Mar 2004
Posts: 604
Switzerland
|
|
|
|
#108745 - 02/06/17 08:39 PM
Re: mame appears to fail to build with gcc-7
[Re: belegdol]
|
Joined: Mar 2001
Posts: 15,896
R. Belmont
|
Very Senior Member
Joined: Mar 2001
Posts: 15,896
USA
|
|
|
|
|
7 registered members (belegdol, Pernod, mfm005, Dorando, Golden Child, B2K24, 1 invisible),
28
guests, and
3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
Forums9
Topics8,525
Posts111,250
Members4,792
|
Most Online225 May 26th, 2014
|
|
|