I'm on Windows 10 with a perl 5.24 install in C:/strawberry
I lost so many hours trying to understand why dmake always failed with undefined reference, that I thougt usefull to give a recipe to others when I finaly found a workaround. Here it goes:
- download the latest (2.24) bundle for the Gtk+ stack from http://ftp.gnome.org/pub/GNOME/binaries/win32/gtk+ At the time of this writing (july 2016), the package installed using msys2 crashed on the tests with cairo so I return to the gnome ftp site.
- unzip it in, say C:\prog, and rename the top folder to gtk+ so that you have a C:\prog\gtk+\lib folder that contains a lot of *.def, *.lib, *.dell, *.dell.a files
- From the control panel use "System - Advanced system settings - Environment variables" to check or add if missing, the variable PKG_CONFIG_PATH in your user variables. Set it to C:prog\gtk+\lib\pkgconfig;C:\strawberry\c\lib\pkgconfig
- add C:\prog\gtk+\bin to your PATH environment variable
- from the cpan shell, download the following perl packages using the get command
- Cairo
- Glib
- Pango
- Gtk2
- Each package is downloaded by cpan in C:\strawberry\cpan\build. To open a command shell in each of these folder, select the folder and while pressing the shift key, show the menu with the mouse right click, and select "open command window here".
From the cpan shell, the command looks perl_module is another way to open a subshell in the corresponding build/module_folder
- Edit C:\prog\gtk+\lib\pkgconfig\cairo.pc and replace the line having
prefix=/devel/target/whatever with
prefix=${pcfiledir}/../..
Repeat this change for the files:
gobject-2.0.pc pango.pc gtk+-2.0.pc - open a command shell in the Cairo-1.... folder
- run the commands
perl Makefile.pl INC="-IC:/strawberry/c/include/freetype2 -IC:/prog/gt +k+/include/cairo -IC:/prog/gtk+/include/ -I. -I.\build"
- Check that there is no "Warning (mostly harmless): No library found for ... ". Changing the prefix line in the pc file of the first library searched by Makefile.pl allow perl to find all the external libraries.
- Run
dmake dmake test dmake install
- Open a command shell in the cpan/build/Glib.... folder
- run
perl Makefile.pl INC="-IC:\prog\gtk+\include\glib-2.0 -IC:\prog\Gtk+\l +ib\glib-2.0\include -I. -I./build" dmake dmake test dmake install
- run
perl Makefile.pl INC="-IC:\prog\gtk+\include -IC:/prog/gtk+/include/f +reetype2 -IC:/prog/Gtk+/include/cairo -IC:\prog\Gtk+\include\Pango-1. +0 -IC:\prog\Gtk+\include\glib-2.0 -IC:\prog\Gtk+\lib\glib-2.0\include + -I. -I./build -IC:\strawberry\perl\site\lib\Glib\Install -IC:\strawb +erry\perl\site\lib\Cairo\Install" dmake dmake test dmake install
- run
perl Makefile.pl INC="-IC:\strawberry\perl\site\lib\Glib\Install -IC:\ +strawberry\perl\site\lib\Pango\Install -IC:\strawberry\perl\site\lib\ +Cairo\Install -IC:\prog\gtk+\include -IC:\prog\Gtk+\include\glib-2.0 +-IC:\prog\gtk+\include\pango-1.0 -IC:\prog\Gtk+\include\cairo -IC:\pr +og\Gtk+\include\atk-1.0 -IC:\prog\gtk+\include\gdk-pixbuf-2.0 -IC:\pr +og\gtk+\include\gtk-2.0 -IC:\prog\gtk+\include\freetype2 -IC:\prog\Gt +k+\lib\glib-2.0\include -IC:\prog\Gtk+\lib\gtk-2.0\include -I. -I./bu +ild" dmake dmake test dmake install
Notes:
The command given above for perl Makefile.PL has been used for the gtk+-bundle_2.24.10
A newer version could contains new libraries and this would cause dmake to fail with filex.h not found
In that case, you have to add the path to the missing file with -Ic:/this/is/where/thatmissing/file/is in the INC arg given to Makefile.PL.
Perl modules already installed have this header file in
C:\strawberry\perl\site\lib\xxxx\InstallAnd external libraries to uninstalled perl modules have their header files somewhere in
So rerunC:\prog\gtk+\include C:\prog\Gtk+\include\xxx C:\prog\Gtk+\lib\xxx\include
perl Makefile.PL INC="changed to include the new path" dmake
until dmake gives no error.
The version of the Gtk2 perl module tested here were 1.2498 and 1.2499. If you try to compile these with an earlier version for the binaries (2.20 instead of 2.24) you will get undefined reference errors with GLib.
Now if you change the path where your gtk+ libraries have been unzipped (or if you remove C:/prog/gtk+/bin from your PATH environment variable, your perl scripts using Gtk2 will crash.
To gain independance from C:/prog/gtk+/bin, you need to copy some dll from this folder to your perl tree directory. This small script does this (the dll list hold for gtk+-bundle_2.24.10):
use strict; use warnings; use File::Copy; my $from= "C:/prog/gtk+/bin/"; my %fm=('C:/strawberry/perl/site/lib/auto/Glib/' => [qw( libglib-2.0-0.dll intl.dll libgthread-2.0-0.dll libgobject-2.0-0.dll )], 'C:/strawberry/perl/site/lib/auto/Cairo/' => [ qw( libcairo-2.dll libexpat-1.dll freetype6.dll libpng14-14.dll libfontconfig-1.dll zlib1.dll )], 'C:/strawberry/perl/site/lib/auto/Pango/' => [qw( libgmodule-2.0-0.dll libpango-1.0-0.dll libpangocairo-1.0-0.dll libpangoft2-1.0-0.dll libpangowin32-1.0-0.dll )], 'C:/strawberry/perl/site/lib/auto/Gtk2/' => [ qw( libgtk-win32-2.0-0.dll libgio-2.0-0.dll libgdk_pixbuf-2.0-0.dll libatk-1.0-0.dll libgdk-win32-2.0-0.dll )]); foreach my $dest (keys %fm){ my $files = $fm{$dest}; foreach my $file (@$files){ print "will copy $from$file to $dest/$file\n"; copy("$from$file", "$dest/$file") or die("failed... : $!"); } }
HTH !
UPDATE:Some year later.- The code is not correct, the dlls should put placed in perl/bin not in the folder under site/lib/auto. They are in the windows path and can be found when needed.
- If you want to use PAR::Pack to get an exe (or if you need something that works quickly) use the compiled modules from sisyphusion here
frazap
|
---|