Tk installation woes

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Greetings, gents.

I picked up Mastering Perl/Tk at my local library, and, anxious to try
it out on my home Slackware system, I downloaded Tk from CPAN, and
cd'ed into the directory.

perl Makefile.PL worked with no problem, however "make" gives me

cc -c  -I.. -I/usr/X11R6/include -I. -Ibitmaps -I/usr/X11R6/include -
D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -
march=i486 -mtune=i686   -DVERSION=\"804.027\" -DXS_VERSION=
\"804.027\" -fPIC "-I/usr/lib/perl5/5.12.3/i486-linux-thread-multi/
CORE"   -Wall -Wno-implicit-int -Wno-comment -Wno-unused -
In file included from Xlib_f.c:8:0:
Xlib.h:22:15: error: conflicting types for 'XKeycodeToKeysym'
/usr/include/X11/Xlib.h:1694:15: note: previous declaration of
'XKeycodeToKeysym' was here
make[1]: *** [Xlib_f.o] Error 1
make[1]: Leaving directory `/home/miro/Downloads/Tk-804.027/pTk'
make: *** [pTk/libpTk.a] Error 2

I'm not exactly a Perl (or manual compilation) guru, can anyone tell
me what I must do?

Re: Tk installation woes

Quoted text here. Click to load it

It's not a Perl problem but might be a bug in the C code
of Tk, probably the one discussed here:

There's also a proposed patch by Dominique Dumont I append in full
at the end. It consists of inserting into 'perl-tk-804.029/pTk/Xlib.h'
(or 'perl-tk-804.027/pTk/Xlib.h' in your case) a line with

#ifndef _X11_XLIB_H_

before the line with

 extern XFontStruct *XLoadQueryFont  _ANSI_ARGS_((Display *, const char *));

and another line with

#endif /* _X11_XLIB_H_ */

after the line with

extern int XSubtractRegion _ANSI_ARGS_((Region, Region, Region));

I can't promise that this will really fix the problem but it
might be worth a try.
                                  Regards, Jens

#! /bin/sh /usr/share/dpatch/dpatch-run
## All lines beginning with `## DP:' are a description of the patch.
## DP: Added a test that protect against double inclusion with recent
## DP: versions of Xlib.h provided by Xorg. The original test with X_LIB_H_
## DP: was not changed to avoid breaking build when backporting perl-tk
## DP: on older versions of Xorg.

diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git'
'--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr'
perl-tk-804.029~/pTk/Xlib.h perl-tk-804.029/pTk/Xlib.h
--- perl-tk-804.029~/pTk/Xlib.h    2007-02-10 09:55:23.000000000 +0100
+++ perl-tk-804.029/pTk/Xlib.h    2011-04-20 17:37:27.000000000 +0200
@@ -1,6 +1,7 @@
 #ifndef _XLIB
 #define _XLIB
 #ifndef _XLIB_H_
+#ifndef _X11_XLIB_H_
 extern XFontStruct *XLoadQueryFont  _ANSI_ARGS_((Display *, const char *));
 extern XModifierKeymap *XGetModifierMapping  _ANSI_ARGS_((Display *));
 extern XImage *XCreateImage  _ANSI_ARGS_((Display *, Visual *, unsigned int,
 int, int, char *, unsigned int, unsigned int, int, int));
@@ -143,6 +144,7 @@
 extern Window XGetSelectionOwner _ANSI_ARGS_((Display *, Atom));
 extern int XRectInRegion _ANSI_ARGS_((Region,int,int,unsigned,unsigned));
 extern int XSubtractRegion _ANSI_ARGS_((Region, Region, Region));
+#endif /* _X11_XLIB_H_ */
 #endif /* _XLIB_H_ */
 extern int _XInitImageFuncPtrs _ANSI_ARGS_((XImage *image));
 #endif /* _XLIB */

  \   Jens Thoms Toerring  ___

Re: Tk installation woes

On Oct 2, 9:12=A0am, (Jens Thoms Toerring) wrote:
Quoted text here. Click to load it
 did ^:
Wow. An unfixed bug that crippling in Tk? I thought it had been around
since the dawn of time? Linus's Law shudders.
Anywhoo, your patch worked great in that 'make' now took of without a
hitch (even though I have no idea what the hack I just :^)
I owe you and the community much gratitude.


Re: Tk installation woes

Quoted text here. Click to load it

Actually, as far as I understand the comments in the patch it's
about a new version of XLib Tk wasn't yet tested against - and
the guys taking care of the Tk stuff can't forsee everything
that's going to happen to things they necessarily have to depend
upon but have no influence over. If you closely look at the docu-
mentation you might even find some information against what they
tested and if you use something newer things can become "inter-

Quoted text here. Click to load it

all I did was a tiny bit of google'ing;-)

Quoted text here. Click to load it

                        Regards, Jens
  \   Jens Thoms Toerring  ___

Site Timeline