[ANN] Lua-SDL2 rc1 available for testing!

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] Lua-SDL2 rc1 available for testing!

David Demelier
Hi there,

I'm very happy to announce the first release candidate of Lua-SDL2
[1]. As I already announced a few
months ago, Lua-SDL2 is a pure C binding against SDL 2.0.3.

It is designed to be as close as possible to the official SDL C API
but with object orientation and
functions overload where possible. For instance, SDL_Window is mapped
to a Lua userdata object.

The Lua-SDL2 binding was currently tested on Windows 7 and FreeBSD. It
should compile on major
platforms which support C and SDL. Prebuilt binaries are available for Windows.

The SDL API is covered around 95% (of what can be implemented, DSO and
such are not counted), its API
is completely documented [2].

However, Lua-SDL2 now needs *your* help, by:

* Testing as much as possible, a lot of examples are available in the
examples/ and tutorials/
  directories.

* A few functions are not implemented, it's the case of Texture:lock
for instance which is terribly
  hard to implement from Lua because the C side expect to cast the
pixel pointer to the underlyling
  sized array which in Lua is impossible to do. Please provide me
feedback on how you want it to
  be implemented.

* Feedback, provide me some enhancement you may find obvious or
better. In the code or in the documentation :-).

* Testing Haptic and OpenGL functions, I don't have any haptic devices
so I can't test myself. For OpenGL, I never used
  it so I can't test neither.

Currently, Lua-SDL2 only supports Lua 5.2 and higher, I will add some
portability code for Lua 5.1 in the
next few days.

Enjoy this binding :-).

Kind regards,
David.

[1] https://redmine.malikania.fr/projects/luasdl2/wiki#Download
[2] https://redmine.malikania.fr/projects/luasdl2/wiki#Documentation

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

Jeff Pohlmeyer
On Apr 26, 2014 5:38 AM, David Demelier wrote:

> I'm very happy to announce the first release candidate of Lua-SDL2
> Lua-SDL2 is a pure C binding against SDL 2.0.3.
> ...
> It should compile on major platforms which support C and SDL.


Cool!

I checked out the HG repo but got an error compiling on ArchLinux...

./src/haptic.c:79:3: error:
  'for' loop initial declarations are only allowed in C99 mode
   for (int i = 0; i < 3; ++i) {
   ^

GCC says:
  Note: use option -std=c99 or -std=gnu99 to compile your code.


But I think the more portable fix would be to declare 'i' first:

if (lua_type(L, -1) == LUA_TTABLE) {
  int i;
  for (i = 0; i < 3; ++i) {
   ...
  }
}

After that change 'make' succeeds.

Nice work, David!

 - Jeff

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

David Demelier
2014-04-26 13:04 GMT+02:00 Jeff Pohlmeyer <[hidden email]>:

> On Apr 26, 2014 5:38 AM, David Demelier wrote:
>
>> I'm very happy to announce the first release candidate of Lua-SDL2
>> Lua-SDL2 is a pure C binding against SDL 2.0.3.
>> ...
>> It should compile on major platforms which support C and SDL.
>
>
> Cool!
>
> I checked out the HG repo but got an error compiling on ArchLinux...
>
> ./src/haptic.c:79:3: error:
>   'for' loop initial declarations are only allowed in C99 mode
>    for (int i = 0; i < 3; ++i) {
>    ^
>
> GCC says:
>   Note: use option -std=c99 or -std=gnu99 to compile your code.
>
>
> But I think the more portable fix would be to declare 'i' first:
>
> if (lua_type(L, -1) == LUA_TTABLE) {
>   int i;
>   for (i = 0; i < 3; ++i) {
>    ...
>   }
> }
>
> After that change 'make' succeeds.
>
> Nice work, David!
>
>  - Jeff
>

Oops yes, I don't write much C code these times, I usually do C++ but
thanks for reporting I fix that :-)

--
Demelier David

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

Philipp Janda
In reply to this post by David Demelier
Am 26.04.2014 12:38 schröbte David Demelier:
> Hi there,

Hi!

>
> I'm very happy to announce the first release candidate of Lua-SDL2
> [1]. As I already announced a few
> months ago, Lua-SDL2 is a pure C binding against SDL 2.0.3.
>
> [...]
>
> * A few functions are not implemented, it's the case of Texture:lock
> for instance which is terribly
>    hard to implement from Lua because the C side expect to cast the
> pixel pointer to the underlyling
>    sized array which in Lua is impossible to do. Please provide me
> feedback on how you want it to
>    be implemented.

That depends on what you want the Lua code to do with a locked texture.
For my own binding I considered using something along the lines of

     myTexture:with_lock( function( modifypixels )
       -- code using the modifypixels function ...
     end )

but in the end I simply didn't implement direct access to pixel data in
my binding (it has a rather narrow focus). `with_lock` would `pcall`
(not `pcallk`![*]) the given function and pass a closure that has access
to the pixel data and the pitch as argument. The Lua code would only
access the pixel data via that function. After the `pcall` returns the
upvalues of `modifypixels` get nil'ed using `lua_setupvalue` (for
safety), and `SDL_UnlockTexture` is called before `with_lock` returns ...

>
> * Feedback, provide me some enhancement you may find obvious or
> better. In the code or in the documentation :-).

I don't know if that's intended, but your binding is rather low-level:
It can crash in certain situations (e.g. if a renderer is collected
before its textures, or window before renderer, etc.), and it would be
easy to call `SDL_Quit` automatically via garbage-collection so that the
binding doesn't leak if there is a non-local exit (e.g. an error, or a
yielded coroutine that gets collected). Another minor point: If
`lua_newuserdata` ever raises an error you will leak the corresponding
SDL object.

Aside from that it looks very good (and I probably would have used it
instead of rolling my own if had known about it a week ago)!

>
> Enjoy this binding :-).
>
> Kind regards,
> David.
>

Philipp

   [*]: This is one of those rare cases where you *don't* want a
yieldable `pcall` ...



Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

David Demelier

On 26/04/2014 16:41, Philipp Janda wrote:

> Am 26.04.2014 12:38 schröbte David Demelier:
>> Hi there,
>
> Hi!
>
>>
>> I'm very happy to announce the first release candidate of Lua-SDL2
>> [1]. As I already announced a few
>> months ago, Lua-SDL2 is a pure C binding against SDL 2.0.3.
>>
>> [...]
>>
>> * A few functions are not implemented, it's the case of Texture:lock
>> for instance which is terribly
>>    hard to implement from Lua because the C side expect to cast the
>> pixel pointer to the underlyling
>>    sized array which in Lua is impossible to do. Please provide me
>> feedback on how you want it to
>>    be implemented.
>
> That depends on what you want the Lua code to do with a locked
> texture. For my own binding I considered using something along the
> lines of
>
>     myTexture:with_lock( function( modifypixels )
>       -- code using the modifypixels function ...
>     end )
>
> but in the end I simply didn't implement direct access to pixel data
> in my binding (it has a rather narrow focus). `with_lock` would
> `pcall` (not `pcallk`![*]) the given function and pass a closure that
> has access to the pixel data and the pitch as argument. The Lua code
> would only access the pixel data via that function. After the `pcall`
> returns the upvalues of `modifypixels` get nil'ed using
> `lua_setupvalue` (for safety), and `SDL_UnlockTexture` is called
> before `with_lock` returns ...
>
That's a really interesting way of doing it :-).

>>
>> * Feedback, provide me some enhancement you may find obvious or
>> better. In the code or in the documentation :-).
>
> I don't know if that's intended, but your binding is rather low-level:
> It can crash in certain situations (e.g. if a renderer is collected
> before its textures, or window before renderer, etc.), and it would be
> easy to call `SDL_Quit` automatically via garbage-collection so that
> the binding doesn't leak if there is a non-local exit (e.g. an error,
> or a yielded coroutine that gets collected). Another minor point: If
> `lua_newuserdata` ever raises an error you will leak the corresponding
> SDL object.
>
Ah I didn't know that the program crash is a renderer is destroyed
before textures. But I can easily fix that by keeping references until
the renderer is destroyed it "owns" a reference to the texture and may
not be collected. (It's also done in the SDL_net Set object which "owns"
sockets).

Yes, the binding is rather low-level, because I wanted it to be a SDL
binding and not a game engine :-). However it is still a bit higher
level than C with the object orientation and some other convenient stuff.
> Aside from that it looks very good (and I probably would have used it
> instead of rolling my own if had known about it a week ago)!
>
Thanks :-).

>>
>> Enjoy this binding :-).
>>
>> Kind regards,
>> David.
>>
>
> Philipp
>
>   [*]: This is one of those rare cases where you *don't* want a
> yieldable `pcall` ...

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

Philipp Janda
Am 27.04.2014 08:46 schröbte David Demelier:

>
> On 26/04/2014 16:41, Philipp Janda wrote:
>>
>>     myTexture:with_lock( function( modifypixels )
>>       -- code using the modifypixels function ...
>>     end )
>>
>> but in the end I simply didn't implement direct access to pixel data
>> in my binding (it has a rather narrow focus). `with_lock` would
>> `pcall` (not `pcallk`![*]) the given function and pass a closure that
>> has access to the pixel data and the pitch as argument. The Lua code
>> would only access the pixel data via that function. After the `pcall`
>> returns the upvalues of `modifypixels` get nil'ed using
>> `lua_setupvalue` (for safety), and `SDL_UnlockTexture` is called
>> before `with_lock` returns ...
>>
> That's a really interesting way of doing it :-).

It should solve the problem of giving Lua code safe access to a void
pointer with non-contiguous memory, the problem that a reference to the
void pointer (or the `modifypixels` function) might escape, and the
problem to make sure that `SDL_UnlockTexture` is called in any case.

>>
>> I don't know if that's intended, but your binding is rather low-level:
>> It can crash in certain situations (e.g. if a renderer is collected
>> before its textures, or window before renderer, etc.), and it would be
>> easy to call `SDL_Quit` automatically via garbage-collection so that
>> the binding doesn't leak if there is a non-local exit (e.g. an error,
>> or a yielded coroutine that gets collected). Another minor point: If
>> `lua_newuserdata` ever raises an error you will leak the corresponding
>> SDL object.
>>
> Ah I didn't know that the program crash is a renderer is destroyed
> before textures. But I can easily fix that by keeping references until
> the renderer is destroyed it "owns" a reference to the texture and may
> not be collected. (It's also done in the SDL_net Set object which "owns"
> sockets).

Yes, that's what I did (I have an extra function in my Lua helper
toolkit that constructs an object with an env table and puts the
required reference in there). The SDL2 documentation is not very clear
about this and I usually had to look at the source code, but I can
remember the following:
*   a renderer accesses its window in `SDL_DestroyRenderer`, so the
window has to live longer.
*   a renderer destroys all its remaining textures in
`SDL_DestroyRenderer`, so it has to live longer than any of its textures
(or else you get double frees and/or dangling pointers).
*   a window should not be collected before the surface returned by
`SDL_GetWindowSurface`, or you have a dangling pointer.
*   `SDL_Quit` destroys all remaining windows (and probably other
required data behind the scenes), so exposing this function may leave
dangling references in Lua code.

There may be others, my binding isn't nearly as comprehensive as yours
(in particular I left out most of the surface stuff), and I only looked
up what I needed ...

>
> Yes, the binding is rather low-level, because I wanted it to be a SDL
> binding and not a game engine :-). However it is still a bit higher
> level than C with the object orientation and some other convenient stuff.

And it needs to be. Lua has features that more or less require automatic
resource cleanup (e.g. closures, errors, yields). Therefore, doing
manual management correctly is harder in Lua than it is in C (which is
why I flinch every time when someone uses lightuserdata instead of full
userdata for object references). So you really should call `SDL_Quit`
and the other cleanup functions automatically instead of requiring your
users to keep track of the control flow. I usually put an `int` userdata
with a custom `__gc` function in the registry. The `__gc` calls the
cleanup function when the `int` is >= 1. After successful
initialization, I set that userdata to 1, and forget about it ...


Philipp



Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

Rena
In reply to this post by David Demelier
On Sat, Apr 26, 2014 at 6:38 AM, David Demelier <[hidden email]> wrote:
Hi there,

I'm very happy to announce the first release candidate of Lua-SDL2
[1]. As I already announced a few
months ago, Lua-SDL2 is a pure C binding against SDL 2.0.3.

It is designed to be as close as possible to the official SDL C API
but with object orientation and
functions overload where possible. For instance, SDL_Window is mapped
to a Lua userdata object.

The Lua-SDL2 binding was currently tested on Windows 7 and FreeBSD. It
should compile on major
platforms which support C and SDL. Prebuilt binaries are available for Windows.

The SDL API is covered around 95% (of what can be implemented, DSO and
such are not counted), its API
is completely documented [2].

However, Lua-SDL2 now needs *your* help, by:

* Testing as much as possible, a lot of examples are available in the
examples/ and tutorials/
  directories.

* A few functions are not implemented, it's the case of Texture:lock
for instance which is terribly
  hard to implement from Lua because the C side expect to cast the
pixel pointer to the underlyling
  sized array which in Lua is impossible to do. Please provide me
feedback on how you want it to
  be implemented.

* Feedback, provide me some enhancement you may find obvious or
better. In the code or in the documentation :-).

* Testing Haptic and OpenGL functions, I don't have any haptic devices
so I can't test myself. For OpenGL, I never used
  it so I can't test neither.

Currently, Lua-SDL2 only supports Lua 5.2 and higher, I will add some
portability code for Lua 5.1 in the
next few days.

Enjoy this binding :-).

Kind regards,
David.

[1] https://redmine.malikania.fr/projects/luasdl2/wiki#Download
[2] https://redmine.malikania.fr/projects/luasdl2/wiki#Documentation


I just tried this and it wasn't able to find the library or header files for SDL2-ttf even after I installed libsdl-ttf2.0-dev.
I found the library in /usr/lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0 and symlinked it to /usr/local/lib/libSDL2_ttf.so but I wasn't able to find header files for it at all (only /usr/include/SDL/SDL_ttf.h which I assume is for SDL 1.x). I gave up there because I rather need text in my application. I'm using Lubuntu 13.10 on AMD64 and trying to compile for Lua 5.2.

--
Sent from my Game Boy.
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

Philipp Janda
Am 03.05.2014 00:40 schröbte Rena:
>>
> I just tried this and it wasn't able to find the library or header files
> for SDL2-ttf even after I installed libsdl-ttf2.0-dev.
> I found the library in /usr/lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0 and
> symlinked it to /usr/local/lib/libSDL2_ttf.so but I wasn't able to find
> header files for it at all (only /usr/include/SDL/SDL_ttf.h which I assume
> is for SDL 1.x). I gave up there because I rather need text in my
> application. I'm using Lubuntu 13.10 on AMD64 and trying to compile for Lua
> 5.2.

The required package is `libsdl2-ttf-dev` which is in Ubuntu 14.04 but
not 13.10. (I upgraded this weak precisely because of this). If you
don't want to upgrade just yet, you can try to install the new packages
manually via dpkg ...


Philipp



Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

Rena
On Fri, May 2, 2014 at 7:32 PM, Philipp Janda <[hidden email]> wrote:
Am 03.05.2014 00:40 schröbte Rena:


I just tried this and it wasn't able to find the library or header files
for SDL2-ttf even after I installed libsdl-ttf2.0-dev.
I found the library in /usr/lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0 and
symlinked it to /usr/local/lib/libSDL2_ttf.so but I wasn't able to find
header files for it at all (only /usr/include/SDL/SDL_ttf.h which I assume
is for SDL 1.x). I gave up there because I rather need text in my
application. I'm using Lubuntu 13.10 on AMD64 and trying to compile for Lua
5.2.

The required package is `libsdl2-ttf-dev` which is in Ubuntu 14.04 but not 13.10. (I upgraded this weak precisely because of this). If you don't want to upgrade just yet, you can try to install the new packages manually via dpkg ...


Philipp




Ah, I'll look into that. Not looking forward to upgrading though. (the auto upgrader has never worked for me, have to do a clean reinstall, and have been wanting to move away from Canonical stuff...)

Also, found a bug in common/common.c, in function commonPush:
commonPushUserdata(L, va_arg(ap, const char *), va_arg(ap, void *));
This can result in the wrong pointers being given, because order of function argument evaluation in C is not defined. I ended up with renderers not having any metatable, because it was getting the wrong pointer for tname, not finding any such metatable, and thus setting nil as the metatable.

I changed it to:
case 'p': {
    const char *name = va_arg(ap, const char *);
    void *ptr = va_arg(ap, void *);
    common_push_userdata(L, name, ptr);
    ++ count;
    break;
}
(the extra {} are needed to be able to declare variables within the scope of that case)

Anywhere else you're using va_arg() more than once in a function call will similarly need to be changed.


--
Sent from my Game Boy.
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

David Demelier

On 03/05/14 02:12, Rena wrote:

> On Fri, May 2, 2014 at 7:32 PM, Philipp Janda <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Am 03.05.2014 00:40 schröbte Rena:
>
>
>         I just tried this and it wasn't able to find the library or
>         header files
>         for SDL2-ttf even after I installed libsdl-ttf2.0-dev.
>         I found the library in
>         /usr/lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0 and
>         symlinked it to /usr/local/lib/libSDL2_ttf.so but I wasn't
>         able to find
>         header files for it at all (only /usr/include/SDL/SDL_ttf.h
>         which I assume
>         is for SDL 1.x). I gave up there because I rather need text in my
>         application. I'm using Lubuntu 13.10 on AMD64 and trying to
>         compile for Lua
>         5.2.
>
>
>     The required package is `libsdl2-ttf-dev` which is in Ubuntu 14.04
>     but not 13.10. (I upgraded this weak precisely because of this).
>     If you don't want to upgrade just yet, you can try to install the
>     new packages manually via dpkg ...
>
>
>     Philipp
>
>
>
>
> Ah, I'll look into that. Not looking forward to upgrading though. (the
> auto upgrader has never worked for me, have to do a clean reinstall,
> and have been wanting to move away from Canonical stuff...)
>
> Also, found a bug in common/common.c, in function commonPush:
> commonPushUserdata(L, va_arg(ap, const char *), va_arg(ap, void *));
> This can result in the wrong pointers being given, because order of
> function argument evaluation in C is not defined. I ended up with
> renderers not having any metatable, because it was getting the wrong
> pointer for tname, not finding any such metatable, and thus setting
> nil as the metatable.
>
> I changed it to:
> case 'p': {
>     const char *name = va_arg(ap, const char *);
>     void *ptr = va_arg(ap, void *);
>     common_push_userdata(L, name, ptr);
>     ++ count;
>     break;
> }
> (the extra {} are needed to be able to declare variables within the
> scope of that case)
>
> Anywhere else you're using va_arg() more than once in a function call
> will similarly need to be changed.

Very interesting! I never known that calling a(b(), c()) will call b and
c in an undefined order. You taught me something thanks :-).

I already pushed the fix in the mercurial repository, thanks!

Regards,
David.


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

Alexander Schulz
In reply to this post by David Demelier
Hey,

I would like to play around with the LuaSDL2 binding but I only get the
following error:

----
lua: error loading module 'SDL' from file '/usr/local/lib/lua/5.2/SDL.so':
     libSDL2-2.0.so.0: cannot open shared object file: No such file or
directory
----

I started with this guide:
https://redmine.malikania.fr/projects/luasdl2/wiki/Building_from_sources
I installed SDL2 and the optional libs SDL_mixer, SDL_ttf, SDL_net and
SDL_image with:

----
$ ./configure
$ make
$ make install
----

Now are all libs in the directory /usl/local/lib.

At the final step I did:

----
$ cd Lua-SDL2-version
$ mkdir _build_
$ cd _build_
$ cmake ..
$ make
# make install
----

All this steps worked with no problem. But if I try to run a tutorial
from the website I get the described error:
https://redmine.malikania.fr/projects/luasdl2/wiki/Tutorial_01_-_Initialization

The adding of +/usr/local/lib/?.so;+ to the Lua cpath has no effect.
Do you(or anybody) have an idea what the problem is?

Best Regards,
Alexander

System Info:
MacBook 2006 early(Core Duo)
Ubuntu 14.04 32 bit

Am 26.04.2014 12:38, schrieb David Demelier:

> Hi there,
>
> I'm very happy to announce the first release candidate of Lua-SDL2
> [1]. As I already announced a few
> months ago, Lua-SDL2 is a pure C binding against SDL 2.0.3.
>
> It is designed to be as close as possible to the official SDL C API
> but with object orientation and
> functions overload where possible. For instance, SDL_Window is mapped
> to a Lua userdata object.
>
> The Lua-SDL2 binding was currently tested on Windows 7 and FreeBSD. It
> should compile on major
> platforms which support C and SDL. Prebuilt binaries are available for Windows.
>
> The SDL API is covered around 95% (of what can be implemented, DSO and
> such are not counted), its API
> is completely documented [2].
>
> However, Lua-SDL2 now needs *your* help, by:
>
> * Testing as much as possible, a lot of examples are available in the
> examples/ and tutorials/
>    directories.
>
> * A few functions are not implemented, it's the case of Texture:lock
> for instance which is terribly
>    hard to implement from Lua because the C side expect to cast the
> pixel pointer to the underlyling
>    sized array which in Lua is impossible to do. Please provide me
> feedback on how you want it to
>    be implemented.
>
> * Feedback, provide me some enhancement you may find obvious or
> better. In the code or in the documentation :-).
>
> * Testing Haptic and OpenGL functions, I don't have any haptic devices
> so I can't test myself. For OpenGL, I never used
>    it so I can't test neither.
>
> Currently, Lua-SDL2 only supports Lua 5.2 and higher, I will add some
> portability code for Lua 5.1 in the
> next few days.
>
> Enjoy this binding :-).
>
> Kind regards,
> David.
>
> [1] https://redmine.malikania.fr/projects/luasdl2/wiki#Download
> [2] https://redmine.malikania.fr/projects/luasdl2/wiki#Documentation
>


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

David Demelier
On 22.06.2014 17:30, Alexander wrote:

> Hey,
>
> I would like to play around with the LuaSDL2 binding but I only get
> the following error:
>
> ----
> lua: error loading module 'SDL' from file
> '/usr/local/lib/lua/5.2/SDL.so':
>     libSDL2-2.0.so.0: cannot open shared object file: No such file or
> directory
> ----
>

Hi,

Did you install the release version or one from Mercurial ?

Where is the libSDL2-2.0.so.0 installed? Can you please type ldd
/path/to/libSDL2-2.0.so.0?

Regards,
David.

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

David Demelier
In reply to this post by Alexander Schulz
Also, can you please type ldd on the SDL.so file provided by Lua-SDL2,
it should produce something like:

$ ldd /usr/local/lib/lua/5.2/SDL.so
/usr/local/lib/lua/5.2/SDL.so:
     libSDL2-2.0.so.0 => /usr/local/lib/libSDL2-2.0.so.0 (0x801633000)
<- here
     libthr.so.3 => /lib/libthr.so.3 (0x8018fc000)
     liblua-5.2.so => /usr/local/lib/liblua-5.2.so (0x801b21000)
     libm.so.5 => /lib/libm.so.5 (0x801d53000)
     libc.so.7 => /lib/libc.so.7 (0x80081d000)
     libusbhid.so.4 => /usr/lib/libusbhid.so.4 (0x801f79000)
     librt.so.1 => /usr/lib/librt.so.1 (0x80217d000)
     libreadline.so.8 => /lib/libreadline.so.8 (0x802383000)
     libncurses.so.8 => /lib/libncurses.so.8 (0x8025c5000)


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

Alexander Schulz
Hi,

 >>> Did you install the release version or one from Mercurial ?

I installed the release version

 >>> Where is the libSDL2-2.0.so.0 installed? Can you please type ldd
/path/to/libSDL2-2.0.so.0?

$ ldd /usr/local/lib/libSDL2-2.0.so.0
     linux-gate.so.1 =>  (0xb7776000)
     libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7620000)
     libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb761b000)
     libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb75fe000)
     librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb75f5000)
     libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7446000)
     /lib/ld-linux.so.2 (0xb7777000)

 >>> Also, can you please type ldd on the SDL.so file provided by Lua-SDL2

$ ldd /usr/local/lib/lua/5.2/SDL.so
     linux-gate.so.1 =>  (0xb7785000)
     libSDL2-2.0.so.0 => /usr/local/lib/libSDL2-2.0.so.0 (0xb764c000)
     libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb7630000)
     liblua5.2.so.0 => /usr/lib/i386-linux-gnu/liblua5.2.so.0 (0xb75fc000)
     libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb744d000)
     libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7407000)
     libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb7402000)
     librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb73f9000)
     /lib/ld-linux.so.2 (0xb7786000)

And now starts the funny part. I tried now the example again. And it
works now.
It is really strange for me because I did get the error continuous also
after two reboots.
Just strange for me.

Now I get a SDL error message:

lua: image.lua:10: No available video device
stack traceback:
     [C]: in function 'error'
     image.lua:10: in main chunk
     [C]: in ?

That is not a Lua error so thanks for your help.

Best Regards,
Alexander

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

David Demelier
Le 23/06/2014 23:08, Alexander a écrit :

> Hi,
>
> >>> Did you install the release version or one from Mercurial ?
>
> I installed the release version
>
> >>> Where is the libSDL2-2.0.so.0 installed? Can you please type ldd
> /path/to/libSDL2-2.0.so.0?
>
> $ ldd /usr/local/lib/libSDL2-2.0.so.0
>     linux-gate.so.1 =>  (0xb7776000)
>     libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7620000)
>     libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb761b000)
>     libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb75fe000)
>     librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb75f5000)
>     libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7446000)
>     /lib/ld-linux.so.2 (0xb7777000)
>
> >>> Also, can you please type ldd on the SDL.so file provided by Lua-SDL2
>
> $ ldd /usr/local/lib/lua/5.2/SDL.so
>     linux-gate.so.1 =>  (0xb7785000)
>     libSDL2-2.0.so.0 => /usr/local/lib/libSDL2-2.0.so.0 (0xb764c000)
>     libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb7630000)
>     liblua5.2.so.0 => /usr/lib/i386-linux-gnu/liblua5.2.so.0 (0xb75fc000)
>     libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb744d000)
>     libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7407000)
>     libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb7402000)
>     librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb73f9000)
>     /lib/ld-linux.so.2 (0xb7786000)
>
> And now starts the funny part. I tried now the example again. And it
> works now.
> It is really strange for me because I did get the error continuous
> also after two reboots.
> Just strange for me.
>

For me too, I'm not expert in dynamic loader but if I recall correctly
the ld.so searchs for standard paths like /lib /usr/lib (correct me if
I'm wrong). On Linux I'm not sure that /usr/local/lib/ is a standard
path where the loader search libraries.

For me on FreeBSD, when you install a new library from packages, the ld
search path is refreshed (and also when you reboot). So *maybe* the
problem came from here.

> Now I get a SDL error message:
>
> lua: image.lua:10: No available video device
> stack traceback:
>     [C]: in function 'error'
>     image.lua:10: in main chunk
>     [C]: in ?
>
> That is not a Lua error so thanks for your help.

I suspect that SDL were not compiled with video drivers support. Make
sure you have enough X11 development libraries installed before
installing SDL2.

See the ./configure --enable-video-* flags too. By the way, there is no
libsdl2 directly in ubuntu repositories?

Regards,

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua-SDL2 rc1 available for testing!

Alexander Schulz

> I suspect that SDL were not compiled with video drivers support. Make
> sure you have enough X11 development libraries installed before
> installing SDL2.
>
> See the ./configure --enable-video-* flags too. By the way, there is
> no libsdl2 directly in ubuntu repositories?
>
> Regards,
>

I recompiled after downloading some additional libs, the examples work now.

Best Regards,
Alexander