Giter Club home page Giter Club logo

cl-sdl2's Introduction

cl-sdl2

cl-sdl2 is a Common Lisp wrapper for the SDL 2.0 C Library, with many contributors, currently maintained by Michael Fiano [email protected].

It is licensed under the MIT license.

Installation

sdl2 is in Quicklisp, see below for instructions.

SDL 2.0 C Library Install

See https://wiki.libsdl.org/Installation

On Linux, you can probably find SDL2 in your distribution's package set. For other platforms, or for building manually, download the source.

Package

  • Debian based: Ubuntu, Mint etc
sudo apt-get install libsdl2-2.0
  • Arch
sudo pacman -S sdl2

Compilation

If you need to compile from source for your Linux platform:

  1. Download source code
  2. Compile
  3. Install

For example:

cd /tmp
wget https://www.libsdl.org/release/SDL2-2.0.4.tar.gz
tar -xzvf SDL2-2.?.?.tar.gz
cd SDL2-2.?.?
./configure
make
sudo make install

This will install the SDL-2.0.x C Library into your /usr/local location.

It's generally a good idea to install at a minimum the version of SDL2 that was wrapped; however, sub revisions should not introduce binary incompatibility and should be fine. If you install a different version, certain features may not be available or may not work correctly.

Quicklisp Install

sdl2 is best installed via QuickLisp, though for cutting-edge changes, you may want to install from github as below.

If you don't have Quicklisp, then follow the directions to install it. We assume you placed the Quicklisp repository in the default place as indicated by the directions and have added it to your lisp init file.

github install

cd $HOME/quicklisp/local-projects
git clone https://github.com/rpav/cl-autowrap.git
git clone https://github.com/lispgames/cl-sdl2.git

Then, use quicklisp to install the libraries required by cl-sdl2:

Start your lisp. Then, just:

(ql:quickload "sdl2")

Swank/Slynk features

sdl2 enables certain restarts for friendly interaction with SLIME or Sly if you have either properly installed. "Proper installation" in this case means swank.asd or slynk.asd is linked such that ASDF can find and load it.

Note this is easily achieved even if you have installed them from github or some other non-Quicklisp repository:

  • Symlink the directory to $HOME/quicklisp/local-projects/
  • Symlink the .asd to $HOME/.local/common-lisp/sources/

Similarly you could just clone into ~/quicklisp/local-projects as well; this should work on Windows as well. There are numerous other options for configuring and managing ASDs, as well.

Running the sdl2 examples

Start your lisp:

(ql:quickload :sdl2/examples)
(sdl2-examples:basic-test)

This example will open a window with an opengl primitive in it. Any mouse movements or keystrokes are recorded in the terminal (or emacs SLIME output buffer *inferior-lisp*). Hitting the ESCAPE key will terminate the example.

OSX

Newer versions of OSX have had some difficulties as calls which require nextEventMatchingMask must be called from the main thread of your program.

This is especially relevant to SBCL, although issues have also been noticed in CCL.

Currently, initialisation must take place on your main thread:

(ql:quickload :sdl2/examples)

;; We should be able to run examples as normal on CCL
#-sbcl (sdl2-examples:basic-test)

;; SBCL requires that we initialise in the main thread
#+sbcl (sdl2:make-this-thread-main #'sdl2-examples:basic-test)

Thank you for using sdl2!

cl-sdl2's People

Contributors

aethaeryn avatar agentultra avatar alex-eg avatar borodust avatar bradwbeer avatar cbaggers avatar clsd avatar cmushawn avatar death avatar ellisvelo avatar failproofshark avatar fitzsim avatar halfwake avatar jobez avatar kat-co avatar ks avatar mfiano avatar mickbeaver avatar nightfly19 avatar nikki93 avatar nsrahmad avatar palladinium avatar photex avatar psilord avatar reinuseslisp avatar rpav avatar tatrix avatar tavurth avatar temporal avatar vitovan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cl-sdl2's Issues

Suggestion: Shipping lib binaries as fallbacks with cl-sdl2

I'd love to see binaries of the libs for macOS, Windows and perhaps linux[0] shipping with cl-sdl2.

There would be at least: 64bit macOS, 32 & 64bit Windows

They would be set in library.lisp as the last options so libs on the system would take precedence.

The goal is to ease more users into the lisp game making world. People who are coming to lisp are often excited about the kinds of cools things folks people have seen in clinch, xelf and other live systems and are taking a leap into lisp, which for many also means taking a leap into emacs, when they hit the 'some c lib not found' error I've seen people give up.

This addition would be a nice way to ease the process.

[0] linux is a slightly different case as getting libs is so simple & so well understood. However given that the default will be to use the system library I guess this change wouldn't hurt that

basic-examples doesn't run on CCL/OS X, "no applicable method"

This may be due to my general noobishness regarding Lisp, but when I try to run the example using Clozure, I get:

  ? (sdl2-examples::basic-test)
  Using SDL Library Version: 2.0.3
  Setting up window/gl.
  Opening game controllers.
  Beginning main loop.
  > Error: There is no applicable method for the generic function:
  > #<STANDARD-GENERIC-FUNCTION AUTOWRAP:FOREIGN-ENUM-VALUES #xCBFF9E6>
  > when called with arguments:
  > (SDL2-FFI:SDL-EVENT-TYPE)
  > While executing: SDL2-EXAMPLES:BASIC-TEST, in process listener(1).
  > Type :POP to abort, :R for a list of available restarts.
  > Type :? for other options.
  1 >

Unable to see the window when running basic example from SLIME

If I run (sdl2-examples:basic-test) from within SLIME then I don't see any window and the REPL hangs forever. Subsequently aborting the thread seems to leave it in a broken state and I need to kill SBCL and restart it from scratch. But if I run it from the command line using the SBCL executable then it works fine.

I am using SBCL 1.1.12 (x86) on Windows 8. Any help would be appreciated. I have been banging my head on this issue for a while and I really hope it isn't just something stupid I'm doing! ๐Ÿ˜ญ

autowrap is renaming SDL_TRUE and SDL_FALSE to :TRU and :FALS

If you look at the macroexpansion of src/autowrap.lisp you'll find this:

(COMMON-LISP:PROGN
     (COMMON-LISP:EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE)
       (SB-C::%DEFCONSTANT '+SDL-FALSE+ 0 'COMMON-LISP:NIL
                           (SB-C:SOURCE-LOCATION)))
     (COMMON-LISP:EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE)
       (SB-C::%DEFCONSTANT '+SDL-TRUE+ 1 'COMMON-LISP:NIL
                           (SB-C:SOURCE-LOCATION)))
     (AUTOWRAP:DEFINE-FOREIGN-ENUM '#:ANON-TYPE-1518 28
                                   '((:FALS . 0) (:TRU . 1))))

Notice the :FALS and :TRU symbols defined there.

I tracked this down to an autowrap feature which detects 'suffixes' on enumerations and removes them (just as it detects prefixes), done by the function autowrap::parse-enum-fields in parse.lisp. It sees the common 'E' at the end of both SDL_TRUE and SDL_FALSE, so considers this a suffix.

This causes sdl2::sdl-true-p to call (autowrap:enum-value 'sdl2-ffi:sdl-bool :true) and receive NIL back (since autowrap only knows about :tru), causing a type error when calling = on it.

This causes the example code to fail if any controllers are plugged in, but you can easily replicate it by calling sdl2::sdl-true-p directly.

No clue what the right thing to do here. Could make sdl2 expect this and look for :TRU instead of :TRUE, or somehow find a way to make autowrap not treat these as suffixes which it strips.

Unable to use sdl2::warp-mouse-in-window

This is the error I get in SBCL when trying to use sdl2::warp-mouse-in-window:

The variable SDL2::WIN is unbound.
  [Condition of type UNBOUND-VARIABLE]

Currently in src/mouse.lisp it is defined as:

(defmacro warp-mouse-in-window (win x y)
  "Use this function to move the mouse to the given position within the window."
  `(sdl-warp-mouse-in-window win x y))

It needs to be defined as:

(defmacro warp-mouse-in-window (win x y)
  "Use this function to move the mouse to the given position within the window."
  `(sdl-warp-mouse-in-window ,win ,x ,y))

or

(defun warp-mouse-in-window (win x y)
  "Use this function to move the mouse to the given position within the window."
  (sdl-warp-mouse-in-window win x y))

SDL_SetSurfaceBlendMode is missing

SDL_SetSurfaceBlendMode / set-surface-blend-mode seems missing in cl-sdl2.

sdl-set-surface-blend-node is defined (in sdl2-ffi.functions).

And +sdl-blendmode-add+ is present in sdl2-ffi but not exported by sdl2.

Version Skew with sdl2 and autowrap's spec files.

I ran into an instance where I downloaded SDL 2.0.1 and installed it against
the currently available cl-sdl2 (on oct 31, 2013)

The spec files were produced against 2.0.0. But the real header files
on the machine were SDL 2.0.1.

Here is an example of the problem this caused:

In SDL_version.h, there is a constant called SDL_PATCHLEVEL. In the
spec files it is a 0, because cl-sdl2 was autowrapped against SDL
2.0.0. But, this isn't true, because I installed SDL 2.0.1. So, when
cl-autowrap generates the in memory representation of the spec files,
it does so for a different version of the library that CFFI will load
into the running lisp image. Given how different distros will package
different versions of SDL2 by their very nature, this seems like an
underlying maintenance and support problem.

So, is there any way to generate multiple spec directories (given
multiple versions of SDL2) and choose the right one based on the
version of the library that is discovered on the compilation machine?
Conditional compilation that includes < or > style checks sounds pretty
difficult.

Also, if no version for which spec files were generated was found
on a machine that matches a present installation, should there be a
continuable condition signaled, or at least a warning emitted stating
sorry, but this is the best you (the user of cl-sdl2) get and hope
it works?

SDL2 Example Gives Error on Windows

Windows 7 64bit
CCL 1.9 x86 and x64
Steel Bank Common Lisp 1.1.4.0.mswin.1288-90ab477 (X86)

I install sdl2 through quicklisp quickload

The examples break every time I want to show or hide cursor.
(sdl2:mouse-is-haptic-p) also breaks
I have found out that every time #'sdl-true-p is run, there is a crash
because it compares a nil in #'=

(autowrap:enum-value 'sdl2-ffi:sdl-bool :true)
returns a nil for me whereas someone else has said it returns a 1 on their system.

Error when pressing 's' or 'h':
Argument X is not a NUMBER: NIL [Condition of type SIMPLE-TYPE-ERROR]
Closing the window gives:
:COLOR-BUFFERDL is not a valid symbol for bitfield type #<CFFI::FOREIGN-BITFIELD CL-OPENGL-BINDINGS:CLEARBUFFERMASK>.

c-with inside query-texture fails on :uint32

I'm running this with SBCL 1.3.1 on Windows 10.

From quicklisp:
cl-sdl-20151218
cl-autowrap-20151218

It's failing to find :uint32 in cffi-sys. In looking through the cffi source, it looks like the stdint.h typedefs aren't available until you reach the cffi layer. I don't know if there's a way to fix this in the autowrap header or not. For now, I can get around it by replacing :uint32 with :unsigned-int.

:UINT32 fell through ECASE expression.
Wanted one of (:CHAR :UNSIGNED-CHAR :SHORT :UNSIGNED-SHORT :INT
               :UNSIGNED-INT :LONG :UNSIGNED-LONG :LONG-LONG
               :UNSIGNED-LONG-LONG :FLOAT :DOUBLE :POINTER
               :VOID).
   [Condition of type SB-KERNEL:CASE-FAILURE]

Restarts:
 0: [*CONTINUE] Return to the SDL2 main loop.
 1: [ABORT] Abort, quitting SDL2 entirely.
 2: [ABORT] abort thread (#<THREAD "SDL2 Main Thread" RUNNING {26C644E9}>)

Backtrace:
  0: (SB-KERNEL:CASE-FAILURE ECASE :UINT32 (:CHAR :UNSIGNED-CHAR :SHORT :UNSIGNED-SHORT :INT :UNSIGNED-INT ...))
  1: (CFFI-SYS::CONVERT-FOREIGN-TYPE :UINT32)
  2: (CFFI-SYS:%FOREIGN-TYPE-SIZE :UINT32)
  3: (AUTOWRAP:ALLOC-PTR :UINT32 1)
  4: (SDL2:QUERY-TEXTURE #<SDL2-FFI:SDL-TEXTURE {#X001B38D0}>)
  5: (RENDER-TILED #<SDL2-FFI:SDL-TEXTURE {#X001B38D0}> #<SDL2-FFI:SDL-RENDERER {#X001B4F30}>)
  6: ((LAMBDA NIL :IN LESSON-2))
  7: (SDL2::HANDLE-MESSAGE (#<FUNCTION (LAMBDA NIL :IN LESSON-2) {27417075}> . #S(TRIVIAL-CHANNELS:CHANNEL :QUEUE #S(TRIVIAL-CHANNELS.QUEUE:QUEUE :HEAD NIL :TAIL NIL) :Q-CONDITION #<SB-THREAD:WAITQUEUE Ano..
  8: (SDL2::SDL-MAIN-THREAD)

fails to compile on CLISP

*** - The value of CFFI-SYS::CONVENTION must be one of :STDCALL, :CDECL
      The value is: NIL
The following restarts are available:
RETRY          :R1      Retry compiling #<CL-SOURCE-FILE "sdl2" "sdl2">.
ACCEPT         :R2      Continue, treating compiling #<CL-SOURCE-FILE "sdl2" "sdl2"> as having been successful.
ABORT          :R3      Give up on "sdl2"
ABORT          :R4      Abort main loop

CREATE-RENDERER has wrong default parameter value

Evaluating

(sdl2:with-init (:everything)
  (sdl2:with-window (win)
    (sdl2:create-renderer win -1)))

Results in

; Evaluation aborted on #<TYPE-ERROR expected-type: LIST datum: 0>.

It seems that CREATE-RENDERER expects a list of render flag symbols
for the optional parameter FLAGS so the default value for FLAGS should
probably be NIL rather than 0.

SDL2 Framework on Mac OS X

No support is implemented for loading the SDL2 Framework on Mac OS X. This can easily be fixed by changing "library.lisp" from this:

(cffi:define-foreign-library libsdl2
(:darwin (:default "libSDL2"))
(:unix (:or "libSDL2-2.0.so.0" "libSDL2"))
(:windows "SDL2.dll")
(t (:default "libSDL2")))

...to this:

(cffi:define-foreign-library libsdl2
(:darwin (:or (:framework "SDL2") (:default "libSDL2"))) ;;; <<< Right here
(:unix (:or "libSDL2-2.0.so.0" "libSDL2"))
(:windows "SDL2.dll")
(t (:default "libSDL2")))

It gets very frustrating because every time I download updates to CL-SDL2, I have to re-implement this.

How to request a Core Context using SDL2

Hi,

New to SDL2.

I have an oldish Mac that is capable of creating a Core 3.3 GL context. I can do this in C on my machine.

Using SDL2 out of the box I get the default Compatibility context which is 2.1. I would like to know where I should put the incantation for a Core context? This is what I believe is necessary

(sdl2:gl-set-attr :context-major-version 3)
(sdl2:gl-set-attr :context-minor-version 3)
(sdl2:gl-set-attr :context-profile-mask sdl2-ffi::+SDL-GL-CONTEXT-PROFILE-CORE+))

I also believe that I need to set +SDL-GL-CONTEXT-FORWARD-COMPATIBLE-FLAG+ to true, but not quite sure how to do that.

Any pointers gratefully received!

Cheers

Remove conditionalizing on packages that are not required by dep: swank, etc

Not really a bug, but can cause surprises as it did for me.

If you, say quickload sdl2 from emacs or vim in my case with swank loaded, then sdl2 will be compiled with #+swank code:

(defun sdl-main-thread ()
(let ((main-thread (bt:current-thread))
#+swank (swank:sldb-quit-restart 'continue)
etc

If you are later compile in sdl2 for use in standalone program it signals that no such symbol or something.
It could be resolved by adding asdf dependence on swank, but it is obviously stupid. I guess such kind of conditionalizing should be done on user side somehow and not in the sdl2 itself.

scancode handling broken

Hello,

In the basic.lisp example, we see the form (equal :sdl-scancode-escape (sdl2:scancode-value keysym)) This test, for me, never passes. The value returned by sdl:scancode-value keysym) is 27, but I'm not sure how one can compare an integer against a keyword symbol and have that work out. I tried a bunch of iterations, some using autowrap:enum-value/key to try and get it working, but to no avail. Also, are the spec/ files from the SDL2 install on the creator's machine? What happens if the SDL2 that I have on my machine is newer, like say the official release? Is it possible that the spec/ header files and the real header files (that the C library was compiled against) could differ in enums and such?

Thank you.

Peter Keller

basic-examples doesn't run on SBCL/OS X, bogus stack frame?

I open sbcl and run:

(asdf:load-system :sdl2)
(asdf:load-system :sdl2-examples)

They load fine (albeit with a couple of warnings).

But when I run:

(sdl2-examples::basic-test)

The window pops up with the red rectangle, but the menu bar doesn't resolve (no minimize/maximize buttons), the example is nonresponsive and the mouse just shows the spinning ball inside of it. I cannot kill it and have to issue a ^C in the terminal.
In the terminal after the ^C I see:

  • (sdl2-examples::basic-test)
    Using SDL Library Version: 2.0.3
    Setting up window/gl.
    Opening game controllers.
    Beginning main loop.
    ^C
    debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread
    #<THREAD "main thread" RUNNING {1002C0E803}>:
    Interactive interrupt at #x7FFF9C1CD486.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE] Return from SB-UNIX:SIGINT.
1: [ABORT ] Exit debugger, returning to top level.

("bogus stack frame")
0]

Crash when loading system.

This has started since the latest quicklisp release cl-sdl2-20170227-git

To load "sdl2":
  Install 1 Quicklisp release:
    cl-sdl2
; Loading "sdl2"
..................................................
[package sdl2-ffi]................................
[package sdl2-ffi.accessors]......................
[package sdl2-ffi.functions]......................
[package sdl2]....................................
[package sdl2-examples]...........................
..................................................
..................................................
.....................................

; file: /Users/Baggers/quicklisp/dists/quicklisp/software/cl-sdl2-20170227-git/src/syswm.lisp
; in: DEFUN GET-WINDOW-WM-INFO
;     (SDL2::INFO :INFO :WIN :WINDOW)
; ==>
;   (PLUS-C:C-REF #:TMP0 SDL2-FFI:SDL-SYSWM-INFO :INFO :WIN :WINDOW)
; 
; caught ERROR:
;   during macroexpansion of (C-REF #:TMP0 SDL2-FFI:SDL-SYSWM-INFO ...). Use
;   *BREAK-ON-SIGNALS* to intercept.
;   
;    Unknown field :WINDOW for foreign-record type:
;   #<AUTOWRAP:FOREIGN-RECORD ANON-TYPE-993 {100482A323}>
;   Valid fields:
;     :HDC (SDL2-FFI:HDC)
;   

Error:

COMPILE-FILE-ERROR while
compiling #<CL-SOURCE-FILE "sdl2" "syswm">
   [Condition of type UIOP/LISP-BUILD:COMPILE-FILE-ERROR]

Restarts:
 0: [RETRY] Retry compiling #<CL-SOURCE-FILE "sdl2" "syswm">.
 1: [ACCEPT] Continue, treating compiling #<CL-SOURCE-FILE "sdl2" "syswm"> as having been successful.
 2: [RETRY] Retry ASDF operation.
 3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
 4: [ABORT] Give up on "sdl2"
 5: [*ABORT] Return to SLIME's top level.
 --more--

Backtrace:
  0: (UIOP/LISP-BUILD:CHECK-LISP-COMPILE-RESULTS NIL T T "~/asdf-action::format-action/" ((#<ASDF/LISP-ACTION:COMPILE-OP > . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "syswm">)))
      Locals:
        CONTEXT-ARGUMENTS = ((#<ASDF/LISP-ACTION:COMPILE-OP > . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "syswm">))
        CONTEXT-FORMAT = "~/asdf-action::format-action/"
        FAILURE-P = T
        OUTPUT = NIL
        WARNINGS-P = T
  1: ((SB-PCL::EMF ASDF/ACTION:PERFORM) #<unavailable argument> #<unavailable argument> #<ASDF/LISP-ACTION:COMPILE-OP > #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "syswm">)
      Locals:
        SB-DEBUG::ARG-2 = #<ASDF/LISP-ACTION:COMPILE-OP >
        SB-DEBUG::ARG-3 = #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "syswm">

Installation instructions won't work for CLISP

Following the installation instructions in the README will end up in this:

[2]> (asdf:load-system :sdl2-examples)
;; Compiling file /home/*****/quicklisp/local-projects/cl-sdl2/examples/basic.lisp ...
*** - LOAD: A file with name SDL2 does not exist
The following restarts are available:
RETRY          :R1      Retry compiling #<CL-SOURCE-FILE "sdl2-examples" "basic">.
ACCEPT         :R2      Continue, treating compiling #<CL-SOURCE-FILE "sdl2-examples" "basic"> as having been successful.
ABORT          :R3      Abort main loop

Move from defpackage to define-package (at least for the ffi packages)

The currently if someone tries to reload cl-sdl2 it will have warnings at defpackage for the ffi packages.
e.g:

; caught WARNING:
;   SDL2-FFI.FUNCTIONS also exports the following symbols:

The reason for this is that cl-autowrap will export many symbols that are not mentioned in the package.

This can be avoided by moving to uiop's define-package.

reproducable on sbcl unsure about on other implementations, however the warnings are correct according the the CL spec

Unhandled exception 11 when doing sdl2:init on Wayland

I have a problem with cl-sdl2 running on Wayland/Weston. Often I get this error (this one from ccl):

Unhandled exception 11 at 0x7f6e19142cd3, context->regs at #x7f6e1a5de048
Exception occurred while executing foreign code
at xkb_context_ref + 3
received signal 11; faulting address: (nil)
address not mapped to object
? for help
[5084] Clozure CL kernel debugger:

sdl2:init sometimes succeeds, and then things work fine, but often (almost half the time I'd say) I get this fault. I need to call sdl2:init only when I do a modechange on a connected monitor, or at startup.

So, if I could restart instead of being stuck at the ccl kernel debugger it would be ok. But I have not found any way to proceed from the kernel debugger.

I tried sbcl, and it gives similar faults (SB-SYS:MEMORY-FAULT-ERROR).

When I run this under X11 on another machine (both are running Arch Linux) everything is fine. No problem there.

Some options I am thinking of:

  1. Do some sanity checks before calling sdl2:init, so it succeds
  2. Somehow recover from the kernel debugger, to try again until it succeeds (since it succeeds over half the time)
  3. Make some kind of external watchdog, killing and starting the whole program when it hits the kernel debugger. I looked at the output of "ps", but could see not change in the state reported in Linux when my program is in the kernel debugger. Any way to find that out from an external program?

Component "swank" not found

I am trying to install cl-sdl2. After i evaluate this line (ql:quickload "sdl2") in a .lisp file i get following errors:

`Component "swank" not found
[Condition of type ASDF/FIND-SYSTEM:MISSING-COMPONENT]

Restarts:
0: [TRY-RECOMPILING] Recompile optional-deps and try loading it again
1: [RETRY] Retry loading FASL for #<CL-SOURCE-FILE "sdl2" "optional-deps">.
2: [ACCEPT] Continue, treating loading FASL for #<CL-SOURCE-FILE "sdl2" "optional-deps"> as having been successful.
3: [RETRY] Retry ASDF operation.
4: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
5: [ABORT] Give up on "sdl2"
--more--

Backtrace:
0: ((:METHOD ASDF/OPERATE:OPERATE (SYMBOL T)) ASDF/LISP-ACTION:LOAD-OP "swank") [fast-method]
1: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) # # ASDF/LISP-ACTION:LOAD-OP "swank")
2: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
3: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:LOAD-OP "swank") [fast-method]
4: (ASDF/OPERATE:LOAD-SYSTEM "swank")
5: (SB-FASL::LOAD-FASL-GROUP #S(SB-FASL::FASL-INPUT :STREAM #<SB-SYS:FD-STREAM for "file /home/amir/.cache/common-lisp/sbcl-1.3.1.debian-linux-x64/home/amir/quicklisp/local-projects/cl-sdl2/src/optional-..
6: (SB-FASL::LOAD-AS-FASL #<SB-SYS:FD-STREAM for "file /home/amir/.cache/common-lisp/sbcl-1.3.1.debian-linux-x64/home/amir/quicklisp/local-projects/cl-sdl2/src/optional-deps.fasl" {1007279983}> NIL NIL)
7: ((FLET SB-FASL::LOAD-STREAM :IN LOAD) #<SB-SYS:FD-STREAM for "file /home/amir/.cache/common-lisp/sbcl-1.3.1.debian-linux-x64/home/amir/quicklisp/local-projects/cl-sdl2/src/optional-deps.fasl" {1007279..
8: (LOAD #P"/home/amir/.cache/common-lisp/sbcl-1.3.1.debian-linux-x64/home/amir/quicklisp/local-projects/cl-sdl2/src/optional-deps.fasl" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DEF..
9: (UIOP/UTILITY:CALL-WITH-MUFFLED-CONDITIONS #<CLOSURE (LAMBDA NIL :IN UIOP/LISP-BUILD:LOAD*) {10072771BB}> ("Overwriting already existing readtable ~S." #(#:FINALIZERS-OFF-WARNING :ASDF-FINALIZERS)))
10: ((SB-PCL::EMF ASDF/ACTION:PERFORM) # # #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL> #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "optional-deps">)
11: ((:METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (ASDF/LISP-ACTION:LOAD-OP ASDF/LISP-ACTION:CL-SOURCE-FILE)) #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL> #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "optional-deps..
12: ((:METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS :AROUND (T T)) #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL> #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "optional-deps">) [fast-method]
13: ((:METHOD ASDF/PLAN:PERFORM-PLAN (LIST)) ((#1=#<ASDF/LISP-ACTION:COMPILE-OP > . #<ASDF/SYSTEM:SYSTEM "alexandria">) (#<ASDF/LISP-ACTION:PREPARE-OP > . #2=#<ASDF/SYSTEM:SYSTEM "uiop">) (#1# . #2#) (#<A..
14: ((FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT))
15: ((:METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)) ((#1=#<ASDF/LISP-ACTION:COMPILE-OP > . #<ASDF/SYSTEM:SYSTEM "alexandria">) (#<ASDF/LISP-ACTION:PREPARE-OP > . #2=#<ASDF/SYSTEM:SYSTEM "uiop">) (#1# . #2#)..
16: ((FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT))
17: ((:METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN {1006976FF3}> :VERBOSE NIL) [fast-method]
18: ((:METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)) #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL> #<ASDF/SYSTEM:SYSTEM "sdl2"> :VERBOSE NIL) [fast-method]
19: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) # # #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL> #<ASDF/SYSTEM:SYSTEM "sdl2"> :VERBOSE NIL)
20: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
21: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL> #<ASDF/SYSTEM:SYSTEM "sdl2"> :VERBOSE NIL) [fast-method]
22: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) # # ASDF/LISP-ACTION:LOAD-OP "sdl2" :VERBOSE NIL)
23: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
24: (ASDF/CACHE:CALL-WITH-ASDF-CACHE #<CLOSURE (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {100696C88B}> :OVERRIDE NIL :KEY NIL)
25: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:LOAD-OP "sdl2" :VERBOSE NIL) [fast-method]
26: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:LOAD-OP "sdl2" :VERBOSE NIL) [fast-method]
27: (ASDF/OPERATE:LOAD-SYSTEM "sdl2" :VERBOSE NIL)
28: (QUICKLISP-CLIENT::CALL-WITH-MACROEXPAND-PROGRESS #<CLOSURE (LAMBDA NIL :IN QUICKLISP-CLIENT::APPLY-LOAD-STRATEGY) {100695BD2B}>)
29: (QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES "sdl2" :PROMPT NIL)
30: ((:METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T)) # #<CLOSURE (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:QUICKLOAD) {100694410B}>) [fast-method]
31: ((:METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION :AROUND (QL-IMPL:SBCL T)) #<QL-IMPL:SBCL {10076B4693}> #<CLOSURE (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:QUICKLOAD) {100694410B}>) [fast-me..
32: ((:METHOD QUICKLISP-CLIENT:QUICKLOAD (T)) # :PROMPT NIL :SILENT NIL :VERBOSE NIL) [fast-method]
33: (QL-DIST::CALL-WITH-CONSISTENT-DISTS #<CLOSURE (LAMBDA NIL :IN QUICKLISP-CLIENT:QUICKLOAD) {10069393FB}>)
34: (SB-INT:SIMPLE-EVAL-IN-LEXENV (QUICKLISP-CLIENT:QUICKLOAD "sdl2") #)
35: (EVAL (QUICKLISP-CLIENT:QUICKLOAD "sdl2"))
36: ((LAMBDA NIL :IN SWANK:INTERACTIVE-EVAL))
37: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME interactive evaluation request." #<CLOSURE (LAMBDA NIL :IN SWANK:INTERACTIVE-EVAL) {1006938B0B}>)
38: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK:INTERACTIVE-EVAL) {1006938AEB}>)
39: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:INTERACTIVE-EVAL "(ql:quickload "sdl2")") #)
40: (EVAL (SWANK:INTERACTIVE-EVAL "(ql:quickload "sdl2")"))
41: (SWANK:EVAL-FOR-EMACS (SWANK:INTERACTIVE-EVAL "(ql:quickload "sdl2")") "COMMON-LISP-USER" 10)
42: ((LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD))
43: (SWANK/SBCL::CALL-WITH-BREAK-HOOK # #<FUNCTION (LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD) {100700589B}>)
44: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/home/amir/.emacs.d/elpa/slime-20160704.1500/swank/sbcl.lisp") # #<FUNCTION (LAMBDA NIL :IN SWANK::SPAWN-WORKER-TH..
45: (SWANK::CALL-WITH-BINDINGS ((STANDARD-INPUT . #1=#<SWANK/GRAY::SLIME-INPUT-STREAM {1004B17133}>) (STANDARD-OUTPUT . #2=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {1004BEFAB3}>) (TRACE-OUTPUT . #2#) (*ERR..
46: ((LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD))
47: ((FLET #:WITHOUT-INTERRUPTS-BODY-1156 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
48: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
49: ((FLET #:WITHOUT-INTERRUPTS-BODY-359 :IN SB-THREAD::CALL-WITH-MUTEX))
50: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {7FFFF2186D5B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THR..
51: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "worker" RUNNING {10069308C3}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD) {100693084B}> (#<SB-THREAD:THREAD "worker" RU..
52: ("foreign function: call_into_lisp")
53: ("foreign function: new_thread_trampoline")`

Why is this happening and how can i fix it?

I have installed cl-sdl2 using quicklisp and git:
`cd $HOME/quicklisp/local-projects

git clone https://github.com/rpav/cl-autowrap.git

git clone https://github.com/lispgames/cl-sdl2.git`

The function COMMON-LISP:NIL is undefined.

The function COMMON-LISP:NIL is undefined.
   [Condition of type UNDEFINED-FUNCTION]

Restarts:
 0: [TRY-RECOMPILING] Recompile sdl2 and try loading it again
 1: [RETRY] Retry loading FASL for #<CL-SOURCE-FILE "sdl2" "sdl2">.
 2: [ACCEPT] Continue, treating loading FASL for #<CL-SOURCE-FILE "sdl2" "sdl2"> as having been successful.
 3: [ABORT] Give up on "cepl"
 4: [RETRY] Retry SLIME REPL evaluation request.
 5: [*ABORT] Return to SLIME's top level.
 6: [ABORT] Abort thread (#<THREAD "repl-thread" RUNNING {1005BAB313}>)

Backtrace:
  0: (SB-KERNEL:%COERCE-CALLABLE-TO-FUN NIL)
      Locals:
        SB-DEBUG::ARG-0 = NIL
  1: (AUTOWRAP:MAKE-WRAPPER-INSTANCE SDL2-FFI:SDL-EVENT)
      Locals:
        #:REST-CONTEXT-280 = 70368541632244
        #:REST-COUNT-281 = 0
        TYPE-NAME = SDL2-FFI:SDL-EVENT
        SB-DEBUG::MORE = NIL
  2: (AUTOWRAP:ALLOC SDL2-FFI:SDL-EVENT 1)
      Locals:
        COUNT = 1
        TYPE = SDL2-FFI:SDL-EVENT
  3: (SB-FASL::FOP-FUNCALL)
      [No Locals]
  4: (SB-FASL::LOAD-FASL-GROUP #<SB-SYS:FD-STREAM for "file /home/francis/.cache/common-lisp/sbcl-1.1.17.9-4e815e8-linux-x64/home/francis/quicklisp/local-projects/cl-sdl2/src/sdl2.fasl" {1007236A93}> NIL)
      Locals:
        SB-DEBUG::ARG-0 = #<SB-SYS:FD-STREAM for "file /home/francis/.cache/common-lisp/sbcl-1.1.17.9-4e815e8-linux-x64/home/francis/quicklisp/local-projects/cl-sdl2/src/sdl2.fasl" {1007236A93}>
        SB-DEBUG::ARG-1 = NIL
      Catch-tags:
        SB-FASL::FASL-GROUP-END
  5: (SB-FASL::LOAD-AS-FASL #<SB-SYS:FD-STREAM for "file /home/francis/.cache/common-lisp/sbcl-1.1.17.9-4e815e8-linux-x64/home/francis/quicklisp/local-projects/cl-sdl2/src/sdl2.fasl" {1007236A93}> NIL NIL)
      Locals:
        SB-DEBUG::ARG-0 = #<SB-SYS:FD-STREAM for "file /home/francis/.cache/common-lisp/sbcl-1.1.17.9-4e815e8-linux-x64/home/francis/quicklisp/local-projects/cl-sdl2/src/sdl2.fasl" {1007236A93}>
        SB-DEBUG::ARG-1 = NIL
        SB-DEBUG::ARG-2 = NIL
  6: ((FLET SB-FASL::LOAD-STREAM :IN LOAD) #<SB-SYS:FD-STREAM for "file /home/francis/.cache/common-lisp/sbcl-1.1.17.9-4e815e8-linux-x64/home/francis/quicklisp/local-projects/cl-sdl2/src/sdl2.fasl" {100723..
      Locals:
        SB-DEBUG::ARG-0 = #<SB-SYS:FD-STREAM for "file /home/francis/.cache/common-lisp/sbcl-1.1.17.9-4e815e8-linux-x64/home/francis/quicklisp/local-projects/cl-sdl2/src/sdl2.fasl" {1007236A93}>
        SB-DEBUG::ARG-1 = T
  7: (LOAD #P"/home/francis/.cache/common-lisp/sbcl-1.1.17.9-4e815e8-linux-x64/home/francis/quicklisp/local-projects/cl-sdl2/src/sdl2.fasl" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DE..
      Locals:
        #:EXTERNAL-FORMAT-DEFAULTING-TEMP = :DEFAULT
        #:IF-DOES-NOT-EXIST-DEFAULTING-TEMP = T
        #:N-SUPPLIED-80 = NIL
        #:N-SUPPLIED-81 = NIL
        SB-FASL::PATHSPEC = #P"/home/francis/.cache/common-lisp/sbcl-1.1.17.9-4e815e8-linux-x64/home/francis/quicklisp/local-projects/cl-sdl2/src/sdl2.fasl"
        #:PRINT-DEFAULTING-TEMP = NIL
        #:VERBOSE-DEFAULTING-TEMP = NIL
  8: (UIOP/UTILITY:CALL-WITH-MUFFLED-CONDITIONS #<CLOSURE (LAMBDA NIL :IN ASDF/LISP-ACTION:PERFORM-LISP-LOAD-FASL) {100723425B}> ("Overwriting already existing readtable ~S." #(#:FINALIZERS-OFF-WARNING :AS..
      Locals:
        SB-DEBUG::ARG-0 = #<CLOSURE (LAMBDA () :IN ASDF/LISP-ACTION:PERFORM-LISP-LOAD-FASL) {100723425B}>
        SB-DEBUG::ARG-1 = ("Overwriting already existing readtable ~S." #(#:FINALIZERS-OFF-WARNING :ASDF-FINALIZERS))
  9: ((SB-PCL::EMF ASDF/ACTION:PERFORM) #<unavailable argument> #<unavailable argument> #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "sdl2">)
      Locals:
        SB-DEBUG::ARG-2 = #<ASDF/LISP-ACTION:LOAD-OP >
        SB-DEBUG::ARG-3 = #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "sdl2">
 10: ((:METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (ASDF/LISP-ACTION:LOAD-OP ASDF/LISP-ACTION:CL-SOURCE-FILE)) #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "sdl2">) [fast-method]
      Locals:
        SB-DEBUG::ARG-1 = #S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<FUNCTION (SB-PCL::FAST-METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (T T))> :PV NIL :NEXT-METHOD-CALL NIL :ARG-INFO (2))
        SB-DEBUG::ARG-2 = #<ASDF/LISP-ACTION:LOAD-OP >
        SB-DEBUG::ARG-3 = #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "sdl2">
 11: ((:METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS :AROUND (T T)) #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "sdl2">) [fast-method]
      Locals:
        SB-DEBUG::ARG-1 = #S(SB-PCL::FAST-METHOD-CALL ..)
        SB-DEBUG::ARG-2 = #<ASDF/LISP-ACTION:LOAD-OP >
        SB-DEBUG::ARG-3 = #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2" "sdl2">
 12: ((:METHOD ASDF/PLAN:PERFORM-PLAN (LIST)) ((#1=#<ASDF/LISP-ACTION:PREPARE-OP > . #<ASDF/SYSTEM:SYSTEM #2="cl-opengl">) (#1# . #<ASDF/COMPONENT:MODULE #2# #3="gl">) (#1# . #4=#<ASDF/LISP-ACTION:CL-SOURC..
      Locals:
        #:FORCE-DEFAULTING-TEMP = NIL
        ASDF/PLAN::STEPS = ((#<ASDF/LISP-ACTION:PREPARE-OP > . #<ASDF/SYSTEM:SYSTEM "cl-opengl">) (#<ASDF/LISP-ACTION:PREPARE-OP > . #<ASDF/COMPONENT:MODULE "cl-opengl" "gl">) ..)
 13: ((FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT))
      [No Locals]
 14: ((:METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)) ((#1=#<ASDF/LISP-ACTION:PREPARE-OP > . #<ASDF/SYSTEM:SYSTEM #2="cl-opengl">) (#1# . #<ASDF/COMPONENT:MODULE #2# #3="gl">) (#1# . #4=#<ASDF/LISP-ACTION:CL-..
      Locals:
        SB-PCL::.NEXT-METHOD-CALL. = #S(SB-PCL::FAST-METHOD-CALL ..)
        SB-PCL::.REST-ARG. = (:VERBOSE NIL)
        ASDF/PLAN::PLAN = ((#<ASDF/LISP-ACTION:PREPARE-OP > . #<ASDF/SYSTEM:SYSTEM "cl-opengl">) (#<ASDF/LISP-ACTION:PREPARE-OP > . #<ASDF/COMPONENT:MODULE "cl-opengl" "gl">) ..)
 15: ((FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT))
      [No Locals]
 16: ((:METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN {100EE19163}> :VERBOSE NIL) [fast-method]
      Locals:
        SB-PCL::.NEXT-METHOD-CALL. = #S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<FUNCTION (SB-PCL::FAST-METHOD ASDF/PLAN:PERFORM-PLAN (T))> :PV NIL :NEXT-METHOD-CALL NIL :ARG-INFO (1 . T))
        SB-PCL::.REST-ARG. = (:VERBOSE NIL)
        ASDF/PLAN::PLAN = #<ASDF/PLAN:SEQUENTIAL-PLAN {100EE19163}>
 17: ((:METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)) #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL> #<ASDF/SYSTEM:SYSTEM "cepl"> :VERBOSE NIL) [fast-method]
      Locals:
        ASDF/COMPONENT:COMPONENT = #<ASDF/SYSTEM:SYSTEM "cepl">
        ASDF/OPERATION:OPERATION = #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL>
        #:PLAN-CLASS-DEFAULTING-TEMP = NIL
        #:REST-CONTEXT-13103 = 70368541633452
        #:REST-COUNT-13104 = 2
        SB-DEBUG::MORE = (:VERBOSE NIL)
 18: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) #<unused argument> #<unused argument> #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL> #<ASDF/SYSTEM:SYSTEM "cepl"> :VERBOSE NIL)
      Locals:
        SB-PCL::.ARG0. = #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL>
        SB-PCL::.ARG1. = #<ASDF/SYSTEM:SYSTEM "cepl">
        SB-PCL::.DFUN-MORE-CONTEXT. = 70368541633492
        SB-PCL::.DFUN-MORE-COUNT. = 2
        SB-DEBUG::MORE = (:VERBOSE NIL)
 19: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
      [No Locals]
 20: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL> #<ASDF/SYSTEM:SYSTEM "cepl"> :VERBOSE NIL) [fast-method]
      Locals:
        SB-PCL::.NEXT-METHOD-CALL. = #S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<CLOSURE (SB-PCL::EMF ASDF/OPERATE:OPERATE) {100570172B}> :PV NIL :NEXT-METHOD-CALL NIL :ARG-INFO (2 . T))
        SB-PCL::.REST-ARG. = (:VERBOSE NIL)
        ASDF/COMPONENT:COMPONENT = #<ASDF/SYSTEM:SYSTEM "cepl">
        ASDF/OPERATION:OPERATION = #<ASDF/LISP-ACTION:LOAD-OP :VERBOSE NIL>
 21: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) #<unused argument> #<unused argument> ASDF/LISP-ACTION:LOAD-OP "cepl" :VERBOSE NIL)
      Locals:
        SB-PCL::.ARG0. = ASDF/LISP-ACTION:LOAD-OP
        SB-PCL::.ARG1. = "cepl"
        SB-PCL::.DFUN-MORE-CONTEXT. = 70368541633648
        SB-PCL::.DFUN-MORE-COUNT. = 2
        SB-DEBUG::MORE = (:VERBOSE NIL)
 22: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
      [No Locals]
 23: (ASDF/CACHE:CALL-WITH-ASDF-CACHE #<CLOSURE (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {100EE10AEB}> :OVERRIDE NIL)
      Locals:
        #:OVERRIDE-DEFAULTING-TEMP = NIL
        THUNK = #<CLOSURE (LAMBDA () :IN ASDF/OPERATE:OPERATE) {100EE10AEB}>
 24: (ASDF/FIND-SYSTEM::CALL-WITH-SYSTEM-DEFINITIONS #<CLOSURE (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {100EE10AEB}>)
      Locals:
        SB-DEBUG::ARG-0 = #<CLOSURE (LAMBDA () :IN ASDF/OPERATE:OPERATE) {100EE10AEB}>
 25: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:LOAD-OP "cepl" :VERBOSE NIL) [fast-method]
      Locals:
        SB-PCL::.NEXT-METHOD-CALL. = #S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<CLOSURE (SB-PCL::EMF ASDF/OPERATE:OPERATE) {10057016DB}> :PV NIL :NEXT-METHOD-CALL NIL :ARG-INFO (2 . T))
        SB-PCL::.REST-ARG. = (:VERBOSE NIL)
        ASDF/COMPONENT:COMPONENT = "cepl"
        ASDF/OPERATION:OPERATION = ASDF/LISP-ACTION:LOAD-OP
 26: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:LOAD-OP "cepl" :VERBOSE NIL) [fast-method]
      Locals:
        SB-PCL::.NEXT-METHOD-CALL. = #S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<CLOSURE (SB-PCL::EMF ASDF/OPERATE:OPERATE) {10057016DB}> :PV NIL :NEXT-METHOD-CALL NIL :ARG-INFO (2 . T))
        SB-PCL::.REST-ARG. = (:VERBOSE NIL)
        ASDF/COMPONENT:COMPONENT = "cepl"
        ASDF/OPERATION:OPERATION = ASDF/LISP-ACTION:LOAD-OP
 27: (QUICKLISP-CLIENT::CALL-WITH-MACROEXPAND-PROGRESS #<CLOSURE (LAMBDA NIL :IN QUICKLISP-CLIENT::APPLY-LOAD-STRATEGY) {100ED6A05B}>)
      Locals:
        SB-DEBUG::ARG-0 = #<CLOSURE (LAMBDA () :IN QUICKLISP-CLIENT::APPLY-LOAD-STRATEGY) {100ED6A05B}>
 28: (QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES "cepl" :PROMPT NIL)
      Locals:
        NAME = "cepl"
        #:PROMPT-DEFAULTING-TEMP = NIL
 29: ((:METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T)) #<unavailable argument> #<CLOSURE (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:QUICKLOAD) {100EA3E65B}>) [fast-method]
      Locals:
        SB-DEBUG::ARG-3 = #<CLOSURE (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:QUICKLOAD) {100EA3E65B}>
 30: ((:METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION :AROUND (QL-IMPL:SBCL T)) #<QL-IMPL:SBCL {1000C3A7F3}> #<CLOSURE (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:QUICKLOAD) {100EA3E65B}>) [fast-me..
      Locals:
        SB-DEBUG::ARG-1 = #S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<FUNCTION (SB-PCL::FAST-METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T))> :PV NIL :NEXT-METHOD-CALL NIL :ARG-INFO (2))
        SB-DEBUG::ARG-2 = #<QL-IMPL:SBCL {1000C3A7F3}>
        SB-DEBUG::ARG-3 = #<CLOSURE (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:QUICKLOAD) {100EA3E65B}>
 31: ((:METHOD QUICKLISP-CLIENT:QUICKLOAD (T)) #<unavailable argument> :PROMPT NIL :VERBOSE NIL) [fast-method]
      Locals:
        #:N-SUPPLIED-10 = NIL
        #:N-SUPPLIED-9 = NIL
        #:PROMPT-DEFAULTING-TEMP = NIL
        #:VERBOSE-DEFAULTING-TEMP = NIL
 32: (QL-DIST::CALL-WITH-CONSISTENT-DISTS #<CLOSURE (LAMBDA NIL :IN QUICKLISP-CLIENT:QUICKLOAD) {100EA2A78B}>)
      Locals:
        SB-DEBUG::ARG-0 = #<CLOSURE (LAMBDA () :IN QUICKLISP-CLIENT:QUICKLOAD) {100EA2A78B}>
 33: (SB-INT:SIMPLE-EVAL-IN-LEXENV (QUICKLISP-CLIENT:QUICKLOAD (QUOTE CEPL)) #<NULL-LEXENV>)
      Locals:
        SB-DEBUG::ARG-0 = (QUICKLISP-CLIENT:QUICKLOAD 'CEPL)
        SB-DEBUG::ARG-1 = #<NULL-LEXENV>
 34: (EVAL (QUICKLISP-CLIENT:QUICKLOAD (QUOTE CEPL)))
      Locals:
        SB-DEBUG::ARG-0 = (QUICKLISP-CLIENT:QUICKLOAD 'CEPL)
 35: (SWANK::EVAL-REGION "(ql:quickload 'cepl) ..)
      Locals:
        SB-DEBUG::ARG-0 = "(ql:quickload 'cepl)\n"
 36: ((LAMBDA NIL :IN SWANK::REPL-EVAL))
      [No Locals]
 37: (SWANK::TRACK-PACKAGE #<CLOSURE (LAMBDA NIL :IN SWANK::REPL-EVAL) {100EA2A32B}>)
      Locals:
        SB-DEBUG::ARG-0 = #<CLOSURE (LAMBDA () :IN SWANK::REPL-EVAL) {100EA2A32B}>
 38: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME REPL evaluation request." #<CLOSURE (LAMBDA NIL :IN SWANK::REPL-EVAL) {100EA2A26B}>)
      Locals:
        SB-DEBUG::ARG-0 = "Retry SLIME REPL evaluation request."
        SB-DEBUG::ARG-1 = #<CLOSURE (LAMBDA () :IN SWANK::REPL-EVAL) {100EA2A26B}>
 39: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK::REPL-EVAL) {100EA2A24B}>)
      Locals:
        SB-DEBUG::ARG-0 = NIL
        SB-DEBUG::ARG-1 = #<CLOSURE (LAMBDA () :IN SWANK::REPL-EVAL) {100EA2A24B}>
 40: (SWANK::REPL-EVAL "(ql:quickload 'cepl) ..)
      Locals:
        SB-DEBUG::ARG-0 = "(ql:quickload 'cepl)\n"
 41: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:LISTENER-EVAL "(ql:quickload 'cepl) ..)
      Locals:
        SB-DEBUG::ARG-0 = (SWANK:LISTENER-EVAL "(ql:quickload 'cepl)\n")
        SB-DEBUG::ARG-1 = #<NULL-LEXENV>
 42: (EVAL (SWANK:LISTENER-EVAL "(ql:quickload 'cepl) ..)
      Locals:
        SB-DEBUG::ARG-0 = (SWANK:LISTENER-EVAL "(ql:quickload 'cepl)\n")
 43: (SWANK:EVAL-FOR-EMACS (SWANK:LISTENER-EVAL "(ql:quickload 'cepl) ..)
      Locals:
        SB-DEBUG::ARG-0 = (SWANK:LISTENER-EVAL "(ql:quickload 'cepl)\n")
        SB-DEBUG::ARG-1 = "COMMON-LISP-USER"
        SB-DEBUG::ARG-2 = 101
 44: (SWANK::PROCESS-REQUESTS NIL)
 45: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
      [No Locals]
 46: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
      [No Locals]
 47: (SWANK-BACKEND::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {1005BB00FB}>)
      Locals:
        CONTINUATION = #<CLOSURE (LAMBDA () :IN SWANK::HANDLE-REQUESTS) {1005BB00FB}>
        HOOK = #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK>
 48: ((FLET SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/home/francis/quicklisp/dists/quicklisp/software/slime-2.5/swank-sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HA..
      Locals:
        SWANK-BACKEND::FUN = #<CLOSURE (LAMBDA () :IN SWANK::HANDLE-REQUESTS) {1005BB00FB}>
        SWANK-BACKEND::HOOK = #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK>
 49: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* . #1=#<SWANK-BACKEND::SLIME-OUTPUT-STREAM {1005B8B593}>) (*STANDARD-INPUT* . #2=#<SWANK-BACKEND::SLIME-INPUT-STREAM {1005858003}>) (*TRACE-OUTPUT* . #1#)..
 50: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {1007250E23}> NIL)
      Locals:
        CONNECTION = #<SWANK::MULTITHREADED-CONNECTION {1007250E23}>
        TIMEOUT = NIL
 51: ((FLET #:WITHOUT-INTERRUPTS-BODY-1226 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
      [No Locals]
      Catch-tags:
        SB-THREAD::%RETURN-FROM-THREAD
 52: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
      [No Locals]
      Catch-tags:
        SB-THREAD::%ABORT-THREAD
        SB-IMPL::%END-OF-THE-WORLD
        SB-INT:TOPLEVEL-CATCHER
 53: ((FLET #:WITHOUT-INTERRUPTS-BODY-660 :IN SB-THREAD::CALL-WITH-MUTEX))
      [No Locals]
 54: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {7FFFE7DAEBAB}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THR..
      Locals:
        SB-DEBUG::ARG-0 = #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {7FFFE7DAEBAB}>
        SB-DEBUG::ARG-1 = #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "repl-thread" RUNNING {1005BAB313}>>
        SB-DEBUG::ARG-2 = NIL
        SB-DEBUG::ARG-3 = T
        SB-DEBUG::ARG-4 = NIL
 55: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "repl-thread" RUNNING {1005BAB313}> #S(SB-THREAD:SEMAPHORE :NAME "Thread setup semaphore" :%COUNT 0 :WAITCOUNT 0 :MUTEX #<SB-THREAD:MU..
      Locals:
        SB-DEBUG::ARG-0 = #<SB-THREAD:THREAD "repl-thread" RUNNING {1005BAB313}>
        SB-DEBUG::ARG-1 = #S(SB-THREAD:SEMAPHORE :NAME "Thread setup semaphore" :%COUNT 0 :WAITCOUNT 0 :MUTEX #<SB-THREAD:MUTEX (free) {1005BAB383}> :QUEUE #<SB-THREAD:WAITQUEUE  {1005BAB3B3}>)
        SB-DEBUG::ARG-2 = #<CLOSURE (LAMBDA () :IN SWANK::SPAWN-REPL-THREAD) {1005BAB29B}>
        SB-DEBUG::ARG-3 = NIL
        SB-DEBUG::ARG-4 = NIL
        SB-DEBUG::ARG-5 = NIL
        SB-DEBUG::ARG-6 = NIL
 56: ("foreign function: call_into_lisp")
      [No Locals]
 57: ("foreign function: new_thread_trampoline")
      [No Locals]

The error occurs here, and after machine restarts. Possibly after the lisp proc restarts.

You can get around this by slime-compile-defun'ing the autowrap:c-include here

Also, since this requires a specifc version of SDL2, one could include a direct link to the version to be downloaded in the README. link here

Machine & Lisp information (using SDL2-2.0.0):

{:os-info "Distributor ID:  Ubuntu
           Description: Ubuntu 13.10
           Release: 13.10
           Codename:    saucy"
:machine-type "X86-64"
:machine-version "Intel(R) Celeron(R) CPU B800 @ 1.50GHz"
:software-type "Linux"
:software-version "3.11.0-12-generic"
:lisp-implementation-type "SBCL"
:lisp-implementation-version "1.1.17.9-4e815e8"}

sdl2:render-copy-ex not implemented

I tried to write it and I'm getting some data type issues. I'm not too good with autowrap and so forth. I need to rotate a bitmap I'm loading.

Render-copy-ex is the same as render-copy except it takes three more arguments: an angle (double), a point to rotate around, and options to flip the image. I was hoping someone had some thoughts on this. Thanks.

:int instead of :int16 for joyaxisevent

This is the definition of the joy axis event. This matches sdl2.h

(AUTOWRAP:DEFINE-FOREIGN-RECORD
    'SDL-JOY-AXIS-EVENT :STRUCT 160 32
    '((:TYPE UINT32 :BIT-SIZE 32 :BIT-OFFSET 0
       :BIT-ALIGNMENT 32)
      (:TIMESTAMP UINT32 :BIT-SIZE 32
       :BIT-OFFSET 32 :BIT-ALIGNMENT 32)
      (:WHICH SDL-JOYSTICK-ID :BIT-SIZE 32
       :BIT-OFFSET 64 :BIT-ALIGNMENT 32)
      (:AXIS UINT8 :BIT-SIZE 8 :BIT-OFFSET 96
       :BIT-ALIGNMENT 8)
      (:PADDING1 UINT8 :BIT-SIZE 8 :BIT-OFFSET
       104 :BIT-ALIGNMENT 8)
      (:PADDING2 UINT8 :BIT-SIZE 8 :BIT-OFFSET
       112 :BIT-ALIGNMENT 8)
      (:PADDING3 UINT8 :BIT-SIZE 8 :BIT-OFFSET
       120 :BIT-ALIGNMENT 8)
      (:VALUE SINT16 :BIT-SIZE 16 :BIT-OFFSET
       128 :BIT-ALIGNMENT 16)
      (:PADDING4 UINT16 :BIT-SIZE 16
       :BIT-OFFSET 144 :BIT-ALIGNMENT 16)))

(PLUS-C:C-REF EVENT SDL2-FFI:SDL-EVENT :JAXIS :VALUE)

expands to

(LET ((#:WRAPPER1550 EVENT))
  (CFFI-SYS:%MEM-REF (CFFI-SYS:INC-POINTER (AUTOWRAP:PTR #:WRAPPER1550) 16)
                     :INT))

We see we have :int instead of :int16 and we get wildly out of range values from the axis

Strange mouse issue on OSX

I'm not sure if this is a bug or not, but I received an issue reported in my project: axionix/tradewarz#1

The issue is when clicking, the cursor jumps to center, and also is not hidden.

I believe this is due to sdl2:set-relative-mouse-mode, but I cannot reproduce on Linux. On Linux, the cursor doesn't jump around, and relative mode hides the cursor anyway.

Can you possibly shed some light on this to understand what is happening differently on OSX/Linux? I do not have access to OSX to attempt fixing this.

(sdl2-examples:basic-test) crashes with 'NSInternalInconsistencyException'

My system:

  • macOS Sierra 10.12.15
  • cl-sdl2 version: cl-sdl2-20170516-git
  • SDL2 version 2.0.5
  • sbcl 1.3.17

When I run

(ql:quickload :sdl2)
(asdf:load-system :sdl2/examples)
(sdl2-examples:basic-test)

I get this nasty error:

Using SDL Library Version: 2.0.4
Setting up window/gl.
Opening game controllers.
Beginning main loop.
2017-06-09 20:56:28.827 sbcl[1504:99014] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fffb8bc957b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffcde0d1da objc_exception_throw + 48
	2   AppKit                              0x00007fffb6db5e82 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4480
	3   SDL2                                0x0000000000452a5a SDL2 + 244314
	4   SDL2                                0x000000000043e39d SDL2 + 160669
	5   ???                                 0x0000000022b8f0ee 0x0 + 582545646
	6   ???                                 0x0000000022bd9b89 0x0 + 582851465
	7   ???                                 0x0000000022bd9606 0x0 + 582850054
	8   ???                                 0x0000000022bb07c6 0x0 + 582682566
	9   ???                                 0x0000000022bb11a9 0x0 + 582685097
	10  ???                                 0x00000000229c2640 0x0 + 580658752
)
libc++abi.dylib: terminating with uncaught exception of type NSException
fatal error encountered in SBCL pid 1504(tid 0xb0000000):
SIGABRT received.

Unable to load sld2

On master branch of this repo I have tried to run the following

(ql:quickload :sdl2)

I get the following error:

; caught ERROR:
;   during macroexpansion of
;   (C-LET (#)
;     (IF #
;         :LISP-MESSAGE
;         ...)).
;   Use *BREAK-ON-SIGNALS* to intercept.
;   
;    error while parsing arguments to DESTRUCTURING-BIND:
;      unknown keyword: :FROM; expected one of :PTR, :FREE, :COUNT 

This makes sense as c-let is being used as follows in the /src/events.lisp file:

(defun get-event-type (event)
  (c-let ((event sdl2-ffi:sdl-event :from event))
    (if (eq (event :type) *lisp-message-event*)
        :lisp-message
        (or (enum-key 'sdl2-ffi:sdl-event-type (event :type))
            (event :type)))))

This doesnt jive with c-lets definition as make-bindings has the following destructuring-bind:

(destructuring-bind (v c-type &key (count 1) (free free-default) ptr) ...

Any advice on this one folks? :)

rect & surface API

Hello,

I request to work on implementing the rect and surface API for sdl2. I may need some help now and then. I have basic experience in writing wrappers with CFFI but haven't used cl-autowrap.

But, from other source in sdl2 as examples, it doesn't look too hard to do. :)

Is this acceptable, and if so, is there anything I should keep in mind when doing the wrapping of that portion of the API?

Thank you.

-pete

Missing OS UI & no events - sbcl & osx again :)

Hi folks, I pulled the latest and got the (basic-example) working on osx with sbcl so great work!

The rendering is definitely working as I can set the color of the triangle to (sin *loop*) and incf *loop* and the colors change smoothly. However I get no events and (Im guessing this is related) no system ui.

By system ui I mean minimize/close buttons etc.
I tested `(make-instance 'simple-window) in sdlkit as well and got the same result. Not sure what to check next. Any ideas?

c-ref invalid expansion for sdl event

(c-ref event sdl2-ffi:sdl-event :edit :text)

expands to

(LET ((#:WRAPPER2167 EVENT))
  (CFFI-SYS:%MEM-REF
   (CFFI-SYS:INC-POINTER (CFFI-SYS:INC-POINTER (AUTOWRAP:PTR #:WRAPPER2167) 12)
                         NIL)
   :CHAR))

inc-pointer is given an index of nil, which is invalid.

DIVISION-BY-ZERO Signalled by (sdl2:with-init (:everything) ...)

I keep running into an arithmetic error DIVISION-BY-ZERO signalled every time I try to run one of the examples, and when evaluating individual pieces, I found that sdl2:with-init seemed to be causing it, though I'm not sure why.

I'm running this on Arch using SBCL, and I tried downloading the packages multiple times through quicklisp just in case something went wrong.

I've tried searching elsewhere, but I can't seem to find anyone else who has mentioned this issue, so I'm thinking I've goofed something up along the way. Any info or guidance you could provide would be greatly appreciated.

Please let me know if there's any more information I can provide that would help!

I'm using sdl2 2.0.4-2, sbcl 1.3.1-1, and the version of cl-sdl2 presently found on quicklisp (cl-sdl2-20160318-git).

SDL main thread and current package

I am wondering if the issues with threads/specials can be side-stepped for the case of IN-MAIN-THREAD, and if it is at all possible for it to manually control the value of PACKAGE. It would be really nice if:

(in-package :test-package)
(sdl2:in-main-thread () *package*)

could somehow return:

#<PACKAGE "TEST-PACKAGE">

instead of:

#<PACKAGE "COMMON-LISP-USER">

Featue Request: Move sdl2-ffi to it's own system/repo

In the name of avoiding duplication of work I would like to propose we move more of the raw bindings from lispgames projects into their own systems & repositories.

These libraries should contain only the autowrap/swig bindings and optionally the most minimal extras required for usage.

I feel this could help the community as it empowers those who dream up new and interesting ways of interacting with systems (as in clinch, cl-sdl2) whilst also allowing pooling resources on the part that would be near identical for all of us.

I hope this finds you all well

windows delivery problems

I am trying to make the basic-test example a stand alone executable on Windows. In the REPL I can quickload cl-opengl and cl-sdl2 which run basic-test's blue window with a red triangle no problem.

However; using Clozure CL v1.9 (save-application "test.exe" :toplevel-function #'test::basic-test :prepend-kernel t) produces and executable which does not run with the following error message:

Error: The value #<A Dead Mac Pointer> is not of the expected type MACPTR.
While executing: SDL2:INIT, in process toplevel(2).
Type :POP to abort, :R for a list of available restarts.
Type :? for other options.

SBCL 1.2.1 gives the following error when I try to produce a windows deliverable:

debugger invoked on a SIMPLE-ERROR in thread
#<THREAD "main thread" RUNNING {254E2431}>:
  EXCEPTION_ACCESS_VIOLATION

Preferred SDL2 library method for installation on OSX

I have tried to install SDL2 via homebrew and also downloaded the dmg for SDL2 from the webpage and installed it in /Library/Frameworks/ but I get issues.

I'm using ccl 1.11-r16635 with quicklisp installed. I'm getting this,

? (ql:quickload "sdl2")
To load "sdl2":
  Load 1 ASDF system:
    sdl2
; Loading "sdl2"
> Error: Unable to load any of the alternatives:
>           ((:FRAMEWORK "SDL2") (:DEFAULT "libSDL2"))
> While executing: CFFI::FL-ERROR, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 >

sdl2-examples:basic-test kills slime-repl on macOS

I'm running CCL:

> (sdl2-examples:basic-test)

The example runs and displays properly. I'm able to close the window with ESC. But then the slime repl stops responding. Inferior lisp is still running, though, and I'm able to rerun the example from there.

I also tried something I saw in a different issue:

> (sdl:make-this-thread-main #'sdl2-examples:basic-test)

But now I'm no longer able to close the window. Inferior lisp has the following warning:

WARNING: nextEventMatchingMask should only be called from the Main Thread! This will throw an exception in the future.

Basic-Example not working on OSX 64bit 10.8.5 with SBCL

Compiling cl-sdl2 works fine. However the example doesn't. I thought maybe it is due to cl-opengl, but their gears test program works fine. I checked with an Linux VM installation and the basic-example works fine there too. So it has something to do with OSX I think. Also I tried using CCL and other SBCL versions.

Backtrace:
The function COMMON-LISP:NIL is undefined.
[Condition of type UNDEFINED-FUNCTION]

Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] Abort thread (#<THREAD "repl-thread" RUNNING {1005110023}>)

Backtrace:
0: (SB-KERNEL:%COERCE-CALLABLE-TO-FUN NIL)
1: (CL-OPENGL-BINDINGS::GL-GET-PROC-ADDRESS "glViewport")
2: (CL-OPENGL-BINDINGS::GENERATE-GL-FUNCTION "glViewport" CL-OPENGL-BINDINGS:VIEWPORT :VOID ((CL-OPENGL-BINDINGS::X CL-OPENGL-BINDINGS:INT) (CL-OPENGL-BINDINGS::Y CL-OPENGL-BINDINGS:INT) (CL-OPENGL-BINDI..
3: (SDL2-EXAMPLES:BASIC-TEST)
4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SDL2-EXAMPLES:BASIC-TEST) #)
5: (EVAL (SDL2-EXAMPLES:BASIC-TEST))
6: (SWANK::EVAL-REGION "(sdl2-examples:BASIC-TEST) ..)
Locals:
SB-DEBUG::ARG-0 = "(sdl2-examples:BASIC-TEST)\n"
7: ((LAMBDA NIL :IN SWANK::REPL-EVAL))
8: (SWANK::TRACK-PACKAGE #<CLOSURE (LAMBDA NIL :IN SWANK::REPL-EVAL) {10038E869B}>)
9: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME REPL evaluation request." #<CLOSURE (LAMBDA NIL :IN SWANK::REPL-EVAL) {10038E85BB}>)
10: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK::REPL-EVAL) {10038E858B}>)
11: (SWANK::REPL-EVAL "(sdl2-examples:BASIC-TEST) ..)
12: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:LISTENER-EVAL "(sdl2-examples:BASIC-TEST) ..)
13: (EVAL (SWANK:LISTENER-EVAL "(sdl2-examples:BASIC-TEST) ..)
14: (SWANK:EVAL-FOR-EMACS (SWANK:LISTENER-EVAL "(sdl2-examples:BASIC-TEST) ..)
15: (SWANK::PROCESS-REQUESTS NIL)
16: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
17: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
18: (SWANK-BACKEND::CALL-WITH-BREAK-HOOK # #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {100511811B}>)
19: ((FLET SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/Users/paines/Documents/emacs/slime/swank-sbcl.lisp") # #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {1005118..
20: (SWANK::CALL-WITH-BINDINGS ((STANDARD-OUTPUT . #1=#<SWANK-BACKEND::SLIME-OUTPUT-STREAM {10050E49D3}>) (STANDARD-INPUT . #2=#<SWANK-BACKEND::SLIME-INPUT-STREAM {10037E0283}>) (TRACE-OUTPUT . #1#)..
21: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {1004423243}> NIL)
22: ((FLET #:WITHOUT-INTERRUPTS-BODY-989 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
23: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
24: ((FLET #:WITHOUT-INTERRUPTS-BODY-434 :IN SB-THREAD::CALL-WITH-MUTEX))
25: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {8A6DC6B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "..
26: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "repl-thread" RUNNING {1005110023}> #S(SB-THREAD:SEMAPHORE :NAME "Thread setup semaphore" :%COUNT 0 :WAITCOUNT 0 :MUTEX #<SB-THREAD:MU..
27: ("foreign function: call_into_lisp")
28: ("foreign function: new_thread_trampoline")
29: ("foreign function: _pthread_start")
30: ("foreign function: thread_start")

No output to *standard-output* showing from sdl2 thread from sdl2:with-init

Hey.

As I said in the topic, I can't output text to console when I'm in sdl2 thread. Take a look at the example:

(multiple-value-bind (major minor patch) (sdl2:version-wrapped)
       (format *standard-output* "Using SDL Library Version: ~D.~D.~D~%"
           major
           minor
           patch))

This correctly outputs version. However, if I run basic-test or this code:

(sdl2:with-init (:everything)
       (multiple-value-bind (major minor patch) (sdl2:version-wrapped)
         (format *standard-output* "Using SDL Library Version: ~D.~D.~D~%"
             major
             minor
             patch)
         (print "Hello, world!")
         (print "dada")))

Nothing is showing at all. I found a way to display to console, with this hack-thing:

(sdl2:make-this-thread-main (lambda ()
                       (sdl2:with-init (:everything)
                         (multiple-value-bind (major minor patch) (sdl2:version-wrapped)
                             (format *standard-output* "Using SDL Library Version: ~D.~D.~D~%"
                               major
                               minor
                               patch)))))

Then it prints output correctly. It's unsure for me why it is so, but that's not feature, I believe.

sdl2:gl-get-swap-interval has an invalid return value check

Currently, sdl2:gl-get-swap-interval throws up if the underlying function returns -1, due to use of check-rc macro. -1 is a legitimate return value for this function, and it happens to be what's returned on one of the platforms I'm developing on.

I currently use the following hotfix in my projects:

(defmacro check-not-below (form lower-limit)
  (with-gensyms (rc)
    `(let ((,rc ,form))
       (when (< ,rc ,lower-limit)
         (error 'sdl2::sdl-rc-error :rc ,rc :string (sdl2-ffi.functions:sdl-get-error)))
       ,rc)))

;; SDL_GL_GetSwapInterval() can return -1 as a valid value; currently, CL-SDL restricts
;; the return value to >= 0, which is incorrect.
(defun sdl2:gl-get-swap-interval ()
  (check-not-below (sdl2-ffi.functions:sdl-gl-get-swap-interval) -1))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.