Compile/Link issues on MSYS2/MinGW-w64 of ImageMagick 7.0.3-4

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Emilyl
Posts: 2
Joined: 2016-11-03T06:08:48-07:00
Authentication code: 1151

Compile/Link issues on MSYS2/MinGW-w64 of ImageMagick 7.0.3-4

Post by Emilyl »

I'm having trouble with compiling and linking ImageMagick under the MSYS2 (http://msys2.github.io/) environment using MinGW-w64 compiler. Here are the steps I've taken:

Code: Select all

git clone https://github.com/ImageMagick/ImageMagick.git
git checkout 7.0.3-4
./configure --prefix=/mingw64/ --disable-deprecated --disable-openmp --without-fontconfig --without-threads --without-perl --enable-shared --enable-static=no --with-modules --without-x --without-freetype && mingw32-make.exe -j8
I'm building for integration in a JNI library where IM is only used for loading images so I want to minimize dependencies, hence disabling stuff.

I get a lot of warnings during compilation:

Code: Select all

./MagickCore/nt-base.h:32:0: warning: "_CRT_SECURE_NO_DEPRECATE" redefined
./MagickCore/nt-base.h:98:0: warning: "MAGICKCORE_HAVE_ERF" redefined
./MagickCore/studio.h:129:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment (lib, "ws2_32.lib")
Which indicate a problem, especially the pragma comment lib.

But the actual failure happens later:

Code: Select all

  CCLD     MagickCore/libMagickCore-7.Q16HDRI.la
MagickCore/.libs/MagickCore_libMagickCore_7_Q16HDRI_la-distribute-cache.o: In function `ConnectPixelCacheServer':
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:221: undefined reference to `__imp_getaddrinfo'
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:228: undefined reference to `__imp_socket'
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:237: undefined reference to `__imp_connect'
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:246: undefined reference to `__imp_recv'
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:262: undefined reference to `__imp_freeaddrinfo'
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:259: undefined reference to `__imp_closesocket'
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:232: undefined reference to `__imp_freeaddrinfo'
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:240: undefined reference to `__imp_closesocket'
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:241: undefined reference to `__imp_freeaddrinfo'
MagickCore/.libs/MagickCore_libMagickCore_7_Q16HDRI_la-distribute-cache.o: In function `dpc_send':
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:454: undefined reference to `__imp_send'
MagickCore/.libs/MagickCore_libMagickCore_7_Q16HDRI_la-distribute-cache.o: In function `DistributePixelCacheClient':
D:\work_java\ImageMagick/MagickCore/distribute-cache.c:825: undefined reference to `__imp_recv'

I have to use mingw32-make.exe as make fails with:

Code: Select all

$ make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /d/work_java/ImageMagick/config/missing autoconf
sh: gitversion: command not found
' is already registered with AC_CONFIG_FILES.
../../lib/autoconf/status.m4:288: AC_CONFIG_FILES is expanded from...
configure.ac:3821: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
make: *** [Makefile:5163: configure] Error 1
Emilyl
Posts: 2
Joined: 2016-11-03T06:08:48-07:00
Authentication code: 1151

Re: Compile/Link issues on MSYS2/MinGW-w64 of ImageMagick 7.0.3-4

Post by Emilyl »

Note, apparently MSYS2 team is maintaining a patchset for MinGW-w64 compilation:

https://github.com/Alexpux/MINGW-packag ... magemagick

Could parts of this be merged upstream?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Compile/Link issues on MSYS2/MinGW-w64 of ImageMagick 7.0.3-4

Post by magick »

We recently compiled ImageMagick 7 under MSYS2/MinGW-w64 without the need for patches. We make another attempt to confirm and report back in a few days.
JPeterMugaas
Posts: 1
Joined: 2016-11-07T05:52:24-07:00
Authentication code: 1151

Re: Compile/Link issues on MSYS2/MinGW-w64 of ImageMagick 7.0.3-4

Post by JPeterMugaas »

magick wrote:We recently compiled ImageMagick 7 under MSYS2/MinGW-w64 without the need for patches. We make another attempt to confirm and report back in a few days.
I think there is more to this than simply compiling it. Part of this is that you might want to run ImageImagick programs from the command line, a bash script, or sometimes as part of a build process. In MSYS2, paths are specified more like they would be in Unix than Windows and there is a Unix-like File System HIerarchy. Arguably, there's actually three hierarchies each with their own individual toolchains.

/mingw32 - lib/ include/ bin/ etc/ source/ share/ and a few other things. Those are for MINGW 32-bit development. Native Win32 .exe and .dlls are an end-goal
/mingw64 - lib/ include bin/ etc/ source/ share/ and a few other things. Those are for MINGW 64-bit development. Native Win32 .exe and .dll's are an end-goal.
/usr /etc /include /lib /dev /proc - The MSYS2 environment and stuff for building this environment and it's components.

There was a bug recently that caused ImageMagick not to locate some image modules. See: https://github.com/Alexpux/MINGW-packages/issues/1885 . The package was building coders in something "mingw32/lib/ImageMagick-7.0.3/modules-Q16HDRI/coders/". There was also abug that had to do with the strings namespace that had to be solved with a patch.
Post Reply