GifCat -- Write GIFs in LOVE.
-
- Citizen
- Posts: 67
- Joined: Fri Mar 07, 2014 8:16 pm
Re: GifCat -- Write GIFs in LOVE.
You will need to insall the luajit dynamic library and put it in your PATH so it it can link against it. I don't run windows so that is the most I can help, I'm sorry. I would start here to figure it out: http://luajit.org/install.html
-
- Prole
- Posts: 4
- Joined: Mon Dec 26, 2016 7:36 am
Re: GifCat -- Write GIFs in LOVE.
Hi, I'd made the following modifications to build.py to get mingw to compile gifcatlib.dll on Windows:
This generates the following output:
So the dll file is built. I altered gifcat.lua's and placed the dll and gifcat.lua in the base folder. My lua interpreter throws the following error: "Thread error!
gifcat.lua:188: %1 is not a valid Win32 application."
I'm not really sure what to do now. Any help?
Code: Select all
import os, sys, platform, string
opt = {
"compiler" : "gcc",
"source" : "src/lua_bindings.c",
"link" : "",
"include" : "",
"flags" : "-O2 -pedantic -Wall -Wextra -std=c99",
"outfile" : "-o gifcatlib.dll",
"define" : "",
}
template = "$compiler $outfile $source $include $link $flags $define"
if platform.system() == "Windows":
opt["flags"] += " [color=#FF0000]-llua[/color] -fpic -shared"
opt["link"] += " -lws2_32"
elif platform.system() == "Darwin":
opt["flags"] += " -bundle -undefined dynamic_lookup"
else: # Assume Linux, BSD etc.
opt["flags"] += " -fpic -shared"
print(string.Template(template).substitute(opt))
os.system(string.Template(template).substitute(opt))
[color=#FF0000]print(platform.system())[/color]
Code: Select all
$ python build.py
gcc -o gifcatlib.dll src/lua_bindings.c -lws2_32 -O2 -pedantic -Wall -Wextra
-std=c99 -llua -fpic -shared
src/lua_bindings.c:1:0: warning: -fpic ignored for target (all code is position
independent)
/*
^
In file included from src/lua_bindings.c:31:0:
src/jo_gif.c: In function 'jo_gif_quantize':
src/jo_gif.c:88:18: warning: ISO C forbids empty initializer braces [-Wpedantic
]
int bias[256] = {}, freq[256];
^
src/jo_gif.c: In function 'jo_gif_lzw_encode':
src/jo_gif.c:227:2: warning: missing initializer for field 'buf' of 'jo_gif_lzw
_t' [-Wmissing-field-initializers]
jo_gif_lzw_t state = {fp, 9};
^
src/jo_gif.c:204:16: note: 'buf' declared here
unsigned char buf[256];
^
src/jo_gif.c: In function 'jo_gif_start':
src/jo_gif.c:287:17: warning: ISO C forbids empty initializer braces [-Wpedanti
c]
jo_gif_t gif = {};
^
src/jo_gif.c:287:2: warning: missing initializer for field 'fp' of 'jo_gif_t' [
-Wmissing-field-initializers]
jo_gif_t gif = {};
^
In file included from src/lua_bindings.c:31:0:
src/jo_gif.c:28:8: note: 'fp' declared here
FILE *fp;
^
Windows
Code: Select all
local GIFLIB = "gifcatlib.dll"
gifcat.lua:188: %1 is not a valid Win32 application."
I'm not really sure what to do now. Any help?
Re: GifCat -- Write GIFs in LOVE.
I'm not sure but I think it might be that the mingw dll will only work with a mingw-compiled LÖVE, and I'm not sure whether that will work out with SDL on windows. I can be completely off here though.GodotMisogi wrote:Hi, I'd made the following modifications to build.py to get mingw to compile gifcatlib.dll on Windows:This generates the following output:Code: Select all
import os, sys, platform, string opt = { "compiler" : "gcc", "source" : "src/lua_bindings.c", "link" : "", "include" : "", "flags" : "-O2 -pedantic -Wall -Wextra -std=c99", "outfile" : "-o gifcatlib.dll", "define" : "", } template = "$compiler $outfile $source $include $link $flags $define" if platform.system() == "Windows": opt["flags"] += " [color=#FF0000]-llua[/color] -fpic -shared" opt["link"] += " -lws2_32" elif platform.system() == "Darwin": opt["flags"] += " -bundle -undefined dynamic_lookup" else: # Assume Linux, BSD etc. opt["flags"] += " -fpic -shared" print(string.Template(template).substitute(opt)) os.system(string.Template(template).substitute(opt)) [color=#FF0000]print(platform.system())[/color]
So the dll file is built. I altered gifcat.lua'sCode: Select all
$ python build.py gcc -o gifcatlib.dll src/lua_bindings.c -lws2_32 -O2 -pedantic -Wall -Wextra -std=c99 -llua -fpic -shared src/lua_bindings.c:1:0: warning: -fpic ignored for target (all code is position independent) /* ^ In file included from src/lua_bindings.c:31:0: src/jo_gif.c: In function 'jo_gif_quantize': src/jo_gif.c:88:18: warning: ISO C forbids empty initializer braces [-Wpedantic ] int bias[256] = {}, freq[256]; ^ src/jo_gif.c: In function 'jo_gif_lzw_encode': src/jo_gif.c:227:2: warning: missing initializer for field 'buf' of 'jo_gif_lzw _t' [-Wmissing-field-initializers] jo_gif_lzw_t state = {fp, 9}; ^ src/jo_gif.c:204:16: note: 'buf' declared here unsigned char buf[256]; ^ src/jo_gif.c: In function 'jo_gif_start': src/jo_gif.c:287:17: warning: ISO C forbids empty initializer braces [-Wpedanti c] jo_gif_t gif = {}; ^ src/jo_gif.c:287:2: warning: missing initializer for field 'fp' of 'jo_gif_t' [ -Wmissing-field-initializers] jo_gif_t gif = {}; ^ In file included from src/lua_bindings.c:31:0: src/jo_gif.c:28:8: note: 'fp' declared here FILE *fp; ^ Windows
and placed the dll and gifcat.lua in the base folder. My lua interpreter throws the following error: "Thread error!Code: Select all
local GIFLIB = "gifcatlib.dll"
gifcat.lua:188: %1 is not a valid Win32 application."
I'm not really sure what to do now. Any help?
Re: GifCat -- Write GIFs in LOVE.
Check also if you were cross-compiling for 32 bits in a 64 bit machine or vice versa. And I'd try also removing ".dll".
-
- Citizen
- Posts: 67
- Joined: Fri Mar 07, 2014 8:16 pm
Re: GifCat -- Write GIFs in LOVE.
Yeah, thats also a bizarro error message. Can you show me a unified diff of what you did to the build.py? I'm on mac so I have a limited amount of things that I can do.
-
- Prole
- Posts: 4
- Joined: Mon Dec 26, 2016 7:36 am
Re: GifCat -- Write GIFs in LOVE.
Since colours don't work in <code>, I added capitalised comments of the changes I made in braces to this post. I'm also building using Python 3.5. I'll also note that exclusion of makes no difference during the build.
Code: Select all
opt["link"] += " -lws2_32"
Code: Select all
#!/usr/bin/python2.7
import os, sys, platform, string
opt = {
"compiler" : "gcc",
"source" : "src/lua_bindings.c",
"link" : "",
"include" : "",
"flags" : "-O2 -pedantic -Wall -Wextra -std=c99",
"outfile" : "-o gifcatlib.dll (CHANGED OUTPUT TO .DLL FROM .SO)",
"define" : "",
}
template = "$compiler $outfile $source $include $link $flags $define"
if platform.system() == "Windows":
opt["flags"] += " -llua (ADDED LUA LINKER) -fpic -shared"
opt["link"] += " -lws2_32"
elif platform.system() == "Darwin":
opt["flags"] += " -bundle -undefined dynamic_lookup"
else: # Assume Linux, BSD etc.
opt["flags"] += " -fpic -shared"
print(string.Template(template).substitute(opt))
os.system(string.Template(template).substitute(opt))
print(platform.system()) -- DEBUGGING BY CHECKING OS
-
- Citizen
- Posts: 67
- Joined: Fri Mar 07, 2014 8:16 pm
Re: GifCat -- Write GIFs in LOVE.
You shouldn't need to link to lua. Why did you link it to Lua?
-
- Prole
- Posts: 4
- Joined: Mon Dec 26, 2016 7:36 am
Re: GifCat -- Write GIFs in LOVE.
Without that linker, I get the same undefined reference errors that PixelPiledriver was getting.
-
- Citizen
- Posts: 67
- Joined: Fri Mar 07, 2014 8:16 pm
Re: GifCat -- Write GIFs in LOVE.
I believe that error would've been solved by making it so the compiler could find lua.h. Not sure why -llua would fix that. IIRC I heard once that while you can link lua libraries to lua, you shouldn't.
-
- Prole
- Posts: 4
- Joined: Mon Dec 26, 2016 7:36 am
Re: GifCat -- Write GIFs in LOVE.
I was following this tutorial to see how to fix the undefined reference errors, and it adds -llua:
https://csl.name/post/lua-and-cpp/
https://csl.name/post/lua-and-cpp/
Who is online
Users browsing this forum: Bing [Bot] and 1 guest