go-sdl2 icon indicating copy to clipboard operation
go-sdl2 copied to clipboard

Crash on running Go-SDL2 app through Rosetta

Open SolarLune opened this issue 1 year ago • 6 comments

Hello!

Just wanted to see if anybody knew anything about this particular issue - I'm the creator of a productivity and organization app known as MasterPlan. It's written with go-sdl2, and has been working pretty well. Normally, I build on GitHub Actions through Mac OS 10.15 - you can see the setup script for the action here.

However, some M1 Mac users have reported that the app crashes on initial startup for them - looks like it's due to sdl_ttf; this is the result that a user got on attempting to run the program through the terminal.

MasterPlan.app/Contents/MacOS/MasterPlan ; exit;
SIGILL: illegal instruction
PC=0x46d373e m=0 sigcode=1
signal arrived during cgo execution
instruction bytes: 0xc5 0xf8 0x57 0xc0 0xc5 0xf8 0x11 0x47 0x28 0xc5 0xf8 0x11 0x47 0x18 0xc5 0xf8

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x4491750, 0xc00029f920)
    /Users/runner/hostedtoolcache/go/1.17.11/x64/src/runtime/cgocall.go:156 +0x5c fp=0xc00029f8f8 sp=0xc00029f8c0 pc=0x40136fc
github.com/veandco/go-sdl2/ttf._Cfunc_TTF_Init()
    _cgo_gotypes.go:461 +0x48 fp=0xc00029f920 sp=0xc00029f8f8 pc=0x4171a08
github.com/veandco/go-sdl2/ttf.Init()
    /Users/runner/go/pkg/mod/github.com/veandco/[email protected]/ttf/sdl_ttf.go:56 +0x19 fp=0xc00029f938 sp=0xc00029f920 pc=0x4171f79
main.main()
    /Users/runner/work/masterplan/masterplan/main.go:186 +0x8ee fp=0xc00029ff80 sp=0xc00029f938 pc=0x443c2ae
runtime.main()
    /Users/runner/hostedtoolcache/go/1.17.11/x64/src/runtime/proc.go:255 +0x227 fp=0xc00029ffe0 sp=0xc00029ff80 pc=0x4046cc7
runtime.goexit()
    /Users/runner/hostedtoolcache/go/1.17.11/x64/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc00029ffe8 sp=0xc00029ffe0 pc=0x40759a1

rax    0x5b12248
rbx    0x5b0ea80
rcx    0x5b0ea80
rdx    0xffffffffffffffc8
rdi    0x5b12230
rsi    0x0
rbp    0x2092567f0
rsp    0x2092567f0
r8     0xe1c
r9     0xe2d
r10    0xffffe000
r11    0x0
r12    0x5b12230
r13    0x5b11ea0
r14    0x4bdff78
r15    0x0
rip    0x46d373e
rflags 0x202
cs     0x2b
fs     0x0
gs     0x0
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...       7 completed.

I've done some research on what this issue could be, but I'm not 100% on the cause. Clearly, it's crashing during the ttf.Init() function call, but I'm not really sure what to make of that. It should be that Rosetta can handle all Intel code and translate it to ARM code on program first run, right?

I could use some direction in case somebody else has run into something similar before?

SolarLune avatar Oct 02 '22 05:10 SolarLune