Skip to content
This repository


pyjsorg edited this page · 4 revisions

Pyjamas Desktop on Mac OS X using pywebkitgtk

Darwin Issues

There are 3 main issues to address:

  • A few incorrect header files are used due to my MacBook Pro's (MBP) hard drive being formatted as a case insensitive filesystem (thanks, Apple).
  • The webkit way of generating an UUID depends on the OS, and for Darwin, this requires a WebKit implementation of a CF (Core Foundation) String class constructor (I tried including the system's CFString header and CoreFoundation Framework, but that didn't have the desired constructor).
  • As with some other platforms, there is an issue with undefining the system's ascii functions such as isascii(), toupper(), tolower(), etc. The reason is the GTK+ platform makes use of C++'s STL algorithms header, and on my system (deep in the bowels of algorithm) isascii() is required by an include about 7 levels in the include tree below the algorithm header. I chose to not include the header that undefined the locale specific character functions, another fix is to instead undefine _DONT_USE_CTYPE_INLINE_. I don't know the side effects of undefining _DONT_USE_CTYPE_INLINE_, but undefining _DONT_USE_CTYPE_INLINE_ does adjust /usr/include/xlocale/_ctype.h so that isascii(), toupper(), and tolower() are no longer used.

A lesser issue is that (on Darwin, at least) one of the NSplugin tests uses QuickDraw which is no longer supported by Apple.

The git patch

The git patch cannot be posted here as the creole parser doesn't respect the way of escaping wiki markup.

The final issue

At the present, the pywebkitgtk I built on Mac OS 10.6.8 is not respecting the loading of the small HTML file that is generally loaded as one of the first steps of setting up pyjd. I have been using gdb to try to understand what is going wrong, but haven't found the exact cause yet (for some reason the WebKitCore FrameLoader or DocLoader doesn't like either the url or the html file itself -- I haven't gotten far enough to see where the failure is, but given that the html text is shown in the pyjd window, I am assuming that the url is "ok"). Note: gdb can be used in the following manner:

  • run bin/pyjd without arguments
  • get the bin/pyjd process's pid
  • start gdb and attach to that pid
  • at the bin/pyjd prompt type the function used to load the html file, but don't execute it (don't hit return)
  • interrupt gdb (^C)
  • set one or more breakpoints
  • type continue at the gdb prompt
  • in the bin/pyjd prompt execute the command (enter/return)
  • step through the code

WebKit GTK+ Dependencies

I am using <a href=>homebrew</a> to install additional packages on Mac OS X. Unfortunately, with my crappy memory and note taking, I don't recall exactly what I did (doh!) with respect to the build tools. Apple nicely has a very ancient version of autotools as part of xcode, and I think I needed to use the autotools from homebrew (otherwise there is some error about Hilton UI).

I will list all of the dependencies linked in (for laziness' sake), but if you brew gst-plugins-base and libsoup you will probably have everything you need (except for automake, autoconf, and libtool).

  • /usr/lib/libSystem.B.dylib
  • /System/Library/Frameworks/Python.framework/Versions/2.6/Python
  • /usr/local/lib/libenchant.1.dylib
  • /usr/local/lib/libgailutil.18.dylib
  • /usr/local/lib/libgstapp-0.10.0.dylib
  • /usr/local/lib/libgstinterfaces-0.10.0.dylib
  • /usr/local/lib/libgstpbutils-0.10.0.dylib
  • /usr/local/lib/libgstvideo-0.10.0.dylib
  • /usr/local/lib/libgstbase-0.10.0.dylib
  • /usr/local/lib/libgstreamer-0.10.0.dylib
  • /usr/local/lib/libjpeg.8.dylib
  • /usr/lib/libxslt.1.dylib
  • /usr/lib/libz.1.dylib
  • /usr/lib/libxml2.2.dylib
  • /usr/X11/lib/libpng12.0.dylib
  • /usr/local/lib/libsqlite3.0.8.6.dylib
  • /usr/lib/libicucore.A.dylib
  • /usr/X11/lib/libXt.6.dylib
  • /usr/X11/lib/libX11.6.dylib
  • /usr/X11/lib/libSM.6.dylib
  • /usr/X11/lib/libICE.6.dylib
  • /usr/local/lib/libsoup-2.4.1.dylib
  • /usr/local/lib/libgtk-x11-2.0.0.dylib
  • /usr/local/lib/libgdk-x11-2.0.0.dylib
  • /usr/local/Cellar/atk/2.2.0/lib/libatk-1.0.0.dylib
  • /usr/local/Cellar/glib/2.30.2/lib/libgio-2.0.0.dylib
  • /usr/local/lib/libpangoft2-1.0.0.dylib
  • /usr/local/lib/libpangocairo-1.0.0.dylib
  • /usr/local/Cellar/gdk-pixbuf/2.24.1
  • /lib/libgdk_pixbuf-2.0.0.dylib
  • /usr/X11/lib/libcairo.2.dylib
  • /usr/local/lib/libpango-1.0.0.dylib
  • /usr/X11/lib/libfreetype.6.dylib
  • /usr/X11/lib/libfontconfig.1.dylib
  • /usr/local/Cellar/glib/2.30.2/lib/libgobject-2.0.0.dylib
  • /usr/local/Cellar/glib/2.30.2/lib/libgmodule-2.0.0.dylib
  • /usr/local/Cellar/glib/2.30.2/lib/libgthread-2.0.0.dylib
  • /usr/local/Cellar/glib/2.30.2/lib/libglib-2.0.0.dylib
  • /usr/local/Cellar/gettext/

After you brew automake, autoconf, and libtool you may need to manual link each package using "brew link <package>".

Also, some of the packages have issues if they are installed (linked) in /usr/local/*, and they are installed as "keg-only". Therefore I had the following lines in a script that I used to build webkit (yes, I had something peculiar with pygtk+ include paths, didn't debug the issue).

  • export PYGTK_CFLAGS="-I/usr/local/Cellar/pygtk/2.24.0/include/pygtk-2.0 -I/usr/local/Cellar/pygobject/2.28.6/include/pygtk-2.0"
  • export PKG_CONFIG_PATH=/usr/local/Cellar/gstreamer/0.10.35/lib/pkgconfig:/usr/local/Cellar/pygobject/2.28.6/lib/pkgconfig:/usr/local/Cellar/pygtk/2.24.0/lib/pkgconfig
  • export PATH=$PATH:/usr/local/Cellar/gettext/
  • ../
  • ../configure --prefix=/where/to/install/pywebkitgtk
  • make install
Something went wrong with that request. Please try again.