nlfiedler / magick-rust

Rust bindings for ImageMagick
https://crates.io/crates/magick_rust
Apache License 2.0
246 stars 63 forks source link

how to use with image magick installed with MSYS2 #77

Open Xephobia opened 3 years ago

Xephobia commented 3 years ago

Hello, I am on Windows and use the gnu toolchain for multiple reasons, but when I try to compile I get this panic :

thread 'main' panicked at 'ImageMagick libdirs at `["D:/msys/mingw64/bin/../lib"]` do not contain the required files to either statically
or dynamically link ImageMagick', D:\.cargo\registry\src\github.com-1ecc6299db9ec823\magick_rust-0.14.0\build.rs:220:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

How can I fix this?

nlfiedler commented 3 years ago

Did you try setting IMAGE_MAGICK_DIR or any of the related settings described in the README? That would be the first thing I would try. Otherwise, I don't know as I have never tried using the GNU toolchain. But that doesn't mean you shouldn't ask, I'll try to help as best I can.

Xephobia commented 3 years ago

the msys2 "emulates" an unix/linux file structure, there is some files located on /bin and some on /lib

Xephobia commented 3 years ago

i could try specifying with IMAGE_MAGICK_LIB_DIRS but there is an : after the disk name

MolotovCherry commented 2 years ago

I'm getting this error on Windows using MSVC, and I set IMAGE_MAGICK_LIBS, IMAGE_MAGICK_DIR, and even IMAGE_MAGICK_LIB_DIRS. Even though the lib dir was pointing to the exact dir containing the file it was trying to link to (I checked the output), for some reason it's "not found"

Edit:: Got it to work cross compiling to Android by setting appropriate env vars. Setting appropriate Windows env vars still fails to build

I do want to note though that now it's not getting stuck at "does not contain the required files", but is now getting stuck at linking with "error LNK2019: unresolved external symbol SetMagickResourceLimit"

liyunde commented 2 years ago

this error reproduce on windows10 magick_rust: 0.15,0.16.0 rustc:1.61.0 lib:ImageMagick-7.1.0-Q16-HDRI Community2019\VC\Tools\MSVC\14.29.30133

note: libmagick_rust-ee64cd36e16e1432.rlib(magick_rust-ee64cd36e16e1432.magick_rust.a42cf69e-cgu.1.rcgu.o) : error LNK2019: unresolved external symbol SetMagickResourceLimit referenced in function _ZN11magick_rust4wand6magick10MagickWand18set_resource_limit17h78a39bf86e3801fdE target\debug\deps\rust_microservice.exe : fatal error LNK1120: 1 unresolved externals

error LNK2019: unresolved external symbol SetMagickResourceLimit referenced in function _ZN11magick_rust4wand6magick10MagickWand18set_resource_limit17hae73b655b83b1af0E

same code buid pass on centos7,centos8