Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
SDLMAME build failure on Ubuntu 18.10 #114479 12/28/18 05:14 AM
Joined: Jan 2009
Posts: 51
P
Procyon Offline OP
Member
OP Offline
Member
P
Joined: Jan 2009
Posts: 51
Code
Compiling src/devices/bus/nubus/nubus_image.cpp...
In file included from /usr/include/string.h:494,
                 from ../../../../../src/emu/emucore.h:19,
                 from ../../../../../src/emu/emu.h:29:
In function ‘char* strcat(char*, const char*)’,
    inlined from ‘void nubus_image_device::file_cmd_w(address_space&, offs_t, u32, u32)’ at ../../../../../src/devices/bus/nubus/nubus_image.cpp:261:10:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:128:33: error: ‘char* __builtin___strcat_chk(char*, const char*, long unsigned int)’ accessing 129 or more bytes at offsets 1028 and 900 may overlap 1 byte at offset 1028 [-Werror=restrict]
   return __builtin___strcat_chk (__dest, __src, __bos (__dest));
          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


I'm getting this whenever I try to build mame0205 from git, after a "make clean" with the latest gcc-8. Please advise on how to work around. Thank you.

Re: SDLMAME build failure on Ubuntu 18.10 [Re: Procyon] #114480 12/28/18 06:41 AM
Joined: Feb 2004
Posts: 2,081
Vas Crabb Online Content
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,081
We don't support building with the "fortify source" option enabled. It must be somehow enabled on your system via an environment variable. MAME is not secure software, use it at your own risk.

Re: SDLMAME build failure on Ubuntu 18.10 [Re: Vas Crabb] #114485 12/28/18 01:42 PM
Joined: Jan 2009
Posts: 51
P
Procyon Offline OP
Member
OP Offline
Member
P
Joined: Jan 2009
Posts: 51
Thank you VC. I'm entirely unfamiliar with this option. I did some Googling around, and came up with a few things, but I'm at a loss as to how to implement the solutions I've found. One suggestion was to run:
Code
gcc -Q --help=target
which spat out a large list of options. The one that seemed relevant in this case was
Code
-mstack-protector-guard=    		tls
I have no idea unfortunately, how to switch that to disabled.

Alternatively, it seemed like I could stick
Code
-CFLAGS += "-fno-stack-protector"
into the Makefile. The problem for me is, MAME's Makefile is a little intimidating and I don't know where it's best to put that line (or if it can go anywhere as long as it's outside of some #if block?)

Sorry. I've been a dev for over 20 years, but I'm outside of my expertise here. Any help would be appreciated. Thanks very much.

EDIT: I just tried to build with
Code
make CFLAGS="-fno-stack-protector"
but no dice, it failed the exact same way. Confused...

Last edited by Procyon; 12/28/18 02:36 PM.
Re: SDLMAME build failure on Ubuntu 18.10 [Re: Procyon] #114488 12/28/18 05:45 PM
Joined: Feb 2004
Posts: 2,081
Vas Crabb Online Content
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,081
I'm more familiar with Red Hat than Ubuntu, but to the best of my knowledge it's controlled by the _FORTIFY_SOURCE macro. Setting it to 1 enables basic checking, and setting it to 2 enables additional, stricter checks. It's set by default when building RPM packages. Do you have a CFLAGS or CXXFLAGS environment variable coming from somewhere causing this macro to be defined?

Alternatively, you could either disable warnings as errors (add NOWERROR=1 to your build options) or try adding something to ARCHOPTS to disable this "feature".

Re: SDLMAME build failure on Ubuntu 18.10 [Re: Procyon] #114489 12/28/18 06:25 PM
Joined: Jan 2009
Posts: 51
P
Procyon Offline OP
Member
OP Offline
Member
P
Joined: Jan 2009
Posts: 51
OK, so I tried:

Code
make CFLAGS='-D_FORTIFY_SOURCE=0'


but this produced:

Code
GCC 8 detected
Precompiling src/emu/emu.h...
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors
make[2]: *** [precompile.make:299: ../../../../linux_gcc/obj/x64/Release/emu.h.gch] Error 1
make[1]: *** [Makefile:88: precompile] Error 2
make: *** [makefile:1270: linux_x64] Error 2


I'm gonna try it now with NOWERROR=1.

Last edited by Procyon; 12/28/18 06:30 PM.
Re: SDLMAME build failure on Ubuntu 18.10 [Re: Procyon] #114493 12/28/18 07:40 PM
Joined: Feb 2004
Posts: 2,081
Vas Crabb Online Content
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,081
It seems Gentoo started this, applying patches to their GCC to force _FORTIFY_SOURCE to always be defined as 1. There's some discussion on MongoDB's tracker here: https://jira.mongodb.org/browse/SERVER-29982
You might be able to work around it with -U_FORTIFY_SOURCE to undefine it rather than trying to redefine it to zero.

Re: SDLMAME build failure on Ubuntu 18.10 [Re: Procyon] #114494 12/28/18 07:56 PM
Joined: Jan 2009
Posts: 51
P
Procyon Offline OP
Member
OP Offline
Member
P
Joined: Jan 2009
Posts: 51
Thank you for finding that, that's interesting. "make NOWERROR=1" worked. Out of curiosity, I'm going to try -U_FORTIFY_SOURCE just to see what happens. I'll post the results when I find out.

Re: SDLMAME build failure on Ubuntu 18.10 [Re: Procyon] #114496 12/28/18 08:46 PM
Joined: Jan 2009
Posts: 51
P
Procyon Offline OP
Member
OP Offline
Member
P
Joined: Jan 2009
Posts: 51
Code
make CFLAGS='-U_FORTIFY_SOURCE'


built mame64 successfully. I'll stuff that in a note so that I remember the next time smile Thanks again for all your help.

Re: SDLMAME build failure on Ubuntu 18.10 [Re: Procyon] #114810 03/07/19 09:10 AM
Joined: Mar 2009
Posts: 53
M
mochamame Offline
Member
Offline
Member
M
Joined: Mar 2009
Posts: 53
I'm trying to compile Mame 0.179 on a 64 bit platform under Ubuntu 18.10. I'm trying to do this so I can use it with QMC2.

The above information was very helpful however I'm getting some other errors during the compilation process:

Code
Compiling src/mame/drivers/caswin.cpp...
../../../../../src/mame/drivers/z88.cpp: In member function ‘void z88_state::bankswitch_update(int, uint16_t, int)’:
../../../../../src/mame/drivers/z88.cpp:62:20: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 2 [-Werror=format-overflow=]
  sprintf(bank_tag, "bank%d", bank + 2);
                    ^~~~~~~~
../../../../../src/mame/drivers/z88.cpp:62:20: note: directive argument in the range [-2147483646, 2147483647]
../../../../../src/mame/drivers/z88.cpp:62:9: note: ‘sprintf’ output between 6 and 16 bytes into a destination of size 6
  sprintf(bank_tag, "bank%d", bank + 2);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [acorn.make:425: ../../../../linux_gcc/obj/x64/Release/src/mame/drivers/z88.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Compiling src/mame/video/arcadia.cpp...
../../../../../src/mame/machine/apple2.cpp: In member function ‘void apple2_state::apple2_update_memory()’:
../../../../../src/mame/machine/apple2.cpp:190:19: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 6 [-Werror=format-overflow=]
     sprintf(wbank,"bank%d",bank+1);
                   ^~~~~~~~
../../../../../src/mame/machine/apple2.cpp:190:19: note: directive argument in the range [-2147483647, 2147483647]
../../../../../src/mame/machine/apple2.cpp:190:12: note: ‘sprintf’ output between 6 and 16 bytes into a destination of size 10
     sprintf(wbank,"bank%d",bank+1);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
../../../../../src/mame/drivers/nc.cpp: In member function ‘void nc_state::nc_refresh_memory_bank_config(int)’:
../../../../../src/mame/drivers/nc.cpp:306:16: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 6 [-Werror=format-overflow=]
  sprintf(bank1,"bank%d",bank+1);
                ^~~~~~~~
../../../../../src/mame/drivers/nc.cpp:306:16: note: directive argument in the range [-2147483647, 2147483647]
../../../../../src/mame/drivers/nc.cpp:306:9: note: ‘sprintf’ output between 6 and 16 bytes into a destination of size 10
  sprintf(bank1,"bank%d",bank+1);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
../../../../../src/mame/drivers/nc.cpp:307:16: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 6 [-Werror=format-overflow=]
  sprintf(bank5,"bank%d",bank+5);
                ^~~~~~~~
../../../../../src/mame/drivers/nc.cpp:307:16: note: directive argument in the range [-2147483643, 2147483647]
../../../../../src/mame/drivers/nc.cpp:307:9: note: ‘sprintf’ output between 6 and 16 bytes into a destination of size 10
  sprintf(bank5,"bank%d",bank+5);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Compiling src/mame/drivers/big10.cpp...
Compiling src/mame/drivers/forte2.cpp...
Compiling src/mame/drivers/msx.cpp...
Compiling src/mame/drivers/pengadvb.cpp...
../../../../../src/mame/drivers/atom.cpp: In member function ‘void atom_state::motor_w(int)’:
../../../../../src/mame/drivers/atom.cpp:607:20: error: ‘sprintf’ writing a terminating nul past the end of the destination [-Werror=format-overflow=]
   sprintf(devname, "%d", i);
                    ^~~~
../../../../../src/mame/drivers/atom.cpp:607:10: note: ‘sprintf’ output 2 bytes into a destination of size 1
   sprintf(devname, "%d", i);
   ~~~~~~~^~~~~~~~~~~~~~~~~~


Looks like some kind of format overflow? Any ideas how to fix this?

Thanks!

Re: SDLMAME build failure on Ubuntu 18.10 [Re: mochamame] #114811 03/07/19 09:15 AM
Joined: Apr 2006
Posts: 712
Tafoid Offline
Senior Member
Offline
Senior Member
Joined: Apr 2006
Posts: 712
Originally Posted by mochamame
I'm trying to compile Mame 0.179 on a 64 bit platform under Ubuntu 18.10. I'm trying to do this so I can use it with QMC2.

The above information was very helpful however I'm getting some other errors during the compilation process:

Code
Compiling src/mame/drivers/caswin.cpp...
../../../../../src/mame/drivers/z88.cpp: In member function ‘void z88_state::bankswitch_update(int, uint16_t, int)’:
../../../../../src/mame/drivers/z88.cpp:62:20: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 2 [-Werror=format-overflow=]
  sprintf(bank_tag, "bank%d", bank + 2);
                    ^~~~~~~~
../../../../../src/mame/drivers/z88.cpp:62:20: note: directive argument in the range [-2147483646, 2147483647]
../../../../../src/mame/drivers/z88.cpp:62:9: note: ‘sprintf’ output between 6 and 16 bytes into a destination of size 6
  sprintf(bank_tag, "bank%d", bank + 2);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [acorn.make:425: ../../../../linux_gcc/obj/x64/Release/src/mame/drivers/z88.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Compiling src/mame/video/arcadia.cpp...
../../../../../src/mame/machine/apple2.cpp: In member function ‘void apple2_state::apple2_update_memory()’:
../../../../../src/mame/machine/apple2.cpp:190:19: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 6 [-Werror=format-overflow=]
     sprintf(wbank,"bank%d",bank+1);
                   ^~~~~~~~
../../../../../src/mame/machine/apple2.cpp:190:19: note: directive argument in the range [-2147483647, 2147483647]
../../../../../src/mame/machine/apple2.cpp:190:12: note: ‘sprintf’ output between 6 and 16 bytes into a destination of size 10
     sprintf(wbank,"bank%d",bank+1);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
../../../../../src/mame/drivers/nc.cpp: In member function ‘void nc_state::nc_refresh_memory_bank_config(int)’:
../../../../../src/mame/drivers/nc.cpp:306:16: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 6 [-Werror=format-overflow=]
  sprintf(bank1,"bank%d",bank+1);
                ^~~~~~~~
../../../../../src/mame/drivers/nc.cpp:306:16: note: directive argument in the range [-2147483647, 2147483647]
../../../../../src/mame/drivers/nc.cpp:306:9: note: ‘sprintf’ output between 6 and 16 bytes into a destination of size 10
  sprintf(bank1,"bank%d",bank+1);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
../../../../../src/mame/drivers/nc.cpp:307:16: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 6 [-Werror=format-overflow=]
  sprintf(bank5,"bank%d",bank+5);
                ^~~~~~~~
../../../../../src/mame/drivers/nc.cpp:307:16: note: directive argument in the range [-2147483643, 2147483647]
../../../../../src/mame/drivers/nc.cpp:307:9: note: ‘sprintf’ output between 6 and 16 bytes into a destination of size 10
  sprintf(bank5,"bank%d",bank+5);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Compiling src/mame/drivers/big10.cpp...
Compiling src/mame/drivers/forte2.cpp...
Compiling src/mame/drivers/msx.cpp...
Compiling src/mame/drivers/pengadvb.cpp...
../../../../../src/mame/drivers/atom.cpp: In member function ‘void atom_state::motor_w(int)’:
../../../../../src/mame/drivers/atom.cpp:607:20: error: ‘sprintf’ writing a terminating nul past the end of the destination [-Werror=format-overflow=]
   sprintf(devname, "%d", i);
                    ^~~~
../../../../../src/mame/drivers/atom.cpp:607:10: note: ‘sprintf’ output 2 bytes into a destination of size 1
   sprintf(devname, "%d", i);
   ~~~~~~~^~~~~~~~~~~~~~~~~~


Looks like some kind of format overflow? Any ideas how to fix this?

Thanks!


I could be wrong but I see -Werror which can usually be counteracted by adding NOWERROR=1 in your make string. Give that a try.


Page 1 of 2 1 2

Moderated by  R. Belmont 

Who's Online Now
1 registered members (AJR), 60 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,711
Posts114,495
Members4,869
Most Online510
Aug 26th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3