# ImageMagick tomfoolery



## Iritscen (May 26, 2006)

Sigh.  I am not used to feeling this stupid.  I'm no genius, mind you.  I'm a long-time Mac user, a fairly long-time programmer, but I'm still pretty CLI-illiterate.

All I wanted to do was use Inkscape.  Inkscape is a great program, but I really need to be able to open .ai files, and I believe I read somewhere that it relies on ImageMagick.  So I d/led IM 6.2.7, compiled and installed it, and used "make check" immediately after, as recommended.  It failed 47 of the tests (I have the results if anyone is interested, it's mostly Greek to me, and a *lot* of Greek at that).

It looked, though, like I just might not be able to handle certain formats, and I could still run it.  But when I try a command, such as "display [whatever.jpg]", it says "Unable to start 'X' Server".

Isn't that the same thing as X11, the XWindows server?  I use X11, and it works fine.  What's not working right here?


----------



## nixgeek (May 26, 2006)

For this particular situation, you might have to manually launch X11.  Some apps that require X11 on the Mac will automatically launch X11 if they were provided as binary apps.  But since you compiled this yourself, you might not have included the option to do that.  Try launching it with X11 already running and see if that works.


----------



## Iritscen (May 26, 2006)

*grimaces* I already tried that.  It just doesn't notice that X11 is open.  Interestingly, the X11 app lists "ImageMagick" in its menu along with "xman" and "xlogo".  Selecting it simply does nothing.

It's entirely possible that I compiled it wrong.  I mean, I simply followed the standard process of ./configure, make, make install.  But all that stuff about custom options to use when building was beyond me.

I may have made a mistake in installing ImageMagick twice, although I don't think that's the cause of the problem.  But the first version I compiled myself and is installed in _/usr/local/bin_.  The second version was precompiled (http://www.imagemagick.org/download/binaries/ImageMagick-powerpc-apple-darwin8.6.0.tar.gz), and the binaries are still in the ImageMagick folder.  I added the path _/Applications/Graphics/ImageMagick-6.2.7/bin_ to my bash shell and verified that it is part of the $PATH variable, but I don't think I should have both copies installed.  I don't actually know which is being called upon when I use the "display" command, or any other.  Perhaps I should uninstall the _/usr/local/bin_ version and see if it then uses the other version, and whether that version works.

Is there a recommended way to remove those binaries?  Does "make distclean" do that, or does that just remove built products in that folder?


----------



## nixgeek (May 26, 2006)

To remove what you compiiled all you need to do is type "make uninstall" from within the directory you compiled it from.  This is the way I've done it under Linux.


----------



## Iritscen (May 26, 2006)

Well, that's logical 

I'll try it tonight and replace this post with the results when I get back here (probably next Tuesday, maybe tomorrow).  We'll see if the other install works any better.


----------



## nixgeek (May 26, 2006)

Keep us posted...


----------



## Iritscen (Jun 1, 2006)

Okay, now I'm using the build that came directly from the ImageMagick site, and when I do this:

*me$ ./display -help*

(or try to open a file with the display command)

I get this:

*dyld: Library not loaded: /ImageMagick-6.2.7/lib/libMagick.10.dylib
  Referenced from: /Applications/Graphics/ImageMagick-6.2.7/bin/./display
  Reason: image not found
Trace/BPT trap*

I'm not even loading an image with the -help option!  I guess the real problem is that the libraries aren't "loaded".  So, what does that mean, exactly?  And why does this remind me unpleasantly of Windows? ::evil::


----------



## nixgeek (Jun 1, 2006)

You might want to give DarwinPorts a try.  It's basically the Ports system ported  over to Darwin (the UNIX-y part of Mac OS X).  From here, you might have better luck getting ImageMagick installed along with all the dependencies.

As for it reminding you of Windows, remember that you're dealing with a Unix source package, not a Mac OS binary application, so things will get hairy as they tend to when compiling from source (this also happens in Linux and other Unix operating systems).  As an example, there's a Cocoa port of GIMP called Gimp.app that I use and it works flawlessly.  It even launches X11 for me and everything.  Now, I have no need to compile it from source or download it from a repo like DarwinPorts or Fink.  It just works, just like a Mac application should.

Since we're on the topic of binaries, on the ImageMagick website I found a section for binary versions.  One of which is for Mac OS X  (_ImageMagick-powerpc-apple-darwin8.6.0.tar.gz_) and further down the page there are instructions on what variables need to be changed on your Mac OS X installation.

http://www.imagemagick.org/script/binary-releases.php

Give those a try and see if any of those work for you.


----------



## Iritscen (Jun 2, 2006)

I had originally set those variables, I think, but since then I've "moved" ImageMagick by uninstalling the old binaries and using the ones in my Applications folder.  So I need to reset those variables.  Thanks for pointing that out, it may solve the problem.


----------



## Iritscen (Jun 6, 2006)

Okay, it finds the libraries now, but it still says "Can't start 'X' server" when I try to run an ImageMagick binary.

Is it failing to find the X11 app or something?


----------



## nixgeek (Jun 6, 2006)

It's possible.  Have you manually launched the X server before running ImageMagick as a test?


----------



## Iritscen (Jun 6, 2006)

If by "X server" you mean X11.app, then yes.

If you mean something else, then no. )

I was researching the "X server" from the command line, and noticed a couple commands -- I'm not there now, but I think one was "xdm", and the other was "open-x11", which supposedly can be passed a binary to run in the X11 environment.  I wasn't sure exactly what to do with xdm, as the man page assumes you already know what you're doing, and open-x11 doesn't even know what command I'm talking about when I say "open-x11 display".


----------



## nixgeek (Jun 6, 2006)

I should have been a little clearer on that.  I did mean "X11." 

Xdm is the X11 Login Manager.  Here's what it looks like on a Debian system:







As for "open-x11", see this:

http://www.hmug.org/man/1/open-x11.php


----------



## Iritscen (Jun 7, 2006)

Ah, that login screen is familiar, I called up a variant called XFree86 on my Mac.  It wanted me to login, so I entered my OS X username and password for lack of anything else and it refused to recognize me.  I had a heck of a time closing it.

I've read that man page to open-x11, but it either doesn't work with ImageMagick commands or I failed to pass it "display" properly.  However, that site you linked me to has some impressive information on it.  They have the latest version of ImageMagick, which may or may not work better, and *all* the dependencies are listed and available for download on the site: http://www.hmug.org/pub/MacOS_X/X/Applications/Graphics/ImageMagick.  Pretty cool.  I'm going to use these copies of the software and see how it works.  I always knew I was missing some of the dependencies anyway.


----------



## Iritscen (Jun 14, 2006)

Well, I think I downloaded half the Internet and installed it over the last week.  That may be a slight exaggeration, but it feels like it.

I installed a ton of dependencies I didn't have before, and it seems to have cleared up nearly all the problems that ImageMagick reports when it tests itself.  I still have to install a couple more libraries, but it's already reporting that it's 99% fine.

But, it still says "Can't open 'X' server."



Clearly there's a broken link somewhere.


----------



## nixgeek (Jun 14, 2006)

I applaud you for your patience through all of this.  Man, I would have quit days ...WEEKS ago.  I think you deserve my mahogany bicycle clip. ::ha::

Hopefully once you clear out the remaining 1% of deps you won't get that message anymore.  I'm clearly at a loss for solutiions at this point.


----------



## Iritscen (Jun 14, 2006)

I appreciate your help, though, nixgeek; you'd think the readme for ImageMagick would be clearer about all its dependencies.

I found a forum or two devoted to Inkscape where I can look for Mac users and see if they can help.  If I find out anything, I'll post it back here.


----------



## nixgeek (Jun 14, 2006)

Yeah, when I saw the ImageMagick documentation and files I had to wonder if they were really doing Mac OS X users a service.   I was just a mess for me to even continue trying to get it to work.

The only other thing I can think of is maybe there aren't any records of symlinks to whatever ImageMagick needs to find the X11 server.  I don't remember exactly where that would be...I think it's in /etc/profile but I'm not sure.

Post back if you find any solutions.


----------



## Iritscen (Jun 16, 2006)

By the way, nixgeek, I have to ask about the MP3 in your sig.  I listened to it, and it's very funny (Muppet Show, right?).  Where?  Why?  How?  

As for forums, I actually didn't find any that seemed particularly useful after all.  But really, the problem is not with ImageMagick, it's with its dependencies.  Fortunately I've taken notes at every step.  (See attached.)  I've also created a visual depiction of the dependencies.  (See attached.)

The main problem is that fontconfig and freetype don't seem to be installed correctly.  Freetype seemed to install fine but then seems to mess with fontconfig, if I'm reading the part right where it says:
"Symbol not found: _FSPathMakeRef
Referenced from: /usr/local/lib/libfreetype.6.dylib"

Because those two can't install properly, hardly anything else will even attempt to build, and I can understand why.  They seem to be pretty essential, as does gettext/libiconv, which seemed to install the second time after I installed some other stuff.  Note that some packages are listed two or more times; everything is in the order of installation (or attempt), and sometimes I went back and retried some things, so any duplicate entries are in fact correct (and I used "make distclean" and "make uninstall" before rebuilding and reinstalling anything).

So I guess my primary question is, does anyone have any tips on getting freetype/fontconfig to work?  That error message is strange because FSMakePathRef is a function in Apple's File manager routines.  It can't find the function?!


P.S. Yes, the flowchart is a joke, but one based largely on truth.


----------



## nixgeek (Jun 16, 2006)

Yes, it was on the Muppet Show.  It was also on a very early version of Jim Henson's muppets, proably Sesame Street.

Here's some more information on the song.

The only other option I can give you for getting it to work might be to use a different X11 package, one that's more compliant than Apple's version probably.  On older Mac OS X systems, I have installed XDarwin.  It takes a little longer to come up, but it's better-based on standard XFree86 configurations IMO.  This might actually solve the issues you're having in trying to use Apple's X11 implementation.

There's also another project called XonX, but I haven't played with that one.

Let us know how it turns out.


----------



## Iritscen (Jun 21, 2006)

The problems now aren't even X server-related.

"display" refuses to run, mentioning libtiff and saying that it requires version 12.0, not the 11.0 it's finding.  But libtiff is v3.8.2, which is the latest version.  So what number is it referring to if not the version of the library?

If I can't resolve this problem or any of the others, I am ready to just throw in the towel.  This all started when trying to import .ai files into Inkscape, after all, which would be good but not necessary.

Maybe my next, Intel-based Mac won't have so many Unix issues.  I *am* lusting after those MacBook Pros....


----------



## nixgeek (Jun 21, 2006)

Soudns like it's referring to X Windows...don't know if they're working with some code from CVS or SVN with regard to X Windows.  As far as I know, it's still X11 and I don't see X12 coming any time soon. 

And yus, I am lusting after the MBP as well.  I'm just waiting to see what Merom has to offer, as well as some necessary QA issues that we've heard about.


----------

