Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Tk::Canvas not working

by BillKSmith (Monsignor)
on Dec 04, 2024 at 21:01 UTC ( [id://11163016]=perlquestion: print w/replies, xml ) Need Help??

BillKSmith has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl_Tk script which has recently started aborting with the following message.

Can't locate loadable object for module Tk::Canvas in @INC (@INC conta +ins: C:\Us ers\Bill\Perl\lib C:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread + C:/Strawb erry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/li +b) at C:\U sers\Bill\projects\fractal\mandelbrotTk.pl line 25. Compilation failed in require at C:/Strawberry/perl/site/lib/Tk/Widget +.pm line 268.

I am using Tk version 804.036001, Strawberry perl 5.38 under windows 7.

Strawberry perl 5.38 is the only perl on my computer. Several months ago I uninstalled a previous version of perl and installed 5.38, then installed Tk with the command cpan Tk. My existing script worked immediately and continued to until some time last week. I am certain that the script has not changed. I am not aware of any changes to perl, Tk, or any of its components, in fact, I have verified that the modules Tk.pm, Tk/widget.pm, and Tk/canvas.pm are all up to date and stored in C:/Strawberry/perl/site/lib. Another Tk script (which does not use canvas) still works.

Does "loadable object" refer to anything other than Tk/canvas.pm? I would appreciate any suggestion on finding and fixing the problem. Of course, I will post any additional material which may be helpful.

Bill

Replies are listed 'Best First'.
Re: Tk::Canvas not working
by syphilis (Archbishop) on Dec 05, 2024 at 00:08 UTC
    Does "loadable object" refer to anything other than Tk/canvas.pm?

    Yes - in this case it's referring to "auto/Tk/Canvas/Canvas.xs.dll" (or perhaps "auto/Tk/Canvas/Canvas.dll") - and that file needs to be in one of the @INC directories.
    You'd expect it to be in "C:/Strawberry/perl/site/lib", but it could also be in one of the other @INC directories.

    The first thing to do is to try reinstalling the Tk::Canvas module.
    If that is done, then things should start working again.

    Cheers,
    Rob
      I tried to follow your advice by first uninstalling the existing Tk::Canvas with the command cpanm --uninstall Tk::Canvas, and then reinstalling it with the command cpan Tk::Canvas. Uninstall was successful. The installation failed with messages ending as follows.

      In file included from ../pTk/mTk/xlib/X11/Xlib.h:31, from tkWinPort.h:19, from tkPort.h:32, from tk.h:87, from imgBMP.c:11: ../pTk/mTk/xlib/X11/X.h:182:34: error: expected identifier or '(' befo +re numeric constant 182 | #define ControlMask (1<<2) | ^ gmake[1]: *** [makefile:891: imgBMP.o] Error 1 gmake[1]: Leaving directory 'C:/STRAWB~1/cpan/build/Tk-804.036-2/pTk' gmake: *** [makefile:1638: pTk/libpTk.a] Error 2 SREZIC/Tk-804.036.tar.gz C:\STRAWB~1\c\bin\gmake.exe -- NOT OK Stopping: 'install' failed for 'Tk::Canvas'

      This does look familiar. I think that I did have this problem with my original installation of Tk, but do not remember the solution.

      UPDATE: Found my old notes. Refer Tk install fails. I had installed Tk with the command cpanm https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/patched_cpan_modules/Tk-804.036_001.tar.gz. Perhaps I should uninstall all of Tk and repeat that command.

      Bill
        Perhaps I should uninstall all of Tk and repeat that command

        Yes- that's the next thing to try. (Even if the uninstall fails, just forcing a reinstallation of that Tk distro should suffice.)
        It seems odd to me that "cpanm --install Tk::Canvas" tried to install Tk first. It suggests that your existing Tk installation is also unusable.

        Cheers,
        Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11163016]
Approved by marinersk
Front-paged by cavac
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2025-01-14 17:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (43 votes). Check out past polls.