Gtk-Perl-Cygwin Howto: (version 0.0.6 - Apr 28, 2002) Note: This document is now quite out of date, and inaccurate in many places. The last time I tried following my own instructions, I couldn't get anything to work. Unfortunately, I no longer have the time or motivation to get Gtk-Perl working under Win32. If somebody else (with more interest in gtk on win32) would like to take this document off my hands, please let me know at mag-perl@occamstoothbrush.com. Thanx! A. INTRODUCTION ------------------------------------------------------------------------- This is a (very) terse recipe for installing Gtk-Perl under the Cygwin environment. Some notes: * This was built under Windows 2000; it may work under Win9x, but beware: the process of configuring and building software under Cygwin/Win9X is very slow and painful. * The binaries generated by this process have been tested under Win98 and they do seem to work. However, there is some wonkiness with the X server. YMMV. * When a package is listed with out any instructions, the instructions are actually: $ ./configure $ make $ make install Note that I didn't run any test suites for any packages, so the tests may or may not actually run. * The version numbers listed are the versions I used. YMMV. Where later versions are known not to work, I list them. * For installing perl modules: if you can't get to the cpan> prompt by typing 'cpan', try: $ perl -MCPAN -eshell * Due to linking problems, none of the Gtk-Perl subcomponents are working yet. This includes: GdkPixbuf, Glade, Gnome, GdkImlib, Applet, Bonobo, GnomePrint, GtkGLArea, GtkHTML, GtkXmHTML The problem seems to be that Gtk-Perl wants to create libraries with unresolved references to symbols in other libraries (resolving the symbols at runtime), but Windows doesn't let you build a .dll containing unresolved symbols. * Expect the whole process to take a looooooooong time. :) B. The Steps: ------------------------------------------------------------------------- 1. install Cygwin. See http://www.cygwin.com/ 2. in the Cygwin environment, compile these packages: (note that most of the Gnome software can be found on ftp://ftp.gnome.org) * glib 1.2.10 - in gstrfuncs.c, comment out (705): --- extern char *strsignal (int sig); --- return strsignal (signum); +++ /* extern char *strsignal (int sig); +++ return strsignal (signum); */ (Source: http://www.cygwin.com/ml/cygwin/2001-04/msg01792.html) * xfree 4.10 - get binaries (all files in ftp://ftp.nas.nasa.gov/mirrors/cygwin.com/pub/cygwin/xfree/xc-4-binaries/4.1.0/) - extract extract.exe and run the installer: $ bunzip2 extract.exe.bz2 $ ./Xinstall.sh [ answer 'yes' to everything (including installing xterm terminfo stuff) ] !!!! add /usr/X11R6/bin to $PATH - do this also in your .bashrc !!!! $ export PATH=$PATH:/usr/X11R6/bin * gtk 1.2.10 * db 3.1.17 - from: http://www.sleepycat.com/update/index.html $ cd build_unix $ ../dist/configure --enable-compat185 --prefix=/usr $ make Edit build_unix/Makefile, around lines 192: # PROGS= db_archive db_checkpoint db_deadlock \ # db_dump db_load db_printlog db_recover db_stat db_upgrade db_verify PROGS= db_archive.exe db_checkpoint.exe db_deadlock.exe \ db_dump.exe db_load.exe db_printlog.exe db_recover.exe db_stat.exe db_upgrade.exe db_verify.exe $ make install * imlib 1.9.11 * Orbit 1.5.8 $ ./configure edit Makefile, commenting out the test directory (line 98): # SUBDIRS = popt libIDL src test SUBDIRS = popt libIDL src * gnome-libs 1.4.1 - patch configure Do a search and replace: From: dbopen() To: __db_open() *Note that the proper way to do this is by performing the search and replace in configure.in, and then running autoconf. I can't get autoconf to work, however. - patch configure, removing check for gmodule. comment out lines 5412 and following: # echo $ac_n "checking for gmodule support""... $ac_c" 1>&6 # echo "configure:5414: checking for gmodule support" >&5 # if eval "test \"`echo '$''{'ac_cv_gmodule'+set}'`\" = set"; then # echo $ac_n "(cached) $ac_c" 1>&6 # else # # save_LDFLAGS="$LDFLAGBS" # LDFLAGS="$LDFLAGS `glib-config --libs gmodule`" # if test "$cross_compiling" = yes; then # ac_cv_gmodule=yes # else # cat > conftest.$ac_ext < # # int main() # { # return g_module_supported() == 0; # } # EOF # if { (eval echo configure:5435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null # then # ac_cv_gmodule=yes # else # echo "configure: failed program was:" >&5 # cat conftest.$ac_ext >&5 # rm -fr conftest* # ac_cv_gmodule=no # fi # rm -fr conftest* # fi # # LDFLAGS="$save_LDFLAGS" # fi # # echo "$ac_t""$ac_cv_gmodule" 1>&6 # if test $ac_cv_gmodule = no; then # { echo "configure: error: Dynamic linking is not available on this platform. Some apps, # like panel, will not run properly." 1>&2; exit 1; } # fi - patch zvt/zterm.c, including getopt.h (line 36): #include - patch zvt/subshell.c, causing first instance of receive_fd() to always return -1 (line 110): return -1; /* struct iovec iov [1]; struct msghdr msg; char buf [32]; iov [0].iov_base = buf; iov [0].iov_len = sizeof (buf); msg.msg_iov = iov; msg.msg_iovlen = 1; msg.msg_name = NULL; msg.msg_namelen = 0; if (cmptr == NULL && (cmptr = g_malloc (CONTROLLEN)) == NULL) return -1; msg.msg_control = (caddr_t) cmptr; msg.msg_controllen = CONTROLLEN; if (recvmsg (helper_fd, &msg, 0) <= 0) return -1; return *(int *) CMSG_DATA (cmptr); */ - patch zvt/subshell.c, causing second instance of receive_fd() to always return -1 (line 191): return -1; /* struct strrecvfd recvfd; if (ioctl (helper_fd, I_RECVFD, &recvfd) < 0) return -1; return recvfd.fd; */ - patch zvt/gnome-pty-helper.c, removing the line that includes stropts.h (line 207) --- #include - patch zvt/gnome-pty-helper.c, causing first instance of pass_fd() to always return -1 (line 154): return -1; /* struct iovec iov[1]; struct msghdr msg; char buf [1]; iov [0].iov_base = buf; iov [0].iov_len = 1; msg.msg_iov = iov; msg.msg_iovlen = 1; msg.msg_name = NULL; msg.msg_namelen = 0; msg.msg_accrights = (caddr_t) &fd; msg.msg_accrightslen = sizeof(fd); if (sendmsg (client_fd, &msg, 0) != 1) return -1; return 0; - patch zvt/gnome-pty-helper.c, causing second instance of pass_fd() to always return -1 (line 221 after other edits): return -1; /* if (ioctl (client_fd, I_SENDFD, fd) < 0) return -1; return 0; */ * gnome-common 1.4.1 * libxml 1.8.16 - note that libxml2 is not the same thing! * libglade 0.17 * scrollkeeper 0.2 $ ./configure - Patch cl/src/Makefile, appending -lintl (line 108): # LDADD = $(XML_LIBS) $(top_builddir)/libs/libscrollkeeper.la LDADD = $(XML_LIBS) $(top_builddir)/libs/libscrollkeeper.la -lintl - patch toc/src/Makefile, appending -lintl (line 108): # LDADD = $(XML_LIBS) $(top_builddir)/libs/libscrollkeeper.la LDADD = $(XML_LIBS) $(top_builddir)/libs/libscrollkeeper.la -lintl - patch cl/src/update.c, including getopt.h (line 32): #include - patch cl/src/install.c, including getopt.h (line 31): #include - patch cl/src/uninstall.c, including getopt.h (line 29): #include * oaf 0.6.5 (optional?) $ ./configure - patch oafd/Makefile, line 168: # oafd_LDADD = $(LDADD) oafd_LDADD = $(LDADD) $(LDADD) - patch test/Makefile, line 168: # LIBS = -lpopt 174 LIBS = -lpopt -lintl - patch oafd/qsort_ex.c, line 30, removing inclusion of alloca.h. Remove these three lines: --- #if HAVE_ALLOCA --- #include --- #endif * glade 0.6.x - glade will happily configure without support for bonobo, oaf and gnome-db 3. install dependencies for Gtk-perl: * xpat 1.95.0 (versions 1.95.1 and 1.95.2 don't seem to work) $ ./configure $ make $ make install $ ln -s /usr/local/lib/libexpat-0-0-0.dll /usr/local/lib/libexpat.dll * gdk-pixbuf 0.13.0 $ ./configure --disable-mmx $ make $ make install * XML::Parser version 2.29 (version 2.30 does not work) $ lwp-download http://www.cpan.org/authors/id/C/CO/COOPERCL/XML-Parser-2.29.tar.gz $ tar zxvf XML-Parser-2.29 $ cd XML-Parser-2.29 $ perl Makefile.PL $ make $ make test $ make install * XML::Writer: cpan> install XML::Writer 4. install Gtk-perl: * Unpack the distribution: cpan> look Gtk $ perl Makefile.PL --without-gnomeprint Create Gtk submodule: $ cd Gtk $ perl Makefile.PL $ make $ cd .. Create the submodules ### Note that the following effectively stops each submodule from being built. ### A quicker way might be to use the --without-somemodule syntax as with ### --without-gnomeprint, above. $ cd GdkImlib $ perl Makdfile.PL ### edit Makefile ### --- LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) +++ LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) $ make ### Repeat this process for the other submodules: ### GdkPixbuf, Glade, Gnome * Run the root makefile $ make * launch X $ startx * test Gtk-Perl from within an XTerm: $ make test ------------------------------------------------------------------------- TODO: * A better window manager than twm * Gnome itself running? * Create binary distributions (via RPM?) ------------------------------------------------------------------------- RESOURCES: * Cygwin + Gnome: http://www.geocities.co.jp/SiliconValley/1596/en/cygwin.html ------------------------------------------------------------------------- HISTORY: * 0.0.6 (Nov 18, 2001) - added disclaimer that this document is out of date and looking for a new maintainer. * 0.0.5 (Nov 18, 2001) - discovered that the subcomponents aren't actualy being built. Gtk itself works, but the others (e.g. Pixbuf, Imlib, Glade) don't. * 0.0.4 (Nov 17, 2001) - minor typos - noted libglade version - missing 'cd' step for XML::Parser - added history section * 0.0.3 (Nov 15, 2001) - noted that binaries work under Win98 * 0.0.2 (Nov 15, 2001) - first release * 0.0.1 (Nov 15, 2001) - unreleased ------------------------------------------------------------------------- Author: Michael Graham Comments and fixes welcome!