Orville Weyrich
Orville Weyrich

Reputation: 29

Installing Tk on Strawberry Perl leads to compiler errors

I am running Strawberry Perl 5, version 38, subversion 0 (v5.38.0) built for MSWin32-x64-multi-thread I downloaded the latest version from CPAN (Tk-804.036) and tried perl makefile.pl but got a number of compiler errors. Following the thread “Tk build fails (Perl 5.36 sp536 20230420)#98" from @HaraldJoerg I made the following changes in the code:

  1. Changed all occurrences of ControlMask to ControlMask_BUGBUG in all .c and .h files in the project, i.e. pTk\mTk\xlib\X11\X.h, pTk\tkBind.c, pTk\tkWinKey.c, pTk\tkWinPointer.c, pTk\tkWinX.c, pTk\mTk\generic\tkBind.c

  2. Changed all occurrences of case SVt_IV: to

    #ifdef HAS_REAL_SVT_RV case SVt_RV: #endif

in all files containing the string SVt_RV, i.e config/svtrv.c, Event\pTkCallback.c

  1. Changed "op_pmdynflags" to "op_pmflags" and deleted the line containing "op_pmpermflags" in file config/pmop.c I was then able to make realclean and then do perl makefile.pl to get a clean compile except for a minor warning from the file config/Hstrdup.c about config/Hstrdup.c: implicit declaration of function 'exit'.

However make test still throws many concerning warnings about casting pointers to the wrong size integers, etc. I did make -i test and make -i install and then tried to run the following program (from the book by Lidie and Walsh):

use Tk;
my $mw = MainWindow->new;
$mw->title("Hello World");
$mw->Button( -text => "Done", -command => sub { exit} ) -> pack;
MainLoop;

This program silently does nothing (returns me to the command prompt without opening a window).

I am new to the arena of editing open-source software like Tk, and do not know how to approach officially submitting what I did to cure the compile errors (not sure why the main branch of Tk is broken in my environment – it must have worked somewhere!). But it still appears broken in some way, even after my changes. I think that the warnings about casting pointers during the test part does not necessarily reflect badly on the code being tested, but only on the test code itself, but I could be wrong. Does anyone know of a working version of Strawberry Perl that plays well with a working version of Tk?

Upvotes: 2

Views: 511

Answers (1)

clamp
clamp

Reputation: 3262

Tk-804.036 from CPAN does not build with recent versions of strawberry perl. There are patches available but no new release on cpan yet. A patched Tk branch is on github and can be installed with the following command:

cpanm  https://github.com/Lamprecht/[email protected] 

Upvotes: 1

Related Questions