Skip to content

Commit 8e8f723

Browse files
authored
Merge pull request #4027 from joolswills/mame_rpi3_32bit_fix
Fix building MAME on rpi3 with 32bit arm userland and aarch64 kernel
2 parents b834636 + e3e1d6e commit 8e8f723

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

scriptmodules/emulators/mame.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .zip .7z\n\nCopy your MAME roms to either $romdi
1515
rp_module_licence="GPL2 https://raw.githubusercontent.com/mamedev/mame/master/COPYING"
1616
rp_module_repo="git https://github.com/mamedev/mame.git :_get_branch_mame"
1717
rp_module_section="exp"
18-
rp_module_flags="!mali !armv6 !:\$__gcc_version:-lt:7"
18+
rp_module_flags="!mali !armv6 !:\$__gcc_version:-lt:7 nodistcc"
1919

2020
function _get_branch_mame() {
2121
# starting with 0.265, GCC 10.3 or later is required for full C++17 support
@@ -52,8 +52,26 @@ function build_mame() {
5252

5353
local params=(NOWERROR=1 ARCHOPTS="-U_FORTIFY_SOURCE -Wl,-s" PYTHON_EXECUTABLE=python3 OPTIMIZE=2 USE_SYSTEM_LIB_FLAC=1)
5454
isPlatform "x11" && params+=(USE_QTDEBUG=1) || params+=(USE_QTDEBUG=0)
55+
56+
# array for storing ARCHOPTS_CXX parameters
57+
local arch_opts_cxx=()
58+
5559
# when building on ARM enable 'fsigned-char' for compiled code, fixes crashes in a few drivers
56-
isPlatform "arm" || isPlatform "aarch64" && params+=(ARCHOPTS_CXX=-fsigned-char)
60+
isPlatform "arm" || isPlatform "aarch64" && arch_opts_cxx+=(-fsigned-char)
61+
62+
# workaround g++-12 compiler bug/compilation issue on 32bit arm userland with aarch64 kernel on the rpi3 (cortex-a53)
63+
# disabling -ftree-slp-vectorize works around the issue:
64+
# {standard input}: Assembler messages:
65+
# {standard input}:4045: Error: co-processor offset out of range
66+
# make[2]: *** [skeleton.make:2727: obj/Release/src/mame/skeleton/scopus.o] Error 1
67+
if [[ "$__gcc_version" -eq 12 ]] && isPlatform "rpi3" && isPlatform "32bit" && [[ "$(uname -m)" == "aarch64" ]]; then
68+
arch_opts_cxx+=(-fno-tree-slp-vectorize)
69+
fi
70+
71+
# if we have any arch opts set, add them
72+
if [[ ${#arch_opts_cxx[@]} -gt 0 ]]; then
73+
params+=(ARCHOPTS_CXX="${arch_opts_cxx[*]}")
74+
fi
5775

5876
# force arm on arm platform - fixes building mame on when using 32bit arm userland with aarch64 kernel
5977
isPlatform "arm" && params+=(PLATFORM=arm)

0 commit comments

Comments
 (0)