vydd / sketch

A Common Lisp framework for the creation of electronic art, visual design, game prototyping, game making, computer graphics, exploration of human-computer interaction, and more.
MIT License
1.4k stars 67 forks source link

OSX Can't run hello world example #29

Closed abramsba closed 5 years ago

abramsba commented 6 years ago

I've just installed sbcl via brew and installed quicklisp package manager. I load the library and load the example, but when the window is drawn the program crashes.

SDL2 ttf is version 2.0.14, image is 2.0.3, and SDL2 is 2.0.8.

: [~] > sbcl
This is SBCL 1.4.11, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (ql:quickload :sketch)
To load "sketch":
  Load 1 ASDF system:
    sketch
; Loading "sketch"
..........
(:SKETCH)
* (ql:quickload :sketch-examples)
To load "sketch-examples":
  Load 1 ASDF system:
    sketch-examples
; Loading "sketch-examples"

(:SKETCH-EXAMPLES)
* (make-instance 'sketch-examples:hello-world)

#<SKETCH-EXAMPLES:HELLO-WORLD {1003462033}>
* 2018-09-07 19:32:44.626 sbcl[38221:6484905] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fffaa0522cb __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fffbee6c48d objc_exception_throw + 48
    2   AppKit                              0x00007fffa823de82 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4480
    3   SDL2                                0x0000000002a225f5 SDL2 + 140789
    4   SDL2                                0x0000000002a0c8dd SDL2 + 51421
    5   ???                                 0x0000000022a6b721 0x0 + 581351201
    6   ???                                 0x0000000022ae2d8e 0x0 + 581840270
)
libc++abi.dylib: terminating with uncaught exception of type NSException
fatal error encountered in SBCL pid 38221(tid 0xb0000000):
SIGABRT received.

Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb>
vydd commented 6 years ago

Hi, thanks for reporting this. Which version of OSX is it? Also, could you try running it with CCL?

I'll try looking at this in next few days (OSX is not my primary system anymore).

abramsba commented 6 years ago

Sierra 10.12.6

vydd commented 5 years ago

@abramsba Hi again :)

The problem is described in https://github.com/lispgames/cl-sdl2/issues/29 . The workaround with SDL2:MAKE-THIS-THREAD-MAIN works alright, and you can try it as:

(ql:quickload :sketch-examples)
(sdl2:make-this-thread-main
  (lambda () (make-instance 'sketch-examples:hello-world)))

However, you won't be able to use the REPL, which sucks. This is why SBCL + MacOS X is listed as unsupported in Sketch README (yup. totally forgot about this).

A much better solution would be to use CCL. I used it back when OS X was my primary system and developed most of Sketch with it.

abramsba commented 5 years ago

I downloaded CCL, registered quicklisp and grabbed the examples. I'm able to run the example directly with (make-instance 'sketch-examples:hello-world). Thanks, I'll be using CCL instead.

https://i.imgur.com/3b6iOjf.png