Bug 271987 - emulators/mame: broken on arm again
Summary: emulators/mame: broken on arm again
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Only Me
Assignee: Robert Clausecker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-14 07:12 UTC by Robert Clausecker
Modified: 2023-07-02 00:52 UTC (History)
1 user (show)

See Also:
fuz: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Clausecker freebsd_committer freebsd_triage 2023-06-14 07:12:12 UTC
It's broken on arm again.  This is a known issue and can be fixed by importing appropriate patched from other ports (which I had previously written to fix the same issue).  Will take care of it soonish.

../../../../../3rdparty/lzma/C/7zCrc.c:158:1: warning: unknown architecture 'armv8-a+crc' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
ATTRIB_CRC
^
../../../../../3rdparty/lzma/C/7zCrc.c:89:58: note: expanded from macro 'ATTRIB_CRC'
            #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
                                                         ^
../../../../../3rdparty/lzma/C/7zCrc.c:160:1: warning: unknown architecture 'armv8-a+crc' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
ATTRIB_CRC
^
../../../../../3rdparty/lzma/C/7zCrc.c:89:58: note: expanded from macro 'ATTRIB_CRC'
            #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
                                                         ^
../../../../../3rdparty/lzma/C/7zCrc.c:190:1: warning: unknown architecture 'armv8-a+crc' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
ATTRIB_CRC
^
../../../../../3rdparty/lzma/C/7zCrc.c:89:58: note: expanded from macro 'ATTRIB_CRC'
            #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
                                                         ^
../../../../../3rdparty/lzma/C/7zCrc.c:192:1: warning: unknown architecture 'armv8-a+crc' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
ATTRIB_CRC
^
../../../../../3rdparty/lzma/C/7zCrc.c:89:58: note: expanded from macro 'ATTRIB_CRC'
            #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
                                                         ^
fatal error: error in backend: Cannot select: intrinsic %llvm.arm.crc32b
Comment 1 Alastair Hogge 2023-06-15 12:47:38 UTC
Hey Robert,

Thanks for opening report. The emulators/qmc2 build is also failing with the same fatel error:

https://pkg-status.freebsd.org/ampere1/data/124arm64-quarterly/adc92393850d/logs/qmc2-0.243_1.log

This stuff is quite beyond me, thanks for looking into it.
Comment 2 Robert Clausecker freebsd_committer freebsd_triage 2023-06-25 17:00:08 UTC
Got patches for both, stolen from archivers/7-zip.  Will commit with my next batch.

BTW, why didn't you unbundle lua?  There's WITH_SYSTEM_LIB_LUA or something like that to make that work.
Comment 3 Alastair Hogge 2023-06-26 00:54:16 UTC
(In reply to Robert Clausecker from comment #2)
> Got patches for both, stolen from archivers/7-zip.  Will commit with my next batch.

What a relief, thank you so much.

> BTW, why didn't you unbundle lua?  There's WITH_SYSTEM_LIB_LUA or something like that to make that work.

MAME now requires Lua-5.4 built with C++ and C++ unwinding support; I had a quick look, Arch User Repository has a package for Lua-5.4 with C++ unwind support, not on my TODO at the moment, tho, it will probably need to be sorted eventually.
From MAME-0.253 https://www.mamedev.org/releases/whatsnew_0253.txt:

-Various updates, mostly around Lua: [Vas Crabb]
 * Compile Lua as C++.  When Lua is compiled as C, it uses setjmp/longjmp for error handling, resulting in failure to unwind
    intermediate stack frames.  Trying to ensure no objects with non-trivial destructors are in scope when raising a Lua error is
    error-prone.  In particular, converting an exception to a Lua error becomes convoluted, and raising a Lua error from a
    constructor is effectively impossible.
 * Updated sol2 to version 3.3.0 - this adds support for Lua 5.4 and fixes a number of issues, including not correctly handling
    errors when Lua is built as C++.
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-06-26 23:31:06 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cb40b0a43949a621f407fa3b65dff7349b024ba2

commit cb40b0a43949a621f407fa3b65dff7349b024ba2
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2023-06-25 16:58:55 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-06-26 23:30:28 +0000

    emulators/mame: fix build on armv7 and arm64

    Port now bundles LZMA with known build issues.  Import patch set from
    archivers/7-zip to fix the build on armv7 and arm64.

    PR:             271987
    Approved by:    portmgr (build fix blanket)
    Obtained from:  archivers/7-zip

 emulators/mame/Makefile                            |  3 ++
 ...atch-3rdparty_lzma_CPP_7zip_7zip__gcc.mak (new) | 27 ++++++++++++++
 ...patch-3rdparty_lzma_CPP_7zip_var__gcc.mak (new) | 12 +++++++
 ...-3rdparty_lzma_CPP_Windows_SystemInfo.cpp (new) | 27 ++++++++++++++
 .../mame/files/patch-3rdparty_lzma_C_7zCrc.c (new) | 11 ++++++
 .../mame/files/patch-3rdparty_lzma_C_Aes.c (new)   | 11 ++++++
 .../files/patch-3rdparty_lzma_C_AesOpt.c (new)     | 38 ++++++++++++++++++++
 .../files/patch-3rdparty_lzma_C_CpuArch.c (new)    | 42 ++++++++++++++++++++++
 .../files/patch-3rdparty_lzma_C_Sha256Opt.c (new)  | 11 ++++++
 9 files changed, 182 insertions(+)
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-06-26 23:31:08 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1ebb93fd8095f4cc77bd8f0681580e9ef747b965

commit 1ebb93fd8095f4cc77bd8f0681580e9ef747b965
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2023-06-25 16:55:58 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-06-26 23:30:28 +0000

    emulators/qmc2: fix build on armv7 and arm64

    Port now bundles LZMA with known build issues.  Import patch set from
    archivers/7-zip to fix the build on armv7 and arm64.

    PR:             271987
    Approved by:    portmgr (build fix blanket)
    Obtained from:  archivers/7-zip

 emulators/qmc2/Makefile                            |  3 +-
 emulators/qmc2/files/patch-src_lzma_7zCrc.c (new)  | 11 ++++++
 emulators/qmc2/files/patch-src_lzma_Aes.c (new)    | 11 ++++++
 emulators/qmc2/files/patch-src_lzma_AesOpt.c (new) | 38 ++++++++++++++++++++
 .../qmc2/files/patch-src_lzma_CpuArch.c (new)      | 42 ++++++++++++++++++++++
 .../qmc2/files/patch-src_lzma_Sha256Opt.c (new)    | 11 ++++++
 6 files changed, 115 insertions(+), 1 deletion(-)
Comment 6 Robert Clausecker freebsd_committer freebsd_triage 2023-06-26 23:32:21 UTC
That should do it!
Comment 7 Alastair Hogge 2023-07-02 00:52:11 UTC
(In reply to Robert Clausecker from comment #6)

Great work, thanks.