-
Notifications
You must be signed in to change notification settings - Fork 82
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
M1 mac + sdl2 error #154
Comments
I have this problem too。 |
I'm having the same problem with Quicklisp installation. |
I am currently having the same issue as well, I tried on a Mac mini M1 and on a Macbook Pro M1, same issue happens on both devices. |
I did some research and it seems that https://github.com/lispgames/cl-sdl2/tree/main/src/spec folder doesn't have arm-darwin spec files. Is this the issue? How do you generate those? ping @mfiano |
Ah, that would explain it. You would need to compile c2ffi and have it in your path, delete the spec files, and then load cl-sdl2 and it will generate them all. If it does not generate them for your architecture, then a small code change is needed, which I am not sure how to do as I don't have access to that hardware, and you should ping |
Complied c2ffi, it did generate a Error message when autloading sdl2:
|
FYI: Installing via Quicklisp works on an Intel iMac, so the issue's sure to be Apple-Silicon-specific. |
@jeongsoolee09 Yes. only for apple-sillicon |
Not sure if I did this the right way, other spec files are empty as well. |
I don't have access to apple hardware at the moment - can't help with that platform. |
I could help with the task but would need to have very rudimentary instructions. |
@rpav can have better answers, but you probably need to try to run c2ffi command line (the one cl-sdl2 tries to invoke) directly and see what it outputs - probably some headers are missing or c2ffi couldn't locate them. |
The issue with empty CL-USER> (ql:quickload :cl-autowrap)
CL-USER> (autowrap:c-include "/opt/homebrew/include/SDL2/SDL.h") It will generate files in home directory. ...
((:module autowrap-spec
:pathname "spec"
:components
((:static-file "SDL2.h")
(:static-file "SDL2.aarch64-apple-darwin9.spec") ; Added this line
... but it still doesn't solve the issue (see comment section of the attached gist file, there's a lot of errors due to undefined foreign types like uint32 and so on) btw: if you use cl-autowrap from Quicklisp, you'll get even more errors (rpav/cl-autowrap#119), clone master branch directly from GitHub instead. |
I managed to get rid of the (cl:list "/opt/homebrew/include/"
"/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/"
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Headers") But now I'm getting different errors 😓 CL-USER> (ql:quickload :sdl2)
To load "sdl2":
Load 1 ASDF system:
sdl2
; Loading "sdl2"
[package sdl2]....................................
[package sdl2-examples]...........................
.........................................
..
; file: /Users/mg/common-lisp/cl-sdl2/src/sdl2.lisp
; in: DEFUN INIT
; (SETF SDL2::*LISP-MESSAGE-EVENT* (SDL2-FFI.FUNCTIONS:SDL-REGISTER-EVENTS 1)
; (PLUS-C:C-REF SDL2::*WAKEUP-EVENT* SDL2-FFI:SDL-EVENT :TYPE)
; SDL2::*LISP-MESSAGE-EVENT*)
; ==>
; (SETF (PLUS-C:C-REF SDL2::*WAKEUP-EVENT* SDL2-FFI:SDL-EVENT :TYPE)
; SDL2::*LISP-MESSAGE-EVENT*)
;
; caught ERROR:
; during macroexpansion of (SETF # *LISP-MESSAGE-EVENT*). Use *BREAK-ON-SIGNALS*
; to intercept.
;
; Unknown field :TYPE for foreign-record type:
; #<AUTOWRAP:FOREIGN-RECORD SDL-EVENT {7009D2D7B3}>
; Valid fields:
; :DROP (SDL2-FFI:SDL-DROP-EVENT)
; :DGESTURE (SDL2-FFI:SDL-DOLLAR-GESTURE-EVENT)
; :MGESTURE (SDL2-FFI:SDL-MULTI-GESTURE-EVENT)
; :TFINGER (SDL2-FFI:SDL-TOUCH-FINGER-EVENT)
; :SYSWM (SDL2-FFI:SDL-SYS-WM-EVENT)
; :USER (SDL2-FFI:SDL-USER-EVENT)
; :QUIT (SDL2-FFI:SDL-QUIT-EVENT)
; :SENSOR (SDL2-FFI:SDL-SENSOR-EVENT)
; :ADEVICE (SDL2-FFI:SDL-AUDIO-DEVICE-EVENT)
; :CSENSOR (SDL2-FFI:SDL-CONTROLLER-SENSOR-EVENT)
; :CTOUCHPAD (SDL2-FFI:SDL-CONTROLLER-TOUCHPAD-EVENT)
; :CDEVICE (SDL2-FFI:SDL-CONTROLLER-DEVICE-EVENT)
; :CBUTTON (SDL2-FFI:SDL-CONTROLLER-BUTTON-EVENT)
; :CAXIS (SDL2-FFI:SDL-CONTROLLER-AXIS-EVENT)
; :JBATTERY (SDL2-FFI:SDL-JOY-BATTERY-EVENT)
; :JDEVICE (SDL2-FFI:SDL-JOY-DEVICE-EVENT)
; :JBUTTON (SDL2-FFI:SDL-JOY-BUTTON-EVENT)
; :JHAT (SDL2-FFI:SDL-JOY-HAT-EVENT)
; :JBALL (SDL2-FFI:SDL-JOY-BALL-EVENT)
; :JAXIS (SDL2-FFI:SDL-JOY-AXIS-EVENT)
; :WHEEL (SDL2-FFI:SDL-MOUSE-WHEEL-EVENT)
; :BUTTON (SDL2-FFI:SDL-MOUSE-BUTTON-EVENT)
; :MOTION (SDL2-FFI:SDL-MOUSE-MOTION-EVENT)
; :TEXT (SDL2-FFI:SDL-TEXT-INPUT-EVENT)
; :EDIT-EXT (SDL2-FFI:SDL-TEXT-EDITING-EXT-EVENT)
; :EDIT (SDL2-FFI:SDL-TEXT-EDITING-EVENT)
; :KEY (SDL2-FFI:SDL-KEYBOARD-EVENT)
; :WINDOW (SDL2-FFI:SDL-WINDOW-EVENT)
; :DISPLAY (SDL2-FFI:SDL-DISPLAY-EVENT)
; :COMMON (SDL2-FFI:SDL-COMMON-EVENT)
;
; in: DEFUN VERSION
; (SDL2::VER :MAJOR)
;
; caught ERROR:
; during macroexpansion of (C-REF #:TMP0 SDL2-FFI:SDL-VERSION ...). Use
; *BREAK-ON-SIGNALS* to intercept.
;
; Unknown field :MAJOR for foreign-record type:
; #<AUTOWRAP:FOREIGN-RECORD SDL-VERSION {7009D2E3B3}>
; Valid fields:
;
; (SDL2::VER :MINOR)
;
; caught ERROR:
; during macroexpansion of (C-REF #:TMP0 SDL2-FFI:SDL-VERSION ...). Use
; *BREAK-ON-SIGNALS* to intercept.
;
; Unknown field :MINOR for foreign-record type:
; #<AUTOWRAP:FOREIGN-RECORD SDL-VERSION {7009D2E3B3}>
; Valid fields:
;
; (SDL2::VER :PATCH)
;
; caught ERROR:
; during macroexpansion of (C-REF #:TMP0 SDL2-FFI:SDL-VERSION ...). Use
; *BREAK-ON-SIGNALS* to intercept.
;
; Unknown field :PATCH for foreign-record type:
; #<AUTOWRAP:FOREIGN-RECORD SDL-VERSION {7009D2E3B3}>
; Valid fields:
;
; Debugger entered on #<UIOP/LISP-BUILD:COMPILE-FILE-ERROR {700DE46803}> Looks like it has issues with recognising Uint8/Sint8/Uint16/SInt16 (and so on) types. ; file: /Users/mg/common-lisp/cl-sdl2/src/surface.lisp
; in: DEFUN GET-COLOR-KEY
; (PLUS-C:C-LET ((SDL2::KEY SDL2-FFI:UINT32))
; (SDL2::CHECK-RC
; (SDL2-FFI.FUNCTIONS:SDL-GET-COLOR-KEY SDL2::SURFACE (SDL2::KEY PLUS-C:&)))
; SDL2::KEY)
;
; caught ERROR:
; during macroexpansion of
; (C-LET (#)
; (CHECK-RC #)
; ...).
; Use *BREAK-ON-SIGNALS* to intercept.
;
; Undefined foreign type: UINT32
.
; in: DEFUN GET-ALPHA-MOD
; (PLUS-C:C-LET ((SDL2::ALPHA SDL2-FFI:UINT8))
; (SDL2::CHECK-RC
; (SDL2-FFI.FUNCTIONS:SDL-GET-SURFACE-ALPHA-MOD SDL2::SURFACE
; (SDL2::ALPHA PLUS-C:&)))
; SDL2::ALPHA)
;
; caught ERROR:
; during macroexpansion of
; (C-LET (#)
; (CHECK-RC #)
; ...).
; Use *BREAK-ON-SIGNALS* to intercept.
;
; Undefined foreign type: UINT8
; in: DEFUN GET-COLOR-MOD
; (PLUS-C:C-LET ((SDL2::R SDL2-FFI:UINT8) (SDL2::G SDL2-FFI:UINT8)
; (SDL2::B SDL2-FFI:UINT8))
; (SDL2::CHECK-RC
; (SDL2-FFI.FUNCTIONS:SDL-GET-SURFACE-COLOR-MOD SDL2::SURFACE
; (SDL2::R PLUS-C:&)
; (SDL2::G PLUS-C:&)
; (SDL2::B PLUS-C:&)))
; (VALUES SDL2::R SDL2::G SDL2::B))
;
; caught ERROR:
; during macroexpansion of
; (C-LET (# # #)
; (CHECK-RC #)
; ...).
; Use *BREAK-ON-SIGNALS* to intercept.
;
; Undefined foreign type: UINT8
; Debugger entered on #<UIOP/LISP-BUILD:COMPILE-FILE-ERROR {70143546C3}>
;
; compilation unit aborted
; caught 1 fatal ERROR condition
; caught 3 ERROR conditions Maybe it will be useful to someone |
Here are the modifications that I made to get SDL2 working on an M1 Mac: https://github.com/ellisvelo/cl-sdl2/blob/master/src/autowrap.lisp#L12-L26 The spec file is here: https://github.com/ellisvelo/cl-sdl2/blob/main/src/spec/SDL2.aarch64-apple-darwin9.spec |
Hi.
as in the original post. |
Hi @mdbergmann, the latest versions of
|
@ellisvelo that seemed to fix it, but now I'm getting |
Thanks! @ellisvelo's comment: #154 (comment), fixed it for me. |
Hmmm.. not sure @kuberlog because PLUS-C is a part of |
I can confirm it works now for me after repeating the procedure from @ellisvelo |
Thanks guys, got sdl2 working, now trying to load sdl2_ttf with similar errors. Also using sdl2_image Any hints how to fix?
|
I ran into that same problem with If that doesn't work, then you can try cloning https://github.com/ellisvelo/cl-sdl2-ttf into your quicklisp/local-projects directory. I didn't run into any issues with |
I run in a few issues, with |
Following instructions from @ellisvelo works with SBCL, but ECL gives me an error:
|
It's looking for SDL2.arm-apple-darwin9.spec instead of SDL2.aarch64-apple-darwin9.spec @LovingSalamander . I did the following to workaround it.
|
@LovingSalamander, the suggestion above works, but I think it would be better to build ecl so that it has the :arm64 and :aarch64 features. I built it using the following command: |
@ellisvelo Thank you so much for writing out the full command! I've had trouble building ECL from source and usually resort to homebrew. This was super helpful and I was able to run SDL2 this way. |
@ellisvelo Thank you so much for the command. I can also confirm that your forks of cl-sdl2-mixer and cl-sdl2-image also worked. |
This should be fixed by #167. Please reopen if it is not. |
After installing sdl2 (brew install sdl2 and manual download), I'm trying to load sdl2:
The text was updated successfully, but these errors were encountered: