Bug 272192 - emulators/pcsx2: pcsx2-1.7.4097_2 crashes at start with "Program terminated with signal SIGILL, Illegal instruction."
Summary: emulators/pcsx2: pcsx2-1.7.4097_2 crashes at start with "Program terminated w...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ganael LAPLANCHE
URL: https://www.freshports.org/emulators/...
Keywords: crash
Depends on:
Blocks:
 
Reported: 2023-06-24 19:10 UTC by Patrick McMunn
Modified: 2023-06-27 10:36 UTC (History)
4 users (show)

See Also:
grahamperrin: maintainer-feedback? (martymac)


Attachments
Patch for pcsx2 (2.11 KB, patch)
2023-06-25 16:53 UTC, Daniel Engberg
no flags Details | Diff
Patch for pcsx2 v2 (2.11 KB, patch)
2023-06-25 16:57 UTC, Daniel Engberg
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick McMunn 2023-06-24 19:10:04 UTC
The program dumped core, and I tried to get a backtrace. But it didn't have debugging symbols. So I compiled it from ports with debugging turned on. But when I compiled it for my system, it started up with no trouble at all.

I did notice what the problem may be. Although I have the CPUTYPE on my system set to ivibridge, I see this snippet of output during compilation: "-march=ivybridge -g -fstack-protector-strong -fno-strict-aliasing -fPIE -march=native". As you can see, whether this is the fault of the port or PCSX2's own build system, -march=native is being passed during compilation. So the prebuilt package was most likely built for the native CPU of the machine it was built on rather than generic amd64. So obviously it won't be compatible for all systems.
Comment 1 Graham Perrin freebsd_committer freebsd_triage 2023-06-25 06:31:56 UTC
(In reply to Patrick McMunn from comment #0)

Please provide outputs from the commands below. 

freebsd-version -kru ; uname -aKU

pkg -vv | grep -e url -e enabled -e priority
Comment 2 Daniel Engberg freebsd_committer freebsd_triage 2023-06-25 16:53:49 UTC
Created attachment 242991 [details]
Patch for pcsx2

Rely on our framework and if undefined set lowest common denominator. Might be worth considering adding a small message that PCSX2 should be recompiled with CPUTYPE defined for best performance.
Comment 3 Daniel Engberg freebsd_committer freebsd_triage 2023-06-25 16:57:36 UTC
Created attachment 242992 [details]
Patch for pcsx2 v2

Fix typo in comments
Comment 4 Patrick McMunn 2023-06-26 20:35:48 UTC
(In reply to Graham Perrin from comment #1)
14.0-CURRENT
14.0-CURRENT
14.0-CURRENT
FreeBSD op7010.local 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-c079bcbc6: Mon Jun 26 11:16:14 CDT 2023     root@op7010.local:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 1400092 1400092

    url             : "pkg+http://pkg.FreeBSD.org/FreeBSD:14:amd64/latest",
    enabled         : yes,
    priority        : 0,
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-06-27 10:14:51 UTC
A commit in branch main references this bug:

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

commit 10076c84866711af04e6c1425cdc6085ac936bfe
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2023-06-27 10:08:02 +0000
Commit:     Ganael LAPLANCHE <martymac@FreeBSD.org>
CommitDate: 2023-06-27 10:13:32 +0000

    emulators/pcsx2: Fix SIGILL crash

    Do not pass -march=native as that can bring pre-built packages with
    instructions not supported by end users and lead to a SIGILL crash.

    If CPUTYPE is not defined, set arch to the oldest CPU that supports
    SSE 4.1 (penryn), else let the build system try to build with whatever
    is set.

    Add a message indicating that the port should be rebuilt with CPUTYPE
    defined for best performance.

    While here, use zstd from ports (now detected).

    PR: 272192
    Reported by:    Patrick McMunn <doctorwhoguy@gmail.com>

 emulators/pcsx2/Makefile                                | 17 +++++++++++++----
 emulators/pcsx2/Makefile.tuples                         |  1 -
 emulators/pcsx2/distinfo                                |  2 --
 .../pcsx2/files/extra-patch-no-march-minimum-req (new)  | 11 +++++++++++
 emulators/pcsx2/files/extra-patch-no-march-native (new) | 11 +++++++++++
 emulators/pcsx2/pkg-message (new)                       |  7 +++++++
 6 files changed, 42 insertions(+), 7 deletions(-)
Comment 6 Ganael LAPLANCHE freebsd_committer freebsd_triage 2023-06-27 10:32:41 UTC
Hello Patrick, Graham and Daniel,

Thanks a lot for your report and help. I've committed the fix as well as a message indicating that PCSX2 should probably be recompiled with CPUTYPE defined.

Cheers,

Ganael.