Problems with wxPerl

ziggy on 2003-09-21T23:13:49

I got into a conversation about Perl GUIs the other day, and mentioned that wxPerl sounds pretty interesting these days. It's based on wxWindows, which is mature, stable and used for a stunning array of projects. Mitch Kapor's Chandler is being written in wxPython, for example.

I haven't done any GUI programming in a long time, save for some recent Cocoa/ObjC hacking. This means that I've avoided Perl/Tk, GtkPerl, PerlQt or wxPerl.

So I started out with the latest wxWindows sources and tried to install them on my FreeBSD laptop. wxWindows was a simple ./configure ; make ; make install, but Wx.pm was a little more tempermental. I figured out that at a minimum, I needed to install the xrc and stc extensions from the contrib directory.

The bigger problem was with MakeMaker - it wasn't finding my wxwindows include files in /usr/local/include. OK, so just set CCFLAGS=/usr/local/include when invoking Makefile.PL. That worked OK for the main sources, but not for any of the sources in the subdirectories, each of which had their own Makefile.PLs. Eventually, I found the cause of the problem: MakeMaker doesn't pass invocation options to the sub-invocations of Makefile.PL.

All is not lost; I can just override those options with Make. It didn't work at first because BSD Make doesn't pass those overrides down to sub-makes. But GNU Make does, and an invocation like gmake CCFLAGS=-I/usr/local/include worked well enough to build the Wx module.

Then the tests failed because of an unresolved pthread_* symbol. Turns out that my Perl build was unthreaded and wxWindows is threaded, and the two don't work together very well. So I rebuilt wxWindows (and the required extensions) unthreaded and failed for a similar reason due to some pthread_* symbols in gtk/glib.

At this point, it was 6am, and I had spent a few hours compiling and recompiling windowing toolkits and Perl modules until I realized I was too tired for my own good.

 

Sure enough, I woke up the next morning with the answer that should have come to me many hours before: build a threaded Perl. That worked, and in about an hour, I had a working version of Perl, wxWindows and wxPerl.