|
Joined: Jan 2009
Posts: 68
Member
|
OP
Member
Joined: Jan 2009
Posts: 68 |
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.
|
|
|
|
Joined: Feb 2004
Posts: 2,603 Likes: 307
Very Senior Member
|
Very Senior Member
Joined: Feb 2004
Posts: 2,603 Likes: 307 |
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.
|
|
|
|
Joined: Jan 2009
Posts: 68
Member
|
OP
Member
Joined: Jan 2009
Posts: 68 |
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: which spat out a large list of options. The one that seemed relevant in this case was -mstack-protector-guard= tls I have no idea unfortunately, how to switch that to disabled. Alternatively, it seemed like I could stick -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 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.
|
|
|
|
Joined: Feb 2004
Posts: 2,603 Likes: 307
Very Senior Member
|
Very Senior Member
Joined: Feb 2004
Posts: 2,603 Likes: 307 |
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".
|
|
|
|
Joined: Jan 2009
Posts: 68
Member
|
OP
Member
Joined: Jan 2009
Posts: 68 |
OK, so I tried: make CFLAGS='-D_FORTIFY_SOURCE=0' but this produced: 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.
|
|
|
|
Joined: Feb 2004
Posts: 2,603 Likes: 307
Very Senior Member
|
Very Senior Member
Joined: Feb 2004
Posts: 2,603 Likes: 307 |
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-29982You might be able to work around it with -U_FORTIFY_SOURCE to undefine it rather than trying to redefine it to zero.
|
|
|
|
Joined: Jan 2009
Posts: 68
Member
|
OP
Member
Joined: Jan 2009
Posts: 68 |
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.
|
|
|
|
Joined: Jan 2009
Posts: 68
Member
|
OP
Member
Joined: Jan 2009
Posts: 68 |
make CFLAGS='-U_FORTIFY_SOURCE' built mame64 successfully. I'll stuff that in a note so that I remember the next time Thanks again for all your help.
|
|
|
|
Joined: Mar 2009
Posts: 75 Likes: 2
Member
|
Member
Joined: Mar 2009
Posts: 75 Likes: 2 |
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: 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!
|
|
|
|
Joined: Apr 2006
Posts: 737 Likes: 1
Senior Member
|
Senior Member
Joined: Apr 2006
Posts: 737 Likes: 1 |
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: 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.
|
|
|
Forums9
Topics9,328
Posts122,128
Members5,074
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|