From: Arthur Bergman Date: 12:06 on 12 Aug 2003 Subject: ImageMagick, AIX, dynamic linkers and other evil stuff. So, work is moving from Linux to AIX, a move that seems opposite to what everyone is doing! (Maybe it is because we really want to set us up for a fight with SCO :). The reasons are sound, Linux cannot do 64bit clustered filesystems, it would be fine if it wasn't for the GODAMN ANAL LINKER that AIX uses! So off to Google, search around, see that even IBM says, use gcc (they ship it with AIX) and the Linux compatibility mode. So we compile using gcc, but THAT DOES NOT HELP because it is not xlc (note, xlC and xlc are different things, one is a c and another is a c++ compiler, and both are really named vac, or something, I still don't get it) that is giving us a headache, but rather the goddamn linker. So we use the shipped gnu ld which promptly tells us that linking on AIX is horrible broken and quits. In the end, after reading a thousand pages of manuals we find the -G option that you give to libraries to make them runtime linkable, however, the fucking idiotic m4 mess that is called autoconf tries to use the LDFLAGS to build it's sample test application, passes it a -G which makes xlc/ld complain since you ARE NOT BUILDING A LIBRARY BUT AN APPLICATION. So off I go and find which flags I do need. It turns out to be: CC=xlc LDFLAGS='-brtl -bnortllib -bautoexp -bM:SRE' If you wonder why I had to do CC=xlc, it is because otherwise it picks up cc which is like xlc (xlc uses it's invocation name to change parameters, so there is cc cc_r cc128 cc128_r xlc_r xlc_r4 you get the fucking idea), but with a weird modified ANSI command set. (using 'cc' gives us a freaky internal compiler error) So, now we are building, make checks works, do you think the PerlMagick thing works, NOOOOOOOOOOOOO of course not. It gets a freaky cannot find WriteOneJNGImage, so digging around a bit. JNG is PNG images using JPEG compression, but we have both libjpeg and libpng enabled... hmm...!!! No turns out libjpeg is not compiled into imagemagick because of asshole autoconf m4 shitty backwards mess. PLEASE MAKE AUTOCONF GO AWAY PLEASE DO NOT SHIP AUTOCONF WITH YOUR APP See, libjpeg hasn't been updated since 98, so it ships with a really old autoconf, now that makes a jconfig.h that stupidly is all the configure script managed to find, in this is the line #define HAVE_STDLIB_H However, it seems like modern configures write in thier config.h #define HAVE_STDLIB_H 1 Now, this is fine if you are gcc, but picky xlc says that I cannot redefine HAVE_STDLIB_H and makes configure go crap out and then it disables libjpeg. Ok, fine, but why does this break. Because the png delgate has #ifdefs around the WriteJNG code, but no #ifdefs protecting the USE of these functions. Lesser lds like GNU ld don't care, however AIX ld craps out because it cannot find this function anywhere it looks, and it craps out. So the solution was to patch libpjeg jconfig.h, add the weird LD flag options, then compile it using shared and VOILA everything worked. Amazingly no one has documented this on the web before, so that is why I am putting in the words How to compile build and link ImageMagick on AIX And please, just shoot m4. sky
Generated at 10:26 on 16 Apr 2008 by mariachi