in reply to Re^4: Perl Tk on a Mac
in thread Perl Tk on a Mac

this looks promising: cpanm Tk build errors especially the last comments

It could well be that, as srini@pm suggests in his solution, a difference in the C standard of a probably included Tk header file in the C testfile it tries to compile.

but perhaps you could also find what the offending C test program is for which the compiler (with the specific flags) fails.

Replies are listed 'Best First'.
Re^6: Perl Tk on a Mac
by 1nickt (Canon) on Mar 20, 2025 at 13:41 UTC

    Thanks bliako,

    export CFLAGS="-ansi" export LDFLAGS="-ansi" export CPPFLAGS="-ansi"
    worked to get the configure step completed.

    Now the test run is hanging... I'll dig into that. I'm seeing some Tk windows being created in the tests that are running, though...


    The way forward always starts with a minimal test.

      choroba I got along further with this morning's attempt. I used the old classic perl Makefile.PL; make; make test; and got as far as:

      "/Users/nick/perl5/perlbrew/perls/perl-5.40.1/bin/perl" "-I../t" "-MTk +Test" "-e" "checked_test_harness('../xt', 0, '../blib/lib', '../blib/ +arch')" t/*.t t/basic.t .. 1/5


      Following the advice in Re: UPDATE 2: Problem Installing Perl-Tk on macOS Monterey (12.6) with Apple M1 chip I renamed the two test files in ./PNG/t and the test suite ran to completion. The output was:

      Test Summary Report ------------------- t/listbox.t (Wstat: 0 Tests: 537 Failed: 0) TODO passed: 320-322, 328, 502 t/photo.t (Wstat: 11 (Signal: SEGV) Tests: 1 Failed: +0) Non-zero wait status: 11 Parse errors: Bad plan. You planned 111 tests but ran 1. t/text.t (Wstat: 0 Tests: 415 Failed: 0) TODO passed: 121 t/wm-tcl.t (Wstat: 0 Tests: 315 Failed: 0) TODO passed: 64, 86-87, 154-159, 164-165, 171-178, 221-224 237-239, 264-267, 275-276, 280-283, 300 t/zzScrolled.t (Wstat: 0 Tests: 94 Failed: 0) TODO passed: 52, 66, 80, 94 Files=76, Tests=4257, 62 wallclock secs ( 0.32 usr 0.16 sys + 9.52 c +usr 1.97 csys = 11.97 CPU) Result: FAIL Failed 1/76 test programs. 0/4257 subtests failed. make: *** [test_dynamic] Error 255
      I never saw any errors though, so I ran make install and it succeeded.

      I was then able to run the hello, world program:

      #!/usr/bin/perl use strict; use warnings; use Tk; my $mw = MainWindow->new; $mw->title("Hello World"); $mw->Button(-text + => "Done", -command => sub { exit })->pack; MainLoop;

      Hope this helps!


      The way forward always starts with a minimal test.
        I was able to skip the two failing tests, too, and install Tk. A small app with a single button worked fine, but the app I needed to run uses PNG images and crashes with a SIGSEGV in the same way as the two tests. I have no idea how to fix that.

        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      unlikely because you see *some* windows but perhaps the xserver?