|
From: | Mark Brand |
Subject: | Re: [Mingw-cross-env-list] Problems with linking a simple MagickWand using program |
Date: | Thu, 27 Sep 2012 11:49:27 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120904 Firefox/15.0.1 SeaMonkey/2.12.1 |
Nick White wrote:
Hi, I recently found mxc, and it looks great. I want to use it to compile windows versions of a few very small applications of mine; the .c tools here: http://www.dur.ac.uk/nick.white/tools/ However, the two which use MagickWand ('boxer' and 'lazytrain') are having problems linking. I was suprised to find that (seemingly) just providing the appropriate pkg-config --cflags --libs MagickWand commands doesn't seem to provide all that gcc needs (as it does when compiling natively.) So when I try to build boxer.c from http://www.dur.ac.uk/nick.white/tools/boxer.c I use the following command: i686-pc-mingw32-gcc `i686-pc-mingw32-pkg-config --cflags MagickWand` boxer.c -o boxer `i686-pc-mingw32-pkg-config --libs MagickWand` But there are *a lot* of undefined references. Some of them I could correct by guessing extra -l arguments, but not all, and I presume there's something simple and basic that I'm failing to grasp. I'll attach the output of running the above command. Any advice would be most happily received.
Hi Nick,One problem is that the .pc files installed by MagickWand don't include the dependencies necessary for static linking For many packages in MXE, we've patched the .pc files where necessary, but this hasn't been done here. That means that you have to figure out which libraries are needed. A good clue is the in the DEPS list at the top of the .mk file. You might end up with something like this:
i686-pc-mingw32-g++ -fpermissive boxer.c `i686-pc-mingw32-pkg-config --cflags --libs MagickWand MagickCore freetype2 libpng libmng libtiff-4 OpenEXR IlmBase` -lfftw3 -llcms2 -ljasper -ljpeg -lpthread -ltiff -llzma -lz -lpng -lgdi32 -o boxer
You might have to experiment to get the order right.However, there is another problem. Libmng depends on lcms1 but lcms2 is introduced somewhere else. This leads to symbol conflicts for static linking. You can work around this by eliminating libmng support, if you can, or by rebuilding libmng without lcms, which is pretty easy. You should be able to remove MNG_FULL_CMS from the src/libmng.mk file.
Mark
[Prev in Thread] | Current Thread | [Next in Thread] |