Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
#108698 - 02/01/17 04:18 AM mame appears to fail to build with gcc-7  
Joined: Mar 2004
Posts: 601
belegdol Offline
Senior Member
belegdol  Offline
Senior Member

Joined: Mar 2004
Posts: 601
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=f26
The errors seem to be of the following type:
Quote:
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

#108701 - 02/01/17 03:11 PM Re: mame appears to fail to build with gcc-7 [Re: belegdol]  
Joined: Feb 2004
Posts: 1,756
Vas Crabb Offline
Very Senior Member
Vas Crabb  Offline
Very Senior Member

Joined: Feb 2004
Posts: 1,756
Sydney, Australia
That looks a lot like a compiler bug - protected constructors are obviously available to derived classes. That's the whole point of protected constructors. It appears that GCC in no longer correctly dealing with constructor promotion.

#108706 - 02/02/17 07:06 AM Re: mame appears to fail to build with gcc-7 [Re: belegdol]  
Joined: Mar 2004
Posts: 601
belegdol Offline
Senior Member
belegdol  Offline
Senior Member

Joined: Mar 2004
Posts: 601
Switzerland
Thanks for the pointer! I checked https://gcc.gnu.org/gcc-7/changes.html and found the following:
Quote:
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,756
Vas Crabb Offline
Very Senior Member
Vas Crabb  Offline
Very Senior Member

Joined: Feb 2004
Posts: 1,756
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.

#108710 - 02/02/17 01:17 PM Re: mame appears to fail to build with gcc-7 [Re: belegdol]  
Joined: Aug 2015
Posts: 307
Edstrom Offline
Senior Member
Edstrom  Offline
Senior Member

Joined: Aug 2015
Posts: 307
@belegdol: did you try the -fno-new-inheriting-ctors or -fabi-version switches and if so what happened?

#108717 - 02/02/17 10:56 PM Re: mame appears to fail to build with gcc-7 [Re: belegdol]  
Joined: Feb 2004
Posts: 1,756
Vas Crabb Offline
Very Senior Member
Vas Crabb  Offline
Very Senior Member

Joined: Feb 2004
Posts: 1,756
Sydney, Australia
Please don't use -fabi-version to use the C++03 ABI. It radically changes the performance characteristics of std::string, and we don't want to have to support this configuration. Also, please raise a bug with GCC and/or with Fedora. It would be good to actually have this fixed in the compiler.

#108744 - 02/06/17 06:37 PM Re: mame appears to fail to build with gcc-7 [Re: belegdol]  
Joined: Mar 2004
Posts: 601
belegdol Offline
Senior Member
belegdol  Offline
Senior Member

Joined: Mar 2004
Posts: 601
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,585
R. Belmont Online content
R. Belmont  Online Content

Very Senior Member

Joined: Mar 2001
Posts: 15,585
USA
Thanks!

#108772 - 02/09/17 07:11 AM Re: mame appears to fail to build with gcc-7 [Re: belegdol]  
Joined: Mar 2004
Posts: 601
belegdol Offline
Senior Member
belegdol  Offline
Senior Member

Joined: Mar 2004
Posts: 601
Switzerland
As an update, the issue has now been escalated to GCC upstream:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79401
Adding -fno-new-inheriting-ctors allows the build to complete.

#108783 - 02/09/17 03:33 PM Re: mame appears to fail to build with gcc-7 [Re: belegdol]  
Joined: Mar 2001
Posts: 15,585
R. Belmont Online content
R. Belmont  Online Content

Very Senior Member

Joined: Mar 2001
Posts: 15,585
USA
Great, thanks for the follow-through on this!

Page 1 of 2 1 2

Moderated by  R. Belmont 

Who's Online Now
4 registered members (ted, AJR, JonasP, R. Belmont), 24 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,340
Posts107,780
Members4,738
Most Online225
May 26th, 2014
Powered by UBB.threads™ PHP Forum Software 7.6.0
Page Time: 0.030s Queries: 14 (0.009s) Memory: 5.0190 MB (Peak: 5.2457 MB) Zlib enabled. Server Time: 2017-05-28 12:21:10 UTC