Compile/Link issues on MSYS2/MinGW-w64 of ImageMagick 7.0.3-4
Posted: 2016-11-03T06:20:51-07:00
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:
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:
Which indicate a problem, especially the pragma comment lib.
But the actual failure happens later:
I have to use mingw32-make.exe as make fails with:
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 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")
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