lispgames / cl-sdl2

Common Lisp bindings for SDL2 using C2FFI.
MIT License
304 stars 82 forks source link

Unable to load any of the alternatives:("libSDL2-2... in android #126

Open noloop opened 4 years ago

noloop commented 4 years ago

I loaded the libSDL2.so which I compile to armv7a and l loaded with:

(cffi:load-foreign-library #P"/data/data/ecl.android.skeleton/lib/libSDL2.so") => its ok, I checked

but when I load the sdl2 system:

(asdf:load-system :sdl2)

I get:

Unable to load any of the alternatives:
("libSDL2-2.0.so.0" "libSDL2.so.0.2" "libSDL2")

How do I get to libSD2.so for cl-sdl2 to recognize?

notmgsk commented 4 years ago

@noloop cffi:load-system takes a :search-path (a list of non-default paths to search for the library).

noloop commented 4 years ago

@notmgsk I tried:

(cffi:load-system :sdl2 :search-path #P"/data/data/ecl.android.skeleton/lib/")

but doesn't work.

Also I don't see anything about this function in https://github.com/cffi/cffi/search?q=%3Asearch-path&unscoped_q=%3Asearch-path

I tried also:

(progn
  (cffi:define-foreign-library
      (sdl2
       :search-path #P"/data/data/ecl.android.skeleton/lib")
      (t (:default "libSDL2")))
  (cffi:use-foreign-library sdl2)
  (asdf:load-system :sdl2))

And I get the same error:

Unable to load any of the alternatives:
("libSDL2-2.0.so.0" "libSDL2.so.0.2" "libSDL2")

If I try change the cl-sdl2/src/library.lisp tp:

(in-package :sdl2)

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

;;(cffi:use-foreign-library libsdl2)

(cffi:load-foreign-library #P"/data/data/ecl.android.skeleton/lib/libhidapi.so")
(cffi:load-foreign-library #P"/data/data/ecl.android.skeleton/lib/libSDL2.so")

I get:

No spec for #P"SYS:CL-SDL2;SRC;SPEC;SDL2.H" on arch 'arm-unknownNIL' and c2ffi not found

noloop commented 4 years ago

I think that the problem is: https://github.com/rpav/cl-autowrap/issues/98

noloop commented 4 years ago

I'm almost can make the SDL2 run in the Android. I have add somethings in the cl-autowrap to make it possible. But I get the error:

In method definition for PRINT-OBJECT, found an invalid specializer (SDL-POINT T)

I don't understand what can be this yet. Some ideia?

up https://gitlab.com/embeddable-common-lisp/ecl/issues/553

hu-moonstone commented 4 years ago
invalid specializer (SDL-POINT T)

This issue was addressed recently by ECL. I think the latest development branch has solved it. I have confirmed that it has been solved on x86 GNU/Linux.

https://gitlab.com/embeddable-common-lisp/ecl/issues/553

noloop commented 4 years ago

@hu-moonstone Yes, I can load (20s) the cl-sdl2 (one .fasb file with new autowrap modifications) with the asdf now, however there are some problems to resolver yet, like the with-init that doesn't work because of threads questions, the cl-sdl2 in the Android need use one thread created by the JNI or Java code, so it will need make new functions that doesn't create threads.