-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve build/install instructions for Windows #124
Comments
That would be very handy! |
The MSYS instructions worked! What a timing, just as I started to try to compile it on windows and have issues, you added the instructions. Thanks! |
Hi,
Of course we can. I believe MSYS2 support was added to address this use case: Some application needs to be released on multiple platforms, and may require a custom build of ImageMagick. Unfortunately ImageMagick uses separate instructions to build natively on Windows and it looks complicated, in this case, using MSYS2 is preferable. |
The following may be helpful for someone trying to build this crate against MSYS2. As other Unix-like environments, there are two approaches for MSYS2:
Please note that the order in |
Also, after I built a rust project with this library, it works fine when its run from the MSYS2 MINGW64 shell. But running a compiled executable directly without the mingw64 envirenment (just running it from CMD.exe for example) causes Maybe something about shipping the executable on windows should be added to INSTALL.md, since you cannot just ask users to "sudo apt install libeverthing-thats-needed", windows has a funny way of installing software :) and just putting all dlls in the same folder as the .exe doesn't seem to work (it gives errors like the one I have with PNGs not opening) |
@5ohue The env variable is |
@nlfiedler I think I found a way to compile, run and destribute an application that uses magick-rust. It requires using MSYS2 to compile, but the final executable doesn't require users to install anything additional. Here's how it worked for me:
$env:PATH = "C:\msys64\usr\bin;C:\msys64\mingw64\bin;$env:Path"
$env:IMAGE_MAGICK_DIR = "C:\msys64\mingw64"
$env:IMAGE_MAGICK_INCLUDE_DIRS = "C:\msys64\mingw64\include\ImageMagick-7"
$env:IMAGE_MAGICK_LIB_DIRS = "C:\msys64\mingw64\lib"
$env:IMAGE_MAGICK_LIBS = "libMagickCore-7.Q16HDRI.dll.a;libMagickWand-7.Q16HDRI.dll.a"
So basically I copied all the DLL files and executable to |
Using The Windows-specific repo for ImageMagick and going through the process to see the eventual build scripts may help us get to a static lib. That'd solve most if not all of the issues here I think? |
The existing instructions are not adequate to build this crate on Windows. I will soon submit a change that helps, but still isn't completely satisfying because one of the bindings unit tests fails (size of long double). I'm hoping someone like @gyk can offer some insight. Questions I have:
IMAGE_MAGICK_INCLUDE_DIRS
to include the path tomm_malloc.h
because without that, the build fails to find that header file. This is unlike on other platforms, which is why I wonder if I'm doing something wrong.INSTALL.md
file, if those need fixing, please let me know.Hoping someone who knows Windows better than I (who only really uses it for video games) can help.
Other concerns I have: can we possibly build this crate on Windows without introducing a Unix-like environment? For instance, using the Visual Studio Installer should suffice, but it installs a 32-bit version of Clang, which is like WTF. Hard to image how people use Windows for anything other than C# development.
The text was updated successfully, but these errors were encountered: