in reply to Re^2: gmake error on Glib compile
in thread gmake error on Glib compile

Hi Mike,

I've just been working through building Glib-1.3293 on my 64-bit perl-5.38.0 on Windows 11.
You'll want the mingw-w64 packages (which will be automatically installed into your MSYS2/mingw64 folder). Here are my notes:
For 64-bit build: Install Gtk2 in MSYS2 $ pacman -Sy mingw64/mingw-w64-x86_64-gtk2 Install pkg-config.exe $ pacman -Sy mingw64/mingw-w64-x86_64-pkg-config Add pkg-config.exe to PATH: set PATH=%PATH%;D:\msys64\mingw64\bin set PKG_CONFIG_PATH=D:\msys64\mingw64\lib\pkgconfig Install ExtUtils::PkgConfig (and ExtUtils::Depends if it's not already + installed) ########### Glib-1.3293 ########### Hide (by changing '.a' extension to '.a_static') for following libs: "D:\msys64\mingw64\lib\libgobject-2.0.a" "D:\msys64\mingw64\lib\libglib-2.0.a" "D:\msys64\mingw64\lib\libintl.a" "D:\msys64\mingw64\lib\libgthread-2.0.a" And create a copy of the corresponding import ("*.dll.a") libs with the ".dll" removed from the name. Run 'perl Makefile.PL', 'gmake test', 'gmake install'. (All tests passed for me.)
See how you go with that.
There's some paths there that will need to be modified to match your set up.
The stuff about the renaming of the various libs is a bit of a nuisance. I'm hoping to eventually find a less hackish way of dealing with it.
Basically, you want the Glib build to use the shared libraries (dlls), but EU::MM generates a Makefile that references the static libs - eg .../mingw64/lib/libintl.a instead of .../mingw64/lib/libintl.dll.a.
(If you run 'perl Makefile.PL' and have a look at the EXTRALIBS and LDLOADLIBS entries in the generated Makefile, you'll see what I mean.)
This ought to be fixed properly, but in the meantime I've just renamed libintl.a to libintl.a_static, and copied libintl.dll.a to libintl.a. (And do the same for the other libs I've specified.)
So ... libintl.a and libintl.dll.a end up being the same import library, and libintl.a_static is the (effectively hidden) static lib.

Here's the rest of my notes at this stage:
########### Cairo-1.109 ########### Hide (by changing '.a' extension to '.a_static') for following libs : "D:\msys64\mingw64\lib\libcairo.a" "D:\msys64\mingw64\lib\libfreetype.a" And create a copy of the corresponding import ("*.dll.a") libs with the ".dll" removed from the name. Run 'perl Makefile.PL', 'gmake test', 'gmake install'. One test failed for me: ~~~~~~~~~~~~~~~~~~~~~~~~~~ t/CairoFont.t ..... 1/29 unknown cairo_font_type_t value 5 encountered + at t/CairoFont.t line 79. # Failed test at t/CairoFont.t line 79. # Looks like you failed 1 test of 29. ~~~~~~~~~~~~~~~~~~~~~~~~~~ ################### Cairo-GObject-1.005 ################### Hide (by changing '.a' extension to '.a_static') for following libs : "D:\msys64\mingw64\lib\libcairo-gobject.a" And create a copy of the corresponding import ("*.dll.a") libs with the ".dll" removed from the name. Run 'perl Makefile.PL' and then: Edit generated Makefile (EXTRALIBS and LDLOADLIBS spec) to start with: "C:\perl-5.38.0-1310-mcf\site\lib\MSWin32-x64-multi-thread\auto\Glib\G +lib.dll" "C:\perl-5.38.0-1310-mcf\site\lib\MSWin32-x64-multi-thread\a +uto\Cairo\Cairo.dll" ExtUtils::Depends is supposed to pull those in ... actually, it's prob +ably supposed to pull in the corresponding '.a' files (Glib.a and Cairo.a), but those files don +'t exist. Then run 'gmake test' and 'gmake install'. All tests passed for me. ########### Pango-1.227 ########### Hide (by changing '.a' extension to '.a_static') for following libs : "D:\msys64\mingw64\lib\libpango-1.0.a" "D:\msys64\mingw64\lib\libharfbuzz.a" "D:\msys64\mingw64\lib\libpangocairo-1.0.a" And create a copy of the corresponding import ("*.dll.a") libs with the ".dll" removed from the name. Run 'perl Makefile.PL' and then: Edit generated Makefile (EXTRALIBS and LDLOADLIBS spec) to start with: "C:\perl-5.38.0-1310-mcf\site\lib\MSWin32-x64-multi-thread\auto\Glib\G +lib.dll" "C:\perl-5.38.0-1310-mcf\site\lib\MSWin32-x64-multi-thread\a +uto\Cairo\Cairo.dll" Then run 'gmake test' and 'gmake install'. All tests passed for me. ############ Gtk2-1.24993 ############ Hide (by changing '.a' extension to '.a_static') for following libs : "D:\msys64\mingw64\lib\libpangowin32-1.0.a" "D:\msys64\mingw64\lib\libatk-1.0.a" "D:\msys64\mingw64\lib\libgdk_pixbuf-2.0.a" "D:\msys64\mingw64\lib\libgio-2.0.a" And create a copy of the corresponding import ("*.dll.a") libs with the ".dll" removed from the name. Run 'perl Makefile.PL' and then: Edit generated Makefile (EXTRALIBS and LDLOADLIBS spec) to start with +(and NOTE addition of "Pango.dll'): "C:\perl-5.38.0-1310-mcf\site\lib\MSWin32-x64-multi-thread\auto\Cairo\ +Cairo.dll" "C:\perl-5.38.0-1310-mcf\site\lib\MSWin32-x64-multi-thread +\auto\Glib\Glib.dll" "C:\perl-5.38.0-1310-mcf\site\lib\MSWin32-x64-mu +lti-thread\auto\Pango\Pango.dll" Rename t/GtkStyle.t to t/GtkStyle.t_hide as it fails in a way that aborts the test suite. Then run 'gmake test' and 'gmake install'. Apart from the t/GtkStyle failure, we get: Test Summary Report ------------------- t/GdkDisplay.t (Wstat: 256 (exited 1) Tests: 27 Fail +ed: 1) Failed test: 23 Non-zero exit status: 1 t/GdkImage.t (Wstat: 256 (exited 1) Tests: 23 Fail +ed: 1) Failed test: 1 Non-zero exit status: 1 t/GdkKeys.t (Wstat: 1280 (exited 5) Tests: 6 Fail +ed: 0) Non-zero exit status: 5 Parse errors: Bad plan. You planned 46 tests but ran 6. t/GdkPixbuf.t (Wstat: 256 (exited 1) Tests: 112 Fai +led: 1) Failed test: 44 Non-zero exit status: 1 t/PangoFontset.t (Wstat: 256 (exited 1) Tests: 7 Faile +d: 1) Failed test: 1 Non-zero exit status: 1 Files=227, Tests=4900, 32 wallclock secs ( 0.05 usr + 0.00 sys = 0.0 +5 CPU) Result: FAIL Failed 5/227 test programs. 4/4900 subtests failed. make: *** [Makefile:3727: test_dynamic] Error 255 Install Gtk3: $ pacman -Sy mingw64/mingw-w64-x86_64-gtk3 Install GObject-Introspection: $ pacman -Sy mingw64/mingw-w64-x86_64-gobject-introspection ############################### Glib-Object-Introspection-0.050 ############################### Hide (by changing '.a' extension to '.a_static') for following libs : "D:\msys64\mingw64\lib\libgmodule-2.0.a" "D:\msys64\mingw64\lib\libffi.a" And create a copy of the corresponding import ("*.dll.a") libs with the ".dll" removed from the name. Run 'perl Makefile.PL' and then: Edit generated Makefile (EXTRALIBS and LDLOADLIBS spec) to start with: "C:\perl-5.38.0-1310-mcf\site\lib\MSWin32-x64-multi-thread\auto\Glib\G +lib.dll" Then run 'gmake install'. ('gmake test' can't be run because test scri +pts aren't generated.)
That's as far as I've got, so far. (Next up is to install Gtk3.)
Sorry - those notes are clear to me, but just ask me about the bits that are unclear to you.

UPDATE: If you're using Strawberry Perl, those "Glib.dll", "Cairo.dll" and "Pango.dll" entries will need to be altered to "Glib.xs.dll", "Cairo.xs.dll" and "Pango.xs.dll"

Cheers,
Rob

Replies are listed 'Best First'.
Re^4: gmake error on Glib compile
by syphilis (Archbishop) on Aug 22, 2023 at 08:30 UTC
    (Next up is to install Gtk3.)

    Notes:
    ########## Gtk3-0.038 ########## Run 'perl Makefile.PL', 'gmake test', 'gmake install'. 3 test scripts fail: Test Summary Report ------------------- t/overrides.t (Wstat: 1280 (exited 5) Tests: 55 Failed: + 0) Non-zero exit status: 5 Parse errors: Bad plan. You planned 233 tests but ran 55. t/zz-GdkEvent.t (Wstat: 1280 (exited 5) Tests: 141 Failed +: 0) Non-zero exit status: 5 Parse errors: Bad plan. You planned 146 tests but ran 141. t/zz-GtkCellLayoutIface.t (Wstat: 1280 (exited 5) Tests: 33 Failed: + 0) Non-zero exit status: 5 Parse errors: Bad plan. You planned 35 tests but ran 33. Files=22, Tests=761, 11 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 +CPU) Result: FAIL Failed 3/22 test programs. 0/761 subtests failed. ###############
    Tonight, repeat those builds using Strawberry Perl 5.38.0, built against the same Gtk2 and GTk3 libraries.
    Strawberry will actually create the "Glib.a", "Cairo.a" and "Pango.a" files that my own build of perl did not.
    Turns out that this happens because I had ExtUtils-Depends-0.8001, whereas SP has ExtUtils-Depends-0.8000.
    I'll provide notes of how those same modules fare on Strawberry when it's all done

    Cheers,
    Rob.
      On 64-bit Strawberry Perl 5.38.0 (portable edition) The following pacman commands install needed packages and must be run (if they haven't already). $ pacman -Sy mingw64/mingw-w64-x86_64-gtk2 $ pacman -Sy mingw64/mingw-w64-x86_64-pkg-config $ pacman -Sy mingw64/mingw-w64-x86_64-gtk3 $ pacman -Sy mingw64/mingw-w64-x86_64-gobject-introspection set PATH=%PATH%;D:\msys64\mingw64\bin set PKG_CONFIG_PATH=D:\msys64\mingw64\lib\pkgconfig set LIBRARY_PATH=D:\msys64\mingw64\lib ########### Glib-1.3293 ########### Accessing same renamed libraries as I used with my own build of perl. set CPATH=D:\msys64\mingw64\include;D:\msys64\mingw64\include\glib-2.0 +;D:\msys64\mingw64\lib\glib-2.0\include Run 'perl Makefile.PL', 'gmake test', 'gmake install'. All tests passed for me. ('auto/Glib/Glib.a' was created and installed.) ########### Cairo-1.109 ########### Accessing same renamed libraries as I used with my own build of perl. set CPATH=%CPATH%;D:\msys64\mingw64\include\cairo;D:\msys64\mingw64\in +clude\freetype2; Run 'perl Makefile.PL', 'gmake test', 'gmake install'. ('auto\Cairo\Cairo.a' was created and installed.) One test failed: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t/CairoFont.t ..... 1/29 unknown cairo_font_type_t value 5 encountered + at t/CairoFont.t line 79. # Failed test at t/CairoFont.t line 79. # Looks like you failed 1 test of 29. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ################### Cairo-GObject-1.005 ################### Accessing same renamed libraries as I used with my own build of perl. No need to amend CPATH environment variable. Run 'perl Makefile.PL' The generated Makefile correctly lists (in both EXTRALIBS and LDLOADLI +BS) the 'auto/Glib/Glib.a' file. But it misses the 'auto/Cairo/Cairo.a' file. Therefore, at the beginnig of both the EXTRALIBS and LDLOADLIBS entrie +s in the generated Makefile, we need to insert the full path to that Cairo.a file. For me, I insert: "C:\sp\_64\sp-5.38.0\perl\site\lib\auto\Cairo\Cairo.a" Run 'gmake test', 'gmake install'. All tests passed. ########### Pango-1.227 ########### Accessing same renamed libraries as I used with my own build of perl. set CPATH=%CPATH%;D:\msys64\mingw64\include\pango-1.0;D:\msys64\mingw6 +4\include\harfbuzz Run 'perl Makefile.PL' Again, 'auto/Cairo/Cairo.a' is omitted from EXTRALIBS and LDLOADLIBS. Again, in both places, I insert: "C:\sp\_64\sp-5.38.0\perl\site\lib\auto\Cairo\Cairo.a" Run 'gmake test', 'gmake install'. All tests passed. ############ Gtk2-1.24993 ############ Accessing same renamed libraries as I used with my own build of perl. set CPATH=%CPATH%;D:\msys64\mingw64\include\gtk-2.0;D:\msys64\mingw64\ +lib\gtk-2.0\include;D:\msys64\mingw64\include\gdk-pixbuf-2.0;D:\msys6 +4\mingw64\include\atk-1.0 Run 'perl Makefile.PL' EXTRALIBS and LDLOADLIBS both include 'auto/Glib/Glib.a' and 'auto/Pan +go/Pango.a' but again, 'auto/Cairo/Cairo.a' is omitted from EXTRALIBS and LDLOADLI +BS. Again, in both places, I insert: "C:\sp\_64\sp-5.38.0\perl\site\lib\auto\Cairo\Cairo.a" Run 'gmake test', 'gmake install'. In addition to t/GtkStyle.t (which crashes the entire test suite), we get the following report: Test Summary Report ------------------- t/01.GtkWindow.t (Wstat: 65280 (exited 255) Tests: 0 F +ailed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 120 tests but ran 0. t/GdkDisplay.t (Wstat: 256 (exited 1) Tests: 27 Fail +ed: 1) Failed test: 23 Non-zero exit status: 1 t/GdkImage.t (Wstat: 256 (exited 1) Tests: 23 Fail +ed: 1) Failed test: 1 Non-zero exit status: 1 t/GdkInput.t (Wstat: 65280 (exited 255) Tests: 0 F +ailed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 20 tests but ran 0. t/GdkKeys.t (Wstat: 65280 (exited 255) Tests: 0 F +ailed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 46 tests but ran 0. t/GdkPixbuf.t (Wstat: 256 (exited 1) Tests: 112 Fai +led: 1) Failed test: 44 Non-zero exit status: 1 t/GtkAccelGroup.t (Wstat: 65280 (exited 255) Tests: 0 F +ailed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 19 tests but ran 0. t/GtkAccelMap.t (Wstat: 65280 (exited 255) Tests: 0 F +ailed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 24 tests but ran 0. t/GtkStock.t (Wstat: 65280 (exited 255) Tests: 0 F +ailed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 9 tests but ran 0. t/GtkWidget.t (Wstat: 65280 (exited 255) Tests: 0 F +ailed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 158 tests but ran 0. t/PangoFontset.t (Wstat: 256 (exited 1) Tests: 7 Faile +d: 1) Failed test: 1 Non-zero exit status: 1 Files=227, Tests=4544, 42 wallclock secs ( 0.02 usr + 0.05 sys = 0.0 +6 CPU) Result: FAIL Failed 11/227 test programs. 4/4544 subtests failed. gmake: *** [makefile:3727: test_dynamic] Error 255 This is (apparently) worse than the results I got on my own build of p +erl-5.38.0, which reported only 5/227 failing test programs. I don't know what accounts for the difference, but it would be interes +ting to know. ############################### Glib-Object-Introspection-0.050 ############################### Accessing same renamed libraries as I used with my own build of perl. set CPATH=%CPATH%;D:\msys64\mingw64\include\gobject-introspection-1.0 Run 'perl Makefile.PL', 'make install'. (Can't make any sense of 'make + test' at all.) ########## Gtk3-0.038 ########## Run 'perl Makefile.PL', 'make test'. All 22 tests fail - needs investigating, no point in installing. On my own build of perl-5.38.0, only 3 of the 22 tests failed. Could there be some interference from libraries in Strawberry's c/lib +folder ?
      Cheers,
      Rob
        The poorer result for the Gtk2-1.24993 tests that I get with Strawberry Perl is entirely due to the fact that perl/site/lib/Gtk2/Gdk/Keysyms.pm is generated as an empty file on Strawberry.
        When I replace that empty file with the correctly generated Keysyms.pm that my own build of perl-5.38.0 created, then I get identical results of "5/227 failing test programs", not "11/227 failing test programs.
        I tried to put the contents of that Keysyms.pm on my scratchpad, but it's too big for perlmonks to accommodate.
        If anyone wants a copy of it just /msg me with an email address I can post it to.

        I don't know why Strawberry doesn't provide the same Keysyms.pm. (I've got some notes on my Windows 7 machine from 5 years ago that inform me that the same thing happened back then, too.)

        I've also got some old notes stating that installing Font::FreeType improves the capabilities of Cairo.
        I was going to try that out, but Devel::CheckLib is a prereq, and I'm not up to dealing with that annoying hoop tonight.

        <UPDATE>
        I've now (approx 24 hours later) built and installed Font-FreeType-0.16. It builds and tests fine, but doesn't change anything AFAICS. To build Font-FreeType, I replaced the Makefile.PL that ships with the distro with:
        use strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Font::FreeType', AUTHOR => 'Geoff Richards <qef@laxan.com>', VERSION_FROM => 'lib/Font/FreeType.pm', LIBS => '-LD:/msys64/mingw64/lib -lfreetype', INC => '-ID:/msys64/mingw64/include/freetype2', );
        </UPDATE>

        I've yet to work out why Gtk3 is so broken on the Strawberry build.
        The (fairly fundamental) problem is that the following runs fine on my own build of perl-5.38.0:
        D:\>perl -MGtk3 -wle "my ($success, $rest) = Glib::Object::Introspecti +on->invoke ('Gtk', undef, 'init_check', [$0, @ARGV]); print 'ok';" ok
        But on Strawberry's 5.38.0, running the same command, I get:
        D:\>perl -MGtk3 -wle "my ($success, $rest) = Glib::Object::Introspecti +on->invoke ('Gtk', undef, 'init_check', [$0, @ARGV]); print 'ok'" Could not prepare a call interface at -e line 1.
        Looks like the problem lies with the Glib-Object-Introspection module.

        Cheers,
        Rob
        Get error message from event log or what not (depends.exe)