Page 1 of 1

delegate libraries integration possible?

Posted: 2009-07-15T20:58:13-07:00
by neuviemep
Hi there,

Long story short: I compiled ImageMagick using MinGW to obtain Windows dlls (libMagickCore-2.dll and libMagickWand-2.dll) suitable for linking against when compiling my application with MinGW (which rejects dlls made with MSVC). Everything works great on my machine. When I copied the executables onto an another computer along with my precious dlls, I got an error with the program being unable to locate delegate libraries for any format. Upon looking at the library binaries, I found hardcoded references to "c:\mingw\lib\ImageMagick-6.5.1\...". Apparently, if this directory doesn't contain the libraries, the program will fail, they will not be found if located in the application directory, and no regard is paid to the MAGICK_HOME env variable. I will have a hard time requiring all my users to put the required libs in this location. Which brings me to the question: is it posible to get a single 'integrated' dll of IM, with some delegates statically included within? If not, then maybe I can get them without the hardcoded reference to c:\mingw, or point it somewhere else? Or are there any other possibilities?

Thanks.

Re: delegate libraries integration possible?

Posted: 2009-07-16T05:55:12-07:00
by magick
When you configure ImageMagick, add --disable-installed to your command line. Without it ImageMagick expects the configuration files to be in a fixed location.

Re: delegate libraries integration possible?

Posted: 2009-07-18T10:06:22-07:00
by neuviemep
That seems to have done the trick, in the sense that the MAGICK_HOME value is respected and searched before the hardcoded paths. But I didn't really know what was the correct way to distribute a custom-built shared library version if IM with an application (the first file to be opened was MAGICK_HOME/coders.xml, which normally resides in ImageMagick-n.n.n/config/). I didn't know what I was suposed to do, but I also tried --without-modules with configure and it seems to have done what I originally wanted - the files are opened correctly without the need for delegate libraries or anything else than the two .dlls. Does that mean that the dlls contain the delegate code within them, or is there some other caveat that I'm not aware of?

Re: delegate libraries integration possible?

Posted: 2009-07-18T11:22:14-07:00
by magick
The simplest install is to use the --disable-shared --disable-installed configure script options which makes a static build of the libraries. You then include the library and all the configuration files (*.xml) in the same folder as your application. ImageMagick should find everything it needs since it always checks the execution path for its configuration files. To verify type
  • convert -debug configure logo: logo.png

Re: delegate libraries integration possible?

Posted: 2009-07-20T01:53:25-07:00
by neuviemep
I got a little confused; does a 'static build' mean that the --disable-shared configure yields a single "big" .so/.dll that contains all necessary code within it (static linking used for generating a dynamically loaded library), or that it creates a version of the library meant for statically linking to (the created library is not dynamic)? Also, what does --without-modules actually do, then?

Thanks.