libvips / build-win64-mxe

76 stars 15 forks source link

Use ImageMagick 7 or GraphicMagick #41

Closed swdmnd closed 2 years ago

swdmnd commented 2 years ago

Is it possible to build this using ImageMagick 7 or GraphicMagick?

kleisauke commented 2 years ago

To build against ImageMagick 7, you can remove this override: https://github.com/libvips/build-win64-mxe/blob/50edec409a6bfaf4f34300966dfdb2cc131b53a3/build/overrides.mk#L41-L45

To build against GraphicsMagick, you can replace imagemagick with graphicsmagick in vips-all_DEPS: https://github.com/libvips/build-win64-mxe/blob/50edec409a6bfaf4f34300966dfdb2cc131b53a3/build/vips-all.mk#L11-L14

And use --with-magickpackage=GraphicsMagick while configuring libvips. This is now done automatically, see: https://github.com/libvips/build-win64-mxe/blob/8f930b90e7a02b279ae2b8b9093ff7128a418726/build/vips-all.mk#L89

swdmnd commented 2 years ago

Thank you for your guide. I have tried building against GraphicsMagick.

However, there is a linker error during building GraphicsMagick:

ld.lld: error: undefined symbol: xmlNanoFTPNewCtxt
>>> referenced by coders/.libs/magick_libGraphicsMagick_la-url.o:(ReadURLImage)

ld.lld: error: undefined symbol: xmlNanoFTPConnect
>>> referenced by coders/.libs/magick_libGraphicsMagick_la-url.o:(ReadURLImage)

ld.lld: error: undefined symbol: xmlNanoFTPGet
>>> referenced by coders/.libs/magick_libGraphicsMagick_la-url.o:(ReadURLImage)

ld.lld: error: undefined symbol: xmlNanoFTPClose
>>> referenced by coders/.libs/magick_libGraphicsMagick_la-url.o:(ReadURLImage)

I have tried adding libxml2 libxml2-dev to Dockerfile, but it still produces this error. How do I solve this error?

kleisauke commented 2 years ago

It looks like that was fixed with commit https://sourceforge.net/p/graphicsmagick/code/ci/e05b8a44b22780e58bbe41127c703f3c37792538/.

I just updated and fixed the GraphicsMagick build with commit https://github.com/libvips/build-win64-mxe/commit/8f930b90e7a02b279ae2b8b9093ff7128a418726.

swdmnd commented 2 years ago

Thank you, I have successfully built with gm.

Now I'm trying to build against ImageMagick 7, and it gives me this error:

checking if libltdl package is complete... no
configure: error: in `/data/mxe/tmp-imagemagick-x86_64-w64-mingw32.shared.posix.all/ImageMagick-7.0.8-63.build_':
configure: error: libltdl is required for modules and OpenCL builds

and it seems the version is quite old.

kleisauke commented 2 years ago

I think upgrading ImageMagick to the latest version should fix that.

--- a/build/overrides.mk
+++ b/build/overrides.mk
@@ -38,11 +38,10 @@ matio_SUBDIR   := matio-$(matio_VERSION)
 matio_FILE     := matio-$(matio_VERSION).tar.gz
 matio_URL      := https://github.com/tbeu/matio/releases/download/v$(matio_VERSION)/$(matio_FILE)

-# upstream version is 7, we want ImageMagick 6
-imagemagick_VERSION  := 6.9.12-44
-imagemagick_CHECKSUM := 89ac50d50762285a4aea57c0f5b01b4fe1584fc37e1f90314390a47d73393064
+imagemagick_VERSION  := 7.1.0-29
+imagemagick_CHECKSUM := 889be185fd17a9b9b3d4090e28aecdec289a4f690964a7964b4f893c7a8ec21c
 imagemagick_PATCHES  := $(realpath $(sort $(wildcard $(dir $(lastword $(MAKEFILE_LIST)))/patches/imagemagick-[0-9]*.patch)))
-imagemagick_GH_CONF  := ImageMagick/ImageMagick6/tags
+imagemagick_GH_CONF  := ImageMagick/ImageMagick/tags

 # alternatively, one could build libvips with GraphicsMagick
 # upstream version is 1.3.36
swdmnd commented 2 years ago

Successfully built.

Though magickload doesn't behave exactly the same as installed imagemagick 7, but I guess it's on the libvips. Thanks again for your help!