midtoad’s mess.ages
excellence in creative mediocrity

Sun Aug 28 2005

Running Skencil on Mac OS X

Filed under: — midtoad @ 12:27:36 MDT

Recently, I switched from Linux to Mac OS X with the purchase of a Mac Mini, and I’ve been busy getting some of my favourite Linux apps running on Mac OS X (for those that don’t know, Mac OS X is effectively a pretty face on top of a customized version of Linux; techies please excuse this simplification). One of the apps I wanted to get running is Skencil, a vector-based graphics program that can create and edit .svg images.

Mac OS X comes with Python pre-installed; in fact, it’s now the preferred development language, replacing Java. version 2.3 is installed, but I’ve gone ahead and also installed Python 2.4. They’re both in /usr/lib. This might pose a small difficulty, which I’ll describe.

If you’re interested in installing Skencil, you firstly need to have X11 installed. Go and fetch Fink and read up on how to install X11 using it. Fink is what you use to install a vast number of Linux apps. You will also need a terminal package installed so you can get access to the command-line. OS X comes with a terminal app (look in Utilities), but I prefer to use iTerm.

I obtained the latest source-code version of Skencil in .tar.gz format and opened it on my desktop. I then copied the resulting folder to my ~/tmp folder so I could work on it. A quick read through the INSTALL file indicated that Skencil is built using Python and Tkinter, and also requires PIL (Python Imaging Library). I checked for its presence by starting the Python interpreter (type “python” at the command line) and then “import PIL” or “import Imaging”. No luck, so I fetched the latest copy of the PIL source code from effbot.org and installed it. If I recall correctly, I simply used “sudo python setup.py install”.

Next I switched into the folder containing the Skencil source code and tried “sudo python setup.py configure”. That worked, so next I tried “sudo python setup.py build”. This failed after a short while with an error about /usr/bin/ld and MACOSX_DEPLOYMENT_TARGET not being acceptable for other than 10.1 (sorry, I don’t have the exact words any more). I was really stumped by this, but after some Google searching, I came across this post on the PythonMac SIG that gave me a clue. It contained enormous detail about patching your version of Python, which I didn’t really want to get into. I zeroed in on the following commands, and executed them:


>MACOSX_DEPLOYMENT_TARGET=10.3
>export MACOSX_DEPLOYMENT_TARGET
>env MACOSX_DEPLOYMENT_TARGET=10.3 ./configure --enable-framework

I switched into the skencil source-code folder and executed the configure command, taking care to tell it where the Imaging.h file was located:
sudo python setup.py configure --imaging-include=/users/stewartmidwinter/tmp/Imaging-1.1.5/. If you don’t include the –imaging-include parameter, python will likely complain, and fail. I also took a moment to install the PIL module with “python setup.py install”.

After the configuring step was completed, I was able to build the skencil source code; if you’re unfamiliar with building apps, note that this step produces a long spew of output from the gcc compiler.

sudo python setup.py build

Next, I was able to installed the compiled code, with:
sudo python setup.py install

At this point, I tested my installation by trying to run skencil from the command line with “/usr/local/bin/skencil”. Nada, no response. So I switched to the actual folder where the skencil.py file is located (/usr/local/lib/skencil-0.6.17) and ran “python skencil.py”. Python threw an exception, ending with this line:
TclError: this isn't a Tk applicationcouldn't connect to display ":0.0"

I recalled that most Linux GUI apps can’t be run directly from the command line. I went into Finder, Utilities and started X11.app, then opened its Application, Customize menu and added skencil. The command line to run is “python /usr/local/lib/skencil.py”.

Success! Here’s what skencil looks like when running on Mac OS X:

Skencil

16 Comments »

The URI to TrackBack this entry is: http://midtoad.homelinux.org/wp/wp-trackback.php?p=116

  1. I’m stuck with a “Can’t find suitable tcl/tk libraries” and indeed, the libraries are not where it looks. I don’t know what to do, surely a link somewhere to a framework (I have no idea what that means). I installed TclTkAqua-8.4.7, _tkinter-8.4 , Imaging-1.1.5 and PIL-1.1.5 but well, I don’t know what to do… Thanks.

    Comment by Christian Mercat — Thu Sep 29 2005 @ 16:43:04 MDT

  2. Hope I am not asking a stupid question — but followed the instructions above, only to find that the compiled program resulted in a Segmentation Fault running on OSX 10.4. Is there any way I can download a binary of skencil already properly compiled?

    Comment by Ben Jacobs-Swearingen — Sat Oct 1 2005 @ 20:05:37 MDT

  3. Thanks for the help but I ran into a problem wiht tcl/tk.
    “Can’t find suitable tcl/tk libraries”
    I have compiled and installed tcl and tk but I can not get rid of the error.

    any idea??

    Comment by Garrett Williams — Fri Oct 14 2005 @ 14:49:02 MDT

  4. “I went into Finder, Utilities and started X11.app, then opened its Application, Customize menu and added skencil. The command line to run is “python /usr/local/lib/skencil.pyâ€?.”

    I could not find this option from XDarwin.app (I guess it’s the newer version of X11.app). Is there a way to do this from the command line (there does not appear to be an “Application, Customize” menu).

    Comment by Jon E. Hendrickson — Fri Nov 11 2005 @ 9:44:44 MST

  5. Jon, I think you’re saying that X11.app is the newer version of XDarwin.app? What version of OS X are you on? I’m on 10.4.3. If your X11 menu doesn’t have an application customize menu, do you at the least have a Terminal available? What happens if you just type the command to start skencil in a Terminal window?

    Comment by midtoad — Tue Nov 15 2005 @ 17:34:46 MST

  6. XDarwin is a project to create an open-source version of X11 for Mac OS X, unlike Apple’s X11 which (may) have some proprietary stuff in it. I can start Skencil from a command line, so if you can’t under Darwin, you may have other problems. See if you can start a python interpreter and “import PIL”. Since Skencil is built with Python, and uses PIL, you need to be able to run python and be able to use the PIL module (available from effbot.org. Install it as per the instructions above.

    Comment by midtoad — Tue Nov 15 2005 @ 18:17:36 MST

  7. Very cool. Thanks for taking the time to make such detailed notes. I’ll have to give it a try …. not that I would ever use it but I have the need to install the most arcane software possible on my beloved mac.

    Again. Thanks for taking the time.

    Michael

    Comment by Mike — Tue Nov 22 2005 @ 11:35:25 MST

  8. Hi
    As Skencil is available through fink, what is the advantage of installing it using your method over Fink ?

    Comment by Thierry — Fri Nov 25 2005 @ 12:06:47 MST

  9. In order to get things to work for me (OS X 10.3, fink, apple X11), I had to:
    1) download and install the PIL library. I think “sudo python setup.py install” worked for me.
    2) from the skencil directory, do the configure, specifying the tk and tcl libraries:
    python setup.py configure –tk-flags=”-I/sw/include -L/sw/lib -L/usr/X11R6/lib -ltk -ltcl”
    3) Build it:
    python setup.py build
    4) Install it to the usual fink directory:
    sudo python setup.py install prefix=/sw

    Then from an X terminal I can just say ’skencil’ to start the thing.

    Comment by snapster — Tue Nov 29 2005 @ 10:19:41 MST

  10. I have tried to install skencil on Tiger. I have not installed python 2.4 because the skencil docs say that any puthon later than 1.5 should suffice. However, when I run skencil, I get a Segmentation fault. With gdb I found out that it is on a call to XGetVisualInfo in skcolor.c.

    While building skencil I got a couple of warnings, like
    /usr/bin/ld: warning multiple definitions of symbol _XGetVisualInfo
    /usr/lib/libtk8.4.dylib(single module) definition of _XGetVisualInfo
    /usr/X11R6/lib/libX11.dylib(VisUtil.o) definition of _XGetVisualInfo

    (many more of these but I picked XGetVisualInfo because that is where it crashes so I suspect it has something to do with these multiple definitions.)

    Because the crash does not seem to be related to Python I don’t think it is the Python version that causes the problem.

    Could it be Panther related?

    Comment by Piet van Oostrum — Fri Dec 2 2005 @ 5:56:52 MST

  11. Skencil is still not avaliable under darwinports (so this method is useful for people who prefear not to install fink)

    As for launching x apps from the command line, I’ve found that with 10.3.x and apple’s X11 I can launch them from the xterm included, but not from Terminal.

    Comment by Elena — Sun Feb 19 2006 @ 15:51:17 MST

  12. After install to prefix /sw I get the following errors:

    File “/usr/local/bin/skencil”, line 30, in ?
    import Sketch
    File “/usr/local/lib/skencil-0.6.17/Sketch/__init__.py”, line 53, in ?
    import _sketch

    Any Ideas or somone know how to fix this get around this?

    Comment by Den — Wed Apr 26 2006 @ 3:47:12 MDT

  13. OoPs had forgot to build… however now python does not like PIL from X11 *@?*&%..#£()^*

    Comment by Den — Wed Apr 26 2006 @ 4:16:36 MDT

  14. Please note that Apples Terminal and X11 terminals use different versions of python (for those not installing a new version)… I had to install PIL into X11 python after I found this version did not recognise the PIL I’d installed via the Terminal app. The versions differ on my OS X (10.3.x) to versions 2.3.3 (Terminal) and 2.3 (X11)… quite easy to miss that slight difference.

    Comment by Den — Wed Apr 26 2006 @ 4:32:25 MDT

  15. […] I found another open source vector drawing application that runs on X11 called Skencil. This time I didn’t even bother to think I would ever mess with the source code, I just wanted to run it. But things turned out not to be that simple. Skencil is written in Python, and you require several extra Python libraries in your system (PIL and Tkinter for example) to actually build it. You require Python 2.4 (Mac OS X native version is 2.3), and you need to tweak your system a little, just in the right place where you have no clue of what you’re doing. I will spare you the details, there is a list of instructions on what to do here. Of course I could never get it to work. Next time I will just erase my drive and install Ubuntu. Just for fun. […]

    Pingback by -BlackLog- » Blog Archive » Lost in (S)hell strikes back — Sun Aug 27 2006 @ 0:34:07 MDT

  16. Um this is kind of a while ago, but, I got Skencil to compile and everything. When I run it though I get segmentation fault it and it crashes. Is this just an error with how I compiled it or what? Any help would be nice, thanks.

    Comment by Sam — Tue Feb 27 2007 @ 18:19:44 MST

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

(required)

(required)


queries in 0.289 sec. || Powered by WordPress  midwinter.ca  midtoad