Dienstag, Oktober 23, 2007

Running GTK applications in Mac OS X

Several months ago, I bought a GPS data-logger, which is the Wintec WBT-201. I decided between this model and the Xaiox Itracku with SirfIII, but the comparison should be read on other boards (i.e. pocketnavigation)



Although MacOS users have the possibilty to use this device in Parallels Desktop, you can not use the Bluetooth connection, because it is not supported by Parallels at the moment. As alternative, I found information, how to use the WBT201 with gpsbabel and another open source tool, which is called GTK-X-GRAYS2.




Now, the question is, how to start such an application on Mac OS X. As far as I know, there are two possible ways running the GIMP Toolkit (GTK).

  1. in x11 environment
    Installing Apples X11 and using Macports GTK port. There is an alternative project called fink, but at the moment, the ported version of gtk is too low for our purpose (we need at least 2.8 and fink only has 2.6.10).

  2. native
    http://developer.imendio.com/projects/gtk-macosx/
    This means, that the GTK uses Apple's Quartz to display graphics. You do not need any X11 Server.
You can test both systems and have them parallel installed, the only thing you have to change, when compiling your application is setting the path to pkg-config of the desired type.

In the following, there is a little description on how to install gtk for x11 with macports.



  1. Install XCode and X11 from Apples MacOS DVD, for example use these instructions. There are also Apple's X11 Instructions available.


  2. download and install Macports


  3. install gtk and dependent packages with macports


    • in the Terminal , you can check your installed packages by "port list installed"


    • install a package by "sudo port install <package-name>" (you will need the root password)



  • install gtk2, pkg-config, cairo, libglade2. This is not the full list and other dependent packages will be installed (the process takes a while...)





  • build application


    In the Terminal, change to the directory of your application and type "./configure". You will see some output and maybe messages, that building can be done or not. In the case, that a library is missing, try to install it by searching with macports "port search <libraby-name>". After that, retry the configure step. If the configure was successful, type "sudo make install".



  • run application


    To run your application, you could try it in the Terminal, but if it is a x11 app, the output will be "Gtk-WARNING **: cannot open display:". What you have to do is starting the X11.app, which is the same as the Terminal but provides the X-Server. It is also possible to start an X11 application by "open-x11 <application-name>" (see Apple's x11 site)




  • Hopefully, you will succeed with this. Feel free to write me.

    gtk-g-rays2 Mac OS X binary with native gtk libraries (Intels, 10.4.10)



    You also could download this image file and start gtk-x-rays2 as a binary and native gtk components. (Download , 11.3 MB) No warranty.
    This file includes: binary gtk-g-rays2-1.04 with gtk 2.10 and dependent libraries. The bundle was packed with Platypus. gpsbabel is not included. What you have to do to run the program is just clicking the GTK-WBT201.app application.

    7 Kommentare:

    ~white~fire~ hat gesagt…

    The link to the compiled app is broken.

    Dizzie hat gesagt…

    Can't find the file - 404

    Matze hat gesagt…

    Hi

    I corrected the link:

    http://files.bluestart.de/GTK-WBT201.dmg

    cheers
    Matze

    dizzie hat gesagt…

    Vielen Dank!

    ~white~fire~ hat gesagt…

    how about a fresh compile with the current version?

    Matze hat gesagt…

    Is there a new version?

    ~white~fire~ hat gesagt…

    well, if you follow your link to the project, you'll see "v1.11" right at the top...