Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on running Go-SDL2 app through Rosetta #540

Open
SolarLune opened this issue Oct 2, 2022 · 6 comments
Open

Crash on running Go-SDL2 app through Rosetta #540

SolarLune opened this issue Oct 2, 2022 · 6 comments

Comments

@SolarLune
Copy link

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?

@veeableful
Copy link
Contributor

Hi @SolarLune, thanks for reporting the issue! I will check if I can reproduce this and fix it. Really cool to see an actual application that uses go-sdl2!

@veeableful
Copy link
Contributor

Hi @SolarLune, would it be possible for you to test the building for darwin/arm64 in the latest v0.4.x branch? I have added static compilation support for darwin/arm64. It seems to work on my Linux machine to cross-compile to the macOS and it runs on my Macbook Air M1 laptop. If it works for you too, I will add the tag for v0.4.26!

@veeableful
Copy link
Contributor

Hi @SolarLune, I have included static libraries for darwin/arm64 in the new v0.4.26 release. Let me know if it works for you!

@SolarLune
Copy link
Author

Hello! Sorry for not getting back to you about this; other things have been going on. I'm looking to have somebody test this for me, but nobody's gotten back to me yet. Once they have, I'll let you know if the issue's resolved. Thank you for your patience!

@SolarLune
Copy link
Author

SolarLune commented Jan 12, 2023

Hello, so another M1 user tested and said it still isn't working. Just wanted to ask if I should need to do anything apart from static compiling on Mac?

@veeableful
Copy link
Contributor

Hi @SolarLune, was the executable statically compiled for darwin/arm64 and that wasn't working for the user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants