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

I have Perl installed with perlbrew and configuration of the Tk package is failing with:

checking whether the C compiler (cc -fno-common -DPERL_DARWIN -mmacosx-version-min=14.7 -DNO_THREAD_SAFE_QUERYLOCALE -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -fno-common -DPERL_DARWIN -mmacosx-version-min=14.7 -DNO_THREAD_SAFE_QUERYLOCALE -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -mmacosx-version-min=14.7 -fstack-protector-strong -L/usr/local/lib) works... no configure: error: installation or configuration problem: C compiler cannot create executables. ERROR from evaluation of /Users/ntonkin/.cpanm/work/1742471200.46755/Tk-804.036/JPEG/Makefile.PL: ERROR from evaluation of /Users/nick/.cpanm/work/1742471200.46755/Tk-804.036/JPEG/jpeg/Makefile.PL: Error opening Makefile: No such file or directory at ./Makefile.PL line 41.

I installed gcc from Homebrew but it did not change the error message.


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^5: Perl Tk on a Mac
by bliako (Abbot) on Mar 20, 2025 at 12:41 UTC

    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.

      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.

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