Tk installation woes

M

Miro

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
this...

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 -
D__USE_FIXED_PROTOTYPES__ Xlib_f.c
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?
 
J

Jens Thoms Toerring

Miro said:
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
this...
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 -
D__USE_FIXED_PROTOTYPES__ Xlib_f.c
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?

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

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613188

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

-----------------------8<------------------------------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## fix-ftbs.dpatch by Dominique Dumont <[email protected]>
##
## 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.

@DPATCH@
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 */
-----------------------8<------------------------------------
 
M

Miro

Miro said:
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
this...
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 -
D__USE_FIXED_PROTOTYPES__ Xlib_f.c
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?

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

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613188

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

-----------------------8<------------------------------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## fix-ftbs.dpatch by Dominique Dumont <[email protected]>
##
## 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.

@DPATCH@
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 */
-----------------------8<------------------------------------
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.

--Miro
 
J

Jens Thoms Toerring

Miro said:
Wow. An unfixed bug that crippling in Tk? I thought it had been around
since the dawn of time? Linus's Law shudders.

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-
esting"...
Anywhoo, your patch

worked great in that 'make' now took of without a hitch

Fine;-)
Regards, Jens
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top