failproofshark / cl-sdl2-ttf Goto Github PK
View Code? Open in Web Editor NEWA common lisp wrapper for SDL2_TTF used for loading fonts and creating text assets
A common lisp wrapper for SDL2_TTF used for loading fonts and creating text assets
The following code is the minimum recreateable example I could come up with from my bigger project. It's supposed to display the name of the keys the user types in, spaced out appropriately. Instead, after one or two keys it starts to display erratic characters overlapping each other.
Compiled with trivial-dump-core
With SBCL 2.0.1.debian
On Linux Mint 20.3
(require 'sdl2)
(require 'sdl2-ttf)
(defparameter *screen-width* 640)
(defparameter *screen-height* 480)
(defparameter *current-x* 0)
(defun get-text-size (font text)
(list :w (first (multiple-value-list (sdl2-ttf:size-text font text)))
:h (second (multiple-value-list (sdl2-ttf:size-text font text)))))
(defun create-text-surface (renderer font text)
(let* ((sdl-surface (sdl2-ttf:render-text-blended
font
text
#xff
#xff
#xff
#xff))
(sdl-texture (sdl2:create-texture-from-surface renderer sdl-surface))
(final-texture (sdl2:create-texture renderer
:argb8888
:target
(getf (get-text-size font text) :w)
(getf (get-text-size font text) :h))))
(sdl2:set-texture-blend-mode sdl-texture :blend)
(sdl2:set-texture-blend-mode final-texture :blend)
(sdl2:set-render-target renderer final-texture)
(sdl2:render-copy renderer sdl-texture)
(sdl2:set-render-target renderer nil)
(sdl2:free-surface sdl-surface)
(sdl2:destroy-texture sdl-texture)
final-texture))
(defun display-text (texture renderer font text)
(let ((text-texture (create-text-surface renderer font text))
(dest-rect (sdl2:make-rect *current-x*
0
(getf (get-text-size font text) :w)
(getf (get-text-size font text) :h))))
(sdl2:render-copy renderer texture :dest-rect dest-rect)
(incf *current-x* (sdl2:rect-width dest-rect))
(sdl2:set-render-target renderer texture)
(sdl2:render-copy renderer text-texture :dest-rect dest-rect)
(sdl2:set-render-target renderer nil)
(sdl2:destroy-texture text-texture)))
(defun run()
(sdl2-ttf:init)
(sdl2:with-init (:everything)
(sdl2:with-window (window :title "SDL2 Tutorial 01"
:w *screen-width*
:h *screen-height*
:flags '(:shown))
(sdl2:with-renderer (renderer
window
:index -1
:flags '(:accelerated))
(sdl2:set-render-draw-blend-mode renderer :blend)
(sdl2:set-render-draw-color renderer #x22 #x22 #x22 #xff)
(let ((key nil)
(font (sdl2-ttf:open-font "fonts/LiberationMono-Regular.ttf" 13))
(main-texture (sdl2:create-texture renderer
:argb8888
:target
640
480)))
(sdl2:set-texture-blend-mode main-texture :blend)
(sdl2:with-event-loop (:method :poll)
(:quit () t)
(:keydown (:keysym keysym)
(setf key (string-downcase (sdl2:get-key-name (sdl2:get-key-from-scancode (sdl2:scancode keysym)))))
(display-text main-texture renderer font key))
(:idle ()
(sdl2:render-clear renderer)
(sdl2:render-copy renderer main-texture)
(sdl2:render-present renderer)))
(sdl2:destroy-texture main-texture)
(sdl2-ttf:close-font font)))))
(sdl2-ttf:quit))
A few things I've discovered:
The same executable works fine on my laptop running Manjaro.
The bug doesn't happen when I comment out the call to sdl2:set-render-draw-color
in run
.
The bug also doesn't happen when I comment out the calls to sdl2:free-surface
and sdl2:destroy-texture
in create-text-surface
.
The bug doesn't happen when I change from an accelerated renderer to a software renderer.
I'm new to submitting github issues, so I apologize if I've gotten etiquette wrong.
The Shaded functions seem to be specified same as Blended and Solid, with a single color argument. According to documentation, Shaded functions have an additional color for the background, like this:
SDL_Surface *TTF_RenderText_Shaded(TTF_Font *font, const char *text, SDL_Color fg, SDL_Color bg)
Line 24 in ff2821a
Specifically I get this warning:
; caught WARNING:
; Destructive function NREVERSE called on a macro argument: PAIRS.
I get this:
; caught ERROR:
; during macroexpansion of (AUTOCOLLECT (PTR) (CHECK-NULL #) ...). Use *BREAK-ON-SIGNALS* to intercept.
; Trying to use AUTOCOLLECT without TRIVIAL-GARBAGE
About the problem that "SDL2" cannot be found when creating an executable binary with ECL
After creating an executable binary with "asdf: make-build", including sdl2-ttf in the dependency will cause the following error:
Condition of type: SIMPLE-ERROR
Module error: Don't know how to REQUIRE SDL2.
No restarts available.
Top level in: # <process TOP-LEVEL>
This problem was solved by deleting the following part of src/general.lisp.
line 3: (require 'sdl)
Even without require, it looks like the execution of the program is not affected. Does a non-ECL implementation cause problems without this code?
(English is not my native language; please excuse typing errors.)
platform: Windows 10
architecture: Intel x86-64
Implementation: CCL
DLL Path: "C:\quicklisp\SDL2 DLLS\SDL2_ttf.dll"
The dll path is set in the path enviornment variable, as all other SDL2 libraries can be run(gfx, image, mixer), it's only ttf that doesn't work.
The error I get:
Subprocess (:PROCESS
#<EXTERNAL-PROCESS (#1=gcc #2=-o
#3=C:/Users/sveny/AppData/Local/cache/common-lisp/ccl-1.11-f96-win-x64/c/quicklisp/dists/quicklisp/software/cffi_0.22.1/libffi/libffi-types__grovel-tmp70D3CAC9.obj
...)[NIL] (ERROR : 2) #x2101EF3B1D>)
with command (#1# #2# #3# "-c" "-m64"
"-Ic:/quicklisp/dists/quicklisp/software/cffi_0.22.1/"
"C:/Users/sveny/AppData/Local/cache/common-lisp/ccl-1.11-f96-win-x64/c/quicklisp/dists/quicklisp/software/cffi_0.22.1/libffi/libffi-types__grovel.c")
exited with error code 2
[Condition of type CFFI-GROVEL:GROVEL-ERROR]
Hello, I have been using sdl2-ttf and found that some finalizer in sdl2-ttg:render-text-solid crashes sbcl.
The interval at which this crashes is random so the only way to reproduce this issue is just calling the function over and over again in a loop and see where it fails.
I got 2 errors when running this code
(require :sdl2)
(require :sdl2-ttf)
(defun main ()
(sdl2-ttf:init)
(sdl2:with-init (:everything)
(sdl2:with-window (win :title "Hello world" :flags '(:shown) :w 320 :h 240)
(let ((surf (sdl2:get-window-surface win))
(font (sdl2-ttf:open-font (truename "kongtext.ttf") 16)))
(sdl2:with-event-loop (:method :poll)
(:idle ()
;fill with black screen, nil means whole surface
(sdl2:fill-rect surf nil (sdl2:map-rgb (sdl2:surface-format surf) #x00 #x00 #x00))
(let ((text_surf (sdl2-ttf:render-text-solid font
"Hello world"
#xff #xff #xff #x00)))
(sdl2:blit-surface text_surf nil surf nil)
(sdl2:free-surface text_surf))
(sdl2:update-window win)
(sdl2:delay 30))
(:quit () (progn
(sdl2-ttf:close-font font)
(sdl2-ttf:quit)
t)))))))
The first error I got was this
* (main)
double free or corruption (out)
fatal error encountered in SBCL pid 16748(tid 0x7f200457f700)CORRUPTION WARNING in SBCL pid 16748(tid 0x7f201d377700):
Memory fault at 0x18 (pc=0x7f2023f53f21, sp=0x7f201d375de0)
:
SIGABRT received.
The integrity of this image is possibly compromised.
Welcome to LDB, a low-level debugger for the Lisp runtime environment.
Continuing with fingers crossed.
ldb>
debugger invoked on a SB-SYS:MEMORY-FAULT-ERROR in thread
#<THREAD "SDL2 Main Thread" RUNNING {1004F83AA3}>:
Unhandled memory fault at #x18.
The second error I got was directly from sdl2-ttf
* (main)
NIL
* (main)
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {100583506B}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B681E3}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {1005834C4B}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B813A3}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at (nil) (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {100581126B}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B82613}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x10000000098 (pc=0x7f883e521b91, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {100583642B}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B83883}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {1005834FEB}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B84AF3}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x14a (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {10058363AB}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B85D63}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {1005834F6B}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B86FD3}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x14a (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {100583632B}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B88243}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {100583562B}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B894B3}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {1005834EEB}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B8A723}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x14a (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {10058362AB}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B8B993}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {10058355AB}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B8CC03}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {100581158B}>:
#<SB-SYS:MEMORY-FAULT-ERROR {1001B8DE73}>
INFO: Control stack guard page unprotected
Control stack guard page temporarily disabled: proceed with caution
debugger invoked on a SB-KERNEL::CONTROL-STACK-EXHAUSTED in thread
#<THREAD "finalizer" RUNNING {1001B60053}>:
Control stack exhausted (no more space for function call frames).
This is probably due to heavily nested or infinitely recursive function
calls, or a tail call that SBCL cannot or has not optimized away.
PROCEED WITH CAUTION.
NIL
*
Above attached is the code I used to reproduce this problem. I need to call this function repeatedly to update the text gradually in one of my projects. This can happen at any time. So to reproduce just run the code above and wait. It should crash eventually.
I am not sure if it is something I am doing wrong but the error message suggests the problem is in some finalizer.
I have libsdl-ttf2.0-0:amd64 and libsdl-ttf2.0-dev:amd64 installed and they install:
libsdl-ttf2.0-0: /usr/lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0
libsdl-ttf2.0-0: /usr/lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0.10.1
libsdl-ttf2.0-0: /usr/share/doc/libsdl-ttf2.0-0/README
libsdl-ttf2.0-0: /usr/share/doc/libsdl-ttf2.0-0/changelog.Debian.gz
libsdl-ttf2.0-0: /usr/share/doc/libsdl-ttf2.0-0/copyright
libsdl-ttf2.0-0: /usr/share/lintian/overrides/libsdl-ttf2.0-0
but CFFI doesn't look for libSDL_ttf-2.0.so.0 in /usr/lib/x86_64-linux-gnu/ so it fails to find the .so file.
Hi!
The following code runs fine for a few seconds (shows the text just fine)
(ql:quickload 'sdl2)
(ql:quickload 'sdl2-ttf)
(ql:quickload 'font-discovery)
(defmacro with-texture (texture-sym renderer surface &body body)
`(let ((,texture-sym (sdl2:create-texture-from-surface ,renderer ,surface)))
(unwind-protect
(progn ,@body)
(sdl2:destroy-texture ,texture-sym))))
(defmacro with-surface (surface-sym surface &body body)
`(let ((,surface-sym ,surface))
(unwind-protect
(progn ,@body)
(sdl2:free-surface ,surface-sym))))
(let ((font-path (org.shirakumo.font-discovery:file
(org.shirakumo.font-discovery:find-font :family "" :spacing :monospace)))
(point-size 40))
(sdl2:with-init (:everything)
(sdl2-ttf:init)
(sdl2:with-window (the-window :title "Basic Font Example" :w 300 :h 300 :flags '(:shown))
(sdl2:with-renderer (my-renderer the-window :flags '(:accelerated))
(let ((font (sdl2-ttf:open-font font-path point-size)))
(sdl2:with-event-loop (:method :poll)
(:idle ()
(sdl2:set-render-draw-color my-renderer 0 0 0 255)
(sdl2:render-clear my-renderer)
(with-surface surface (sdl2-ttf:render-text-solid font "tnetnet" 255 255 255 0)
(with-texture hello-text my-renderer surface
(sdl2:render-copy my-renderer
hello-text
:source-rect (cffi:null-pointer)
:dest-rect (sdl2:make-rect
(round (- 150 (/ (sdl2:texture-width hello-text) 2.0)))
(round (- 150 (/ (sdl2:texture-height hello-text) 2.0)))
(sdl2:texture-width hello-text)
(sdl2:texture-height hello-text)))))
(sdl2:render-present my-renderer))
(:quit ()
(when (> (sdl2-ttf:was-init) 0)
(sdl2-ttf:close-font font)
(sdl2-ttf:quit))
t)))))))
and then crashes with:
Unhandled memory fault at #x10014.
[Condition of type SB-SYS:MEMORY-FAULT-ERROR]
and prints:
WARNING:
Error calling finalizer #<CLOSURE (LAMBDA ()
:IN
SDL2-TTF:RENDER-TEXT-SOLID) {10064E1A2B}>:
#<SB-SYS:MEMORY-FAULT-ERROR {100489D293}>
Checked on SBCL 2.0.3 and 2.0.5-1.
What could be the problem here? Is it CL-SDL2 bug?
i want to render 123
(setf font0 (sdl2-ttf:open-font "/home/peiman/Desktop/Dev/lisp-draft/font.ttf" 40))
(setf text-surface (sdl2-ttf:render-unicode-blended font0 "u0031 u0032 u0033" 255 0 255 0))
but its not render properly
i want to render persian symbols
can you show me an example of using this function please.
Hi, I get an error on OpenBSD.
Spec folder doesn't seem to have SDL2ttf.h but only SDL_ttf.h
The idea here is that c2ffi (which I compiled already successfully) generates the spec file for OpenBSD ?
Thanks!
My log:
`To load "sdl2-ttf":
Load 1 ASDF system:
sdl2-ttf
; Loading "sdl2-ttf"
..............
; pkg-config libffi --cflags
-I/usr/local/include
; cc -o /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel-tmpTT1OWD6.o -c -O2 -pipe -g -g -Wall -Wundef -Wsign-compare -Wpointer-arith -I/usr/local/include -fno-omit-frame-pointer -pthread -I/usr/local/include -I/usr/local/include -fPIC -I/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/ /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.c
/home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.c:11:7: warning: unused variable 'autotype_tmp' [-Wunused-variable]
int autotype_tmp;
^
1 warning generated.
; cc -o /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel-tmp9QIWO193 -L/usr/local/lib -g -Wl,--export-dynamic -Wl,-z,wxneeded /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.o
; /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.grovel-tmp.lisp
...
; file: /home/rpx/common-lisp/cl-sdl2-ttf/src/autowrap.lisp
; in: AUTOWRAP:C-INCLUDE '(SDL2-TTF AUTOWRAP-SPEC "SDL2_ttf.h")
; (AUTOWRAP:C-INCLUDE
; '(SDL2-FFI::SDL2-TTF SDL2-FFI::AUTOWRAP-SPEC "SDL2_ttf.h") :FUNCTION-PACKAGE
; :SDL2-FFI.FUNCTIONS :SPEC-PATH '(SDL2-FFI::SDL2-TTF SDL2-FFI::AUTOWRAP-SPEC)
; :EXCLUDE-SOURCES ("/usr/include/") :INCLUDE-SOURCES ("SDL_ttf.h")
; :SYMBOL-EXCEPTIONS (("SDL_RWops" . "SDL-RWOPS")) ...)
;
; caught COMMON-LISP:ERROR:
; (during macroexpansion of (AUTOWRAP:C-INCLUDE '(SDL2-TTF AUTOWRAP-SPEC ...) ...))
; Subprocess #<UIOP/LAUNCH-PROGRAM::PROCESS-INFO {1005228433}>
; with command ("c2ffi" "/home/rpx/common-lisp/cl-sdl2-ttf/src/spec/SDL2_ttf.h"
; "-D" "null" "-M" "/tmp/tmp12YFTKZX-tmp.c" "-A"
; "x86_64-unknown-openbsd")
; exited with error code 1
debugger invoked on a UIOP/LISP-BUILD:COMPILE-FILE-ERROR in thread
#<THREAD "main thread" RUNNING {1001430003}>:
COMPILE-FILE-ERROR while compiling #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [RETRY ] Retry
compiling #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">.
1: [ACCEPT ] Continue, treating
compiling #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">
as having been successful.
2: Retry ASDF operation.
3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the
configuration.
4: Retry ASDF operation.
5: Retry ASDF operation after resetting the
configuration.
6: [ABORT ] Give up on "sdl2-ttf"
7: [REGISTER-LOCAL-PROJECTS ] Register local projects and try again.
8: Exit debugger, returning to top level.
(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-ttf" "autowrap">)))
error finding frame source: Bogus form-number: the source file has probably
changed too much to cope with.
source: NIL
0] `
Hello,
I'm trying to load this by running:
(ql:quickload :sdl2-ttf)
but I get the error
Undefined foreign type: TTF-FONT
[Condition of type AUTOWRAP:UNDEFINED-FOREIGN-TYPE]
Restarts:
0: [RETRY-COMPILE-FILE] Retry compiling #P"/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp"
1: [SKIP-COMPILE-FILE] Skip compiling #P"/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp"
2: [RETRY] Retry compiling #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">.
3: [ACCEPT] Continue, treating compiling #<CL-SOURCE-FILE "sdl2-ttf" "autowrap"> as having been successful.
4: [RETRY] #<error printing RESTART #x2453BA4D>
5: [CLEAR-CONFIGURATION-AND-RETRY] #<error printing RESTART #x2453BA9D>
--more--
Backtrace:
0: (AUTOWRAP::%UNDEFINED-TYPE-ERROR-NO-CONTEXT SDL2-FFI::TTF-FONT)
1: (AUTOWRAP:DEFINE-WRAPPER (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD>)
2: (FUNCALL #<Compiled-function AUTOWRAP:DEFINE-WRAPPER Macroexpander #x3020014C14EF> (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD>)
3: (MACROEXPAND-1 (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD>)
4: (CCL::FCOMP-MACROEXPAND-1 (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD>)
5: (CCL::FCOMP-FORM-1 (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :COMPILE-TIME-TOO)
6: (CCL::FCOMP-FORM (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :COMPILE-TIME-TOO)
7: (CCL::FCOMP-FORM-LIST ((SETF AUTOWRAP::*FAILED-WRAPS* NIL) (SETF AUTOWRAP::*MUTE-REPORTING-P* T) ..)) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :COMPILE-TIME-TOO)
8: (CCL::FCOMP-EVAL-WHEN (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) ..) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :NOT-COMPILE-TIME)
9: (CCL::FCOMP-FORM (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) ..) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :NOT-COMPILE-TIME)
10: (CCL::FCOMP-FORM-LIST ((EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) ..))) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :NOT-COMPILE-TIME)
11: (CCL::FCOMP-FORM (PROGN (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) ..)) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :NOT-COMPILE-TIME)
12: (CCL::FCOMP-FORM (AUTOWRAP:C-INCLUDE '(SDL2-FFI::SDL2-TTF SDL2-FFI::AUTOWRAP-SPEC "SDL2_ttf.h") :FUNCTION-PACKAGE :SDL2-FFI.FUNCTIONS :SPEC-PATH ...) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :NOT-CO..
13: (CCL::FCOMP-READ-LOOP "/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" "home:quicklisp;local-projects;cl-sdl2-ttf;src;autowrap.lisp.newest" 0 #<CCL::LEXICAL-ENVIRONMENT #x302002AC0..
14: (CCL::FCOMP-FILE "/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" "home:quicklisp;local-projects;cl-sdl2-ttf;src;autowrap.lisp.newest" 0 #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD>)
15: (CCL::%COMPILE-FILE "/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" "/Users/Nate/.cache/common-lisp/ccl-1.11-f96-macosx-x64/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/aut..
16: (COMPILE-FILE #P"/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" :OUTPUT-FILE #P"/Users/Nate/.cache/common-lisp/ccl-1.11-f96-macosx-x64/Users/Nate/quicklisp/local-projects/cl-sdl2-..
17: (UIOP/UTILITY:CALL-WITH-MUFFLED-CONDITIONS #<COMPILED-LEXICAL-CLOSURE (:INTERNAL UIOP/LISP-BUILD:COMPILE-FILE*) #x302002AC0B4F> NIL)
18: (UIOP/PATHNAME:CALL-WITH-ENOUGH-PATHNAME #P"/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" NIL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL ..))
19: (UIOP/LISP-BUILD:COMPILE-FILE* #P"/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" :OUTPUT-FILE #P"/Users/Nate/.cache/common-lisp/ccl-1.11-f96-macosx-x64/Users/Nate/quicklisp/local-..
20: (FUNCALL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL ASDF/LISP-ACTION:PERFORM-LISP-COMPILATION) #x302002AC0CEF>)
21: (ASDF/LISP-ACTION:PERFORM-LISP-COMPILATION #<COMPILE-OP > #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">)
22: (CCL::%%BEFORE-AND-AFTER-COMBINED-METHOD-DCODE (NIL #<STANDARD-METHOD ASDF/ACTION:PERFORM (ASDF/LISP-ACTION:COMPILE-OP ASDF/LISP-ACTION:CL-SOURCE-FILE)> . 76034347))
23: (CCL::%%STANDARD-COMBINED-METHOD-DCODE ((#<STANDARD-METHOD ASDF/ACTION:PERFORM :BEFORE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)>) ..))) 76034347)
24: (NIL #<Unknown Arguments>)
25: (CCL::%CALL-NEXT-METHOD (NIL #<STANDARD-METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (T T)> . 76034390))
26: (#<STANDARD-METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS :AROUND (T T)> #<COMPILE-OP > #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">)
27: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS :AROUND (T T)> #<STANDARD-METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (T T)>) 76034390)
28: (NIL #<Unknown Arguments>)
29: (#<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN (LIST)> ((#<COMPILE-OP > . #<SYSTEM "alexandria">) (#<COMPILE-OP > . #<SYSTEM "defpackage-plus">) (#<COMPILE-OP > . #<MODULE "trivial-features" "src">) ..))) ..
30: (CCL::%CALL-NEXT-METHOD (NIL #<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN (LIST)> . 76034452))
31: (CCL::CALL-WITH-COMPILATION-UNIT #<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::WITH-COMPILATION-UNIT-BODY (ASDF/PLAN:PERFORM-PLAN :AROUND (T))) #x2453B62F> :OVERRIDE NIL)
32: (#<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)> ((#<COMPILE-OP > . #<SYSTEM "alexandria">) (#<COMPILE-OP > . #<SYSTEM "defpackage-plus">) ..))))
33: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)> #<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN (LIST)>) 76034452)
34: (NIL #<Unknown Arguments>)
35: (CCL::%CALL-NEXT-METHOD (NIL #<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN (T)> . 76034506))
36: (CCL::CALL-WITH-COMPILATION-UNIT #<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::WITH-COMPILATION-UNIT-BODY (ASDF/PLAN:PERFORM-PLAN :AROUND (T))) #x2453B75F> :OVERRIDE NIL)
37: (#<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)> #<ASDF/PLAN:SEQUENTIAL-PLAN #x302002A0C0CD>)
38: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)> #<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN (T)>) 76034506)
39: (NIL #<Unknown Arguments>)
40: (#<STANDARD-METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)> #<LOAD-OP :VERBOSE NIL> #<SYSTEM "sdl2-ttf"> :VERBOSE NIL)
41: (CCL::%CALL-NEXT-METHOD ((NIL) #<STANDARD-METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)> #<LOAD-OP :VERBOSE NIL> #<SYSTEM "sdl2-ttf"> :VERBOSE NIL))
42: ((:INTERNAL (ASDF/OPERATE:OPERATE :AROUND (T T))))
43: (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> #<LOAD-OP :VERBOSE NIL> #<SYSTEM "sdl2-ttf"> :VERBOSE NIL)
44: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :BEFORE #> #<#>) NIL ..))) 76034582)
45: (NIL #<Unknown Arguments>)
46: (CCL::%CALL-NEXT-METHOD ((NIL) #<STANDARD-METHOD ASDF/OPERATE:OPERATE (SYMBOL T)> ASDF/LISP-ACTION:LOAD-OP "sdl2-ttf" :VERBOSE NIL))
47: ((:INTERNAL (ASDF/OPERATE:OPERATE :AROUND (T T))))
48: (ASDF/CACHE:CALL-WITH-ASDF-CACHE #<COMPILED-LEXICAL-CLOSURE (:INTERNAL (ASDF/OPERATE:OPERATE :AROUND (T T))) #x302002A0C6DF> :OVERRIDE NIL :KEY NIL)
49: (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> ASDF/LISP-ACTION:LOAD-OP "sdl2-ttf" :VERBOSE NIL)
50: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :BEFORE #>) NIL ..) 76034670)
51: (NIL #<Unknown Arguments>)
52: (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> ASDF/LISP-ACTION:LOAD-OP "sdl2-ttf" :VERBOSE NIL)
53: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :BEFORE #>) NIL ..) 76034707)
54: (NIL #<Unknown Arguments>)
55: (QUICKLISP-CLIENT::CALL-WITH-MACROEXPAND-PROGRESS #<COMPILED-LEXICAL-CLOSURE (:INTERNAL QUICKLISP-CLIENT::APPLY-LOAD-STRATEGY) #x302002A0CFEF>)
56: (QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES "sdl2-ttf" :PROMPT NIL)
57: (#<STANDARD-METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T)> #<QL-IMPL:CCL #x302000A42D0D> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL QUICKLISP-CLIENT::QL ..))
58: (#<STANDARD-METHOD QUICKLISP-CLIENT:QUICKLOAD (T)> (:SDL2-TTF) :PROMPT NIL :VERBOSE NIL)
59: (CCL::%CALL-NEXT-METHOD ((NIL) #<STANDARD-METHOD QUICKLISP-CLIENT:QUICKLOAD (T)> :SDL2-TTF))
60: (QL-DIST::CALL-WITH-CONSISTENT-DISTS #<COMPILED-LEXICAL-CLOSURE (:INTERNAL (QUICKLISP-CLIENT:QUICKLOAD :AROUND (T))) #x302002A0786F>)
61: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD QUICKLISP-CLIENT:QUICKLOAD :AROUND (T)> #<STANDARD-METHOD QUICKLISP-CLIENT:QUICKLOAD (T)>) 76034813)
62: (NIL #<Unknown Arguments>)
63: (CCL::CALL-CHECK-REGS QUICKLISP-CLIENT:QUICKLOAD :SDL2-TTF)
64: (CCL::CHEAP-EVAL (QUICKLISP-CLIENT:QUICKLOAD :SDL2-TTF))
65: (SWANK::EVAL-REGION "(ql:quickload :sdl2-ttf)\n")
66: ((:INTERNAL SWANK::REPL-EVAL))
67: (SWANK::TRACK-PACKAGE #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::REPL-EVAL) #x302002A07AFF>)
68: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME REPL evaluation request." #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::REPL-EVAL) #x302002A07B7F>)
69: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::REPL-EVAL) #x302002A07BBF>)
70: (SWANK::REPL-EVAL "(ql:quickload :sdl2-ttf)\n")
71: (CCL::CALL-CHECK-REGS SWANK:LISTENER-EVAL "(ql:quickload :sdl2-ttf)\n")
72: (CCL::CHEAP-EVAL (SWANK:LISTENER-EVAL "(ql:quickload :sdl2-ttf)\n"))
73: (SWANK:EVAL-FOR-EMACS (SWANK:LISTENER-EVAL "(ql:quickload :sdl2-ttf)\n") "COMMON-LISP-USER" 75)
74: (SWANK::PROCESS-REQUESTS NIL)
75: ((:INTERNAL SWANK::HANDLE-REQUESTS))
76: ((:INTERNAL SWANK::HANDLE-REQUESTS))
77: (SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK #<Compiled-function SWANK:SWANK-DEBUGGER-HOOK #x30200059BD2F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::HANDLE-REQUESTS) #x30200073FEBF>)
78: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* . #<SWANK-BACKEND::SLIME-OUTPUT-STREAM #x30200073EE7D>) (*STANDARD-INPUT* . #<SWANK-BACKEND::SLIME-INPUT-STREAM #x30200073F1ED>) ..))) #<COMPILED-LEXICAL..
79: (SWANK::HANDLE-REQUESTS #<MULTITHREADED-CONNECTION #x302000626EDD> NIL)
80: (CCL::RUN-PROCESS-INITIAL-FORM #<PROCESS repl-thread(11) [Active] #x30200072E0DD> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::%PROCESS-RUN-FUNCTION) #x30200072DE6F>))
81: ((:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS))) #<PROCESS repl-thread(11) [Active] #x30200072E0DD> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::%PROCESS-RUN-FUNCTION) #x30200072DE6F>))
82: ((:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION))
I am running CCL: "Version 1.11-r16635 (DarwinX8664)" on OS X 10.11 and I have SDL2_TTF version 2.0 installed to /Library/Frameworks/.
sdl2-ttf:was-init returns 0 when it's not initialized and 1 when initialized. It'd be easy to change so it returns t and nil, but it may break API contract with existing applications.
CL-USER> (sdl2-ttf:was-init)
0
CL-USER> (sdl2-ttf:init)
0
CL-USER> (sdl2-ttf:was-init)
1
Hi, is it correct to extend for OpenBSD the library.lisp file with "libSDL2_ttf.so.0.1" ?
(:unix (:or "libSDL2_ttf-2.0.so.0" "libSDL2_ttf" "libSDL2_ttf.so.0.1"))
If I don't it doesn't find the lib:
(ql:quickload :sdl2-ttf)
To load "sdl2-ttf":
Load 1 ASDF system:
sdl2-ttf
; Loading "sdl2-ttf"
....................
debugger invoked on a CFFI:LOAD-FOREIGN-LIBRARY-ERROR in thread
#<THREAD "main thread" RUNNING {10013D8003}>:
Unable to load any of the alternatives:
("libSDL2_ttf-2.0.so.0" "libSDL2_ttf")
On my system it's located here:
tron$ ldconfig -r | grep ttf 744:-lSDL2_ttf.0.1 => /usr/local/lib/libSDL2_ttf.so.0.1
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.