leafo / gifine

Quickly record and edit gifs and videos of your desktop
285 stars 14 forks source link

Cannot install gifine, it seems a problem of lua versions #28

Open hirunatan opened 2 years ago

hirunatan commented 2 years ago

I'm trying to install gifine in my archlinux, but i got this trace message:

[andres@artemia ~]$ sudo luarocks install --server=http://luarocks.org/dev gifine
Installing http://luarocks.org/dev/gifine-dev-1.rockspec
Cloning into 'gifine'...
remote: Enumerating objects: 216, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 216 (delta 2), reused 6 (delta 2), pack-reused 209
Receiving objects: 100% (216/216), 91.36 KiB | 615.00 KiB/s, done.
Resolving deltas: 100% (119/119), done.
Missing dependencies for gifine dev-1:
   lgi (not installed)

gifine dev-1 depends on lua >= 5.1 (5.4-1 provided by VM)
gifine dev-1 depends on lgi (not installed)
Installing https://luarocks.org/lgi-0.9.2-1.src.rock

lgi 0.9.2-1 depends on lua >= 5.1 (5.4-1 provided by VM)
make -C lgi
make[1]: Entering directory '/tmp/luarocks_lgi-0.9.2-1-IwRv4J/lgi/lgi'
pkg-config --exists 'gobject-introspection-1.0 >= 0.10.8' --print-errors
touch .depcheck
gcc -fPIC  -O2 -fPIC -I/usr/include -I/usr/include/gobject-introspection-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -pthread  -Wall -Wextra -O2 -g -c -o buffer.o buffer.c
gcc -fPIC  -O2 -fPIC -I/usr/include -I/usr/include/gobject-introspection-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -pthread  -Wall -Wextra -O2 -g -c -o callable.o callable.c
callable.c: In function 'closure_callback':
callable.c:1237:13: error: too few arguments to function 'lua_resume'
 1237 |       res = lua_resume (L, NULL, npos);
      |             ^~~~~~~~~~
In file included from lgi.h:11,
                 from callable.c:12:
/usr/include/lua.h:300:15: note: declared here
  300 | LUA_API int  (lua_resume)     (lua_State *L, lua_State *from, int narg,
      |               ^~~~~~~~~~
make[1]: *** [Makefile:63: callable.o] Error 1
make[1]: Leaving directory '/tmp/luarocks_lgi-0.9.2-1-IwRv4J/lgi/lgi'
make: *** [Makefile:16: all] Error 2

Error: Failed installing dependency: https://luarocks.org/lgi-0.9.2-1.src.rock - Build error: Failed building.

The error occurs when compiling lgi library, that seems incompatible with the current lua version 5.4.

I've tried to use other lua versions using luaver. For example, by using lua 5.3.6 and luarocks 3.5.0 I'm able to install lgi and gifine, but when I start it I get this other error:

/home/andres/.luaver/lua/5.3.6/bin/lua: /home/andres/.luarocks/share/lua/5.3/lgi/override/Gdk.lua:23: bad argument #1 to 'registerlock' (userdata expected, got nil)
stack traceback:
    [C]: in function 'lgi.core.registerlock'
    /home/andres/.luarocks/share/lua/5.3/lgi/override/Gdk.lua:23: in main chunk
    [C]: in function 'require'
    /home/andres/.luarocks/share/lua/5.3/lgi/namespace.lua:183: in function 'lgi.require'
    /home/andres/.luarocks/share/lua/5.3/lgi/namespace.lua:170: in function 'lgi.require'
    (...tail calls...)
    /home/andres/.luarocks/share/lua/5.3/gifine/main.lua:2: in main chunk
    [C]: in function 'require'
    ....luarocks/lib/luarocks/rocks-5.3/gifine/dev-1/bin/gifine:2: in main chunk
    [C]: in ?

Is there any combination of versions that work? Could it be related to this issue? https://github.com/lgi-devs/lgi/issues/226

If the cause is incompatibility with Gtk4, is there any way to force using Gtk3?

Thanks.

leafo commented 2 years ago

It looks like the fix for gtk4 is in the main branch of the lgi repository, but there is no new release for it. I can confirm that gifine also no longer starts on my machine due to the registerlock error. I'm not familiar if there is a way to force to to run with GTK3

hirunatan commented 2 years ago

Yes, it seems this is the cause. Do you know any way of compiling gifine and force it to use the main branch of lgi? I'm not familiairzed with the lua toolchain.

leafo commented 2 years ago

The developer of lgi does not provide a rockspec to install the module from the master branch of the source repository, but you could take an existing rockspec and modify it to do that by removing the "branch" field in the "source" section of the rockspec file.

That said, I just tested building lgi from source real quick and it appears that there are still errors when starting gifine, most likely due to the fact that it was built for GTK3 and not 4. I don't have the time to investigate further right now.

leafo commented 1 year ago

Just leaving an update here, there is now a dev rockspec of lgi available here: https://github.com/lgi-devs/lgi/blob/master/lgi-scm-1.rockspec

Use the following command to satisfy the dependency for gifine:

luarocks install https://raw.githubusercontent.com/lgi-devs/lgi/master/lgi-scm-1.rockspec

Keep in mind it has not been uploaded to luarocks yet. Hopefully the maintainers of lgi can get that sorted out shortly.