libvips / lua-vips

Lua binding for the libvips image processing library
MIT License
125 stars 10 forks source link

cannot load module 'libvips-42.dll' on Windows #54

Closed gVimer closed 1 year ago

gVimer commented 1 year ago

image image add the bin area of the libvips Windows build to PATH.Can you help me?

jcupitt commented 1 year ago

Hi,

I think you can use os.setenv("PATH", ...) in your code before starting FFI. Though I've not tested it.

gVimer commented 1 year ago

Thank you for your replay but there is no the method in os module image image I can use the VIPs command,This can indicate that I have set the environment variables correctly. image

gVimer commented 1 year ago

It still reported an error when using an absolute path to load image

jcupitt commented 1 year ago

Then it'll probably be one of the classic Windows linking issues. Either you're trying to mix 32- and 64-bit code, or you have a DLL clash on your path.

Look at your path carefully and make sure you only have one version of each DLL on the PATH variable.

gVimer commented 1 year ago

Thank you for your help and I Successfully solved this problem. Just let the Vips dll to be the first search path. image

jcupitt commented 1 year ago

Unfortunately this has probably broken some other software you have installed :(

The libvips BIN area includes a lot of common DLLs, such as libjpeg. If you have another package installed which also includes libjpeg.dll, and that older libjpeg.dll is not binary compatible with the one that libvips ships, that other package will no longer work.

It's safest not to change PATH, and instead set PATH in your program during startup.

Perhaps with https://stackoverflow.com/questions/41367667/set-shell-environment-variable-in-a-lua-5-3-script ?

gVimer commented 1 year ago

Ok,Thank you for your suggestion. I will try it out.