Closed stuta closed 7 years ago
thumbnail
is an 8.5 feature -- it won't work in earlier versions.
Did the w64 binary here not work?
https://github.com/jcupitt/libvips/releases
That's the one that node on Windows uses, it should work, I think.
No, those binaries do not work, same error.
Hmm, that's very strange, it sounds like it's almost working. Perhaps it has not initialised correctly?
Could you turn on logging and mail the output for new_from_file
? Add vips.log.enable(true)
before you call the function.
Sure, your code to load the DLLs would be great -- please open a PR or mail a patch.
I did send you mail about my load code, you need to change it a little bit.
calling operation: VipsForeignLoadJpegFile passed: table: 0x00397938 { [1] => "vips_images/Gugg_coloured.jpg" }
vobject.set self = cdata<struct _VipsObject *>: 0x004c8000 name = filename value = vips_images/Gugg_coloured.jpg
error: 'field filename does not exist' [stack traceback: ../lib/start.lua:250: in function 'error' ../lib/vips/vobject.lua:167: in function 'set' ../lib/vips/voperation.lua:218: in function 'new_from_file' vips_test.lua:53: in main chunk [C]: at 0x00402040]
(.:54): GLib-GObject-WARNING : gtype.c:4264: type id '0' is invalid
(.:54): GLib-GObject-WARNING : can't peek value table for type '
Strange, it seems it's maybe not initialising correctly.
Could you turn on logging at the very beginning and attach the output? Maybe there is a little more information we can find.
This is the first line of code: local main = vips.Image.new_from_file(path.."Gugg_coloured.jpg"). I did turn log on before other files require, but it did not print anything before vips.Image.new_from_file().
Maybe you need to get you win install to work - did you get my email? This works nicely in wine, but I did test also with win7.
I'll have a go in wine. Yes, I had your mail, thank you.
I made some progress, I think. I used the luapower all-in-one to get a 64-bit Windows LuaJIT build:
https://luapower.com/
LuaJIT on Windows searches PATH
to find DLLs. You can't set this directly from Linux, you have to change the registry. See:
https://www.winehq.org/docs/wineusr-guide/environment-variables
Then add the bin
area of the libvips Windows build to PATH
. For example:
z:\home\john\GIT\build-win64\8.5\vips-dev-8.5\bin
You must have no trailing backslash.
Then in LuaJIT:
$ ~/packages/luajit/luapower-all-master/bin/mingw64/luajit.exe
LuaJIT 2.1.0-beta2 -- Copyright (C) 2005-2016 Mike Pall.
http://luajit.org/
JIT: ON SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
> print(os.getenv("PATH"))
C:\windows\system32;C:\windows;C:\windows\system32\wbem;z:\home\john\GIT\build-win64\8.5\vips-dev-8.5\bin
> ffi = require "ffi"
> ffi.load("libvips-42.dll")
> ^D
So the DLL at least seems to all load. I'll see if I can get vips.lua
to load next.
I've fixed a few small things in lua-vips master and it seems to work now, at least under Wine:
john@mm-jcupitt5 ~/GIT/lua-vips/src (master) $ ~/packages/luajit/luapower-all-master/bin/mingw64/luajit.exe
LuaJIT 2.1.0-beta2 -- Copyright (C) 2005-2016 Mike Pall. http://luajit.org/
JIT: ON SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
> vips = require "vips"
> x = vips.Image.new_from_file("z:\\data\\john\\pics\\k2.jpg")
> print(x:width())
1450
>
I've not tried the test-suite. There are some more notes in the README.
Now 64 bit works, but previously working 32 bit does not. Maybe you have to do different defines or compile more new 32 bit libs.
I think it's the uint64_t
for the gtype.
Is there an easy way for Lua to tell if it's 64-bit or 32-bit? I suppose we need something like this early on:
if ffi.os == "Windows" and ffi.size == 32 then
ffi.cdef[[
typedef uint32_t GType;
]]
else
ffi.cdef[[
typedef uint64_t GType;
]]
end
Then declare functions that operate on GType
as:
ffi.cdef[[
void g_value_init (GValue* value, GType type);
]]
if ffi.arch == "x64" then
vips.Image.text() does not work because x64 binaries do not have libpangoft2, 32 binaries do have libpangoft2-1.0-0.dll.
Propably you need to change: local gobject = ffi.load(ffi.os == "Windows" and "libgobject-2.0-0.dll" or "gobject") => local gobject = ffi.load(ffi.os == "Windows" and "libgobject-2.0-0.dll" or "vips")
In OSX and Linux vips lib contais references to all commands (I'm using my own loader, I did not test this).
I've been working on text()
support on Windows, this build seems to work, at least on win7:
http://www.rollthepotato.net/~john/vips-dev-w64-web-8.5.6-1.zip
I've not got it working under Wine, I must be missing some env var that needs setting or unsetting.
Thanks! I've pushed some more changes, it works on linux and (I think) 64-bit Windows. 32-bit Windows might work.
Getting closer. x64 works except vips.Image.text("Hello <i>World!</i>", {dpi = 300})
crashes.
I think I had error when copying your files. Now 32 bit win crashes without any error messages.
Earlier version worked fully so it has to be something that went wrong in Lua files when trying to fix x64 version.
I'm getting very confused :(
Could you change this:
-- 32-bit Windows 32-bit ints for gtype, it's 64-bit everywhere else
if ffi.os == "Windows" and ffi.arch ~= "x64" then
ffi.cdef[[
typedef uint32_t GType;
]]
else
ffi.cdef[[
typedef uint64_t GType;
]]
end
to be:
-- 32-bit Windows 32-bit ints for gtype, it's 64-bit everywhere else
if ffi.os == "Windows" and ffi.arch ~= "x64" then
ffi.cdef[[
typedef unsigned long int GType;
]]
else
ffi.cdef[[
typedef uint64_t GType;
]]
end
Which is what we had when 32-bit was working. Though they should be the same, I'd think. Strange!
I'll try text
here under 64-bit wine.
No change. Text works in 32 bit but vips.Image.new_from_file crashes. Make a diff to old version, there must have been other changes too.
Hi again, I found an error! Linux and 64-bit Windows (under Wine) seem to work fine, could you test 32-bit Windows?
Now 32-bit Windows works in wine and win7. 64-bit Windows (osx wine + win7) crashes on text, but thumbnail and new_from_file works.
Is it possible to get new 32 bit windows compilation? Ypu can use pacman to get most of dll's already compiled.
pacman -S mingw32/mingw-w64-i686-cairo pacman -S mingw64/mingw-w64-x86_64-cairo
What error do you see for text?
Could you try this test build:
http://www.rollthepotato.net/~john/vips-dev-w64-web-8.5.6-1.zip
That one works for me on win7. I can run vips.exe x.png hello
in a terminal and get some text rendered. Under Wine it seems to get confused and just draws white boxes, but it does work on win7.
I've had a go at an updated 32-bit Windows build:
http://www.rollthepotato.net/~john/vips-dev-w32-all-8.5.6.zip
It might work!
Win 32 is ok (thumbnail works also), but text does not work beause libpangoft2-1.0-0.dll is missing. Win 64 works except text that crashes.
I changed load order and disabled old libraries. Now Win 64 works, text, thumbnail and file! So only 32 bit libpangoft2-1.0-0.dll is missing.
I'll see if I can find the missing DLL.
I found a missing dependency, try again:
http://www.rollthepotato.net/~john/vips-dev-w32-all.8.5.6-1.zip
Yes, now win 32 & 64 bit works. Also osx 64 and linux 64 works. Thanks a lot!
Here is extra that are in win 32, but not in win 64. if ffi.arch == "x86" then util.loadDll("graphics/libopenjp2.dll") util.loadDll("graphics/libmatio-4.dll") util.loadDll("graphics/libpoppler-63.dll") util.loadDll("graphics/libpoppler-glib-8.dll") util.loadDll("graphics/libMagickCore-6.Q16-2.dll") util.loadDll("graphics/libMagickWand-6.Q16-2.dll") util.loadDll("graphics/libsqlite3-0.dll") util.loadDll("graphics/libopenslide-0.dll") end
That's great!
Yes, that win32 build includes a lot of dangerous extra stuff, I wouldn't use it for untrusted files. The 64-bit one is just using fairly well secured libraries, and has been tested with AFL.
What happens if you don't load those DLLs explicitly? It seems to work for me without these extra load lines.
You have to load them or libvips-42.dll will not load.
This is great tool (works well under wine): http://www.dependencywalker.com
Hello. I was able to get win32 version to work wirh these libs: http://www.vips.ecs.soton.ac.uk/supported/8.1/win32/.
Win64 version does not work with those binaries or binaries from http://www.vips.ecs.soton.ac.uk/supported/8.4/win32/.
local main = vips.Image.new_from_file(path.."Gugg_coloured.jpg")
error: 'field filename does not exist' [stack traceback: ../lib/start.lua:250: in function 'error' ../lib/vips/vobject.lua:167: in function 'set' ../lib/vips/voperation.lua:218: in function 'new_from_file' vips_test.lua:53: in main chunk [C]: at 0x00402040] (.:2896): GLib-GObject-WARNING : gtype.c:4264: type id '0' is invalid (.:2896): GLib-GObject-WARNING : can't peek value table for type '' which is not currentl
y referenced
(.:2896): GLib-GObject-WARNING **: gvalue.c:188: cannot initialize GValue with type '(NULL)', this t
ype has no GTypeValueTable implementation
I can send my code to load dll's, it was not an easy task to get everything to load. vips.Image.thumbnail does not work with any windows version, but other examples do work.