Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

package require Tk FAILS

274 views
Skip to first unread message

jerry...@gmail.com

unread,
Nov 22, 2009, 2:42:36 PM11/22/09
to
Howdy,

I just upgraded from Fedora 11 to Fedora 12 ( Tcl and Tk are at
8.5.7).

It appears that I cannot "package require Tk" from a tcl script
anymore...

I get a "can't find package Tk" error.

I am sure this was not a problem in my older Fedora 11 system.

I can get around the problem by using wish instead of tclsh but it is
aggravating...

Is there any way I can futze with the packages to get the old behavior
back?

Thanks,

Jerry

Robert Heller

unread,
Nov 22, 2009, 3:12:24 PM11/22/09
to
At Sun, 22 Nov 2009 11:42:36 -0800 (PST) "jerry...@gmail.com" <jerry...@gmail.com> wrote:

>
> Howdy,
>
> I just upgraded from Fedora 11 to Fedora 12 ( Tcl and Tk are at
> 8.5.7).

Is Tk in fact installed? Tk is NOT installed by default...

>
> It appears that I cannot "package require Tk" from a tcl script
> anymore...
>
> I get a "can't find package Tk" error.
>
> I am sure this was not a problem in my older Fedora 11 system.
>
> I can get around the problem by using wish instead of tclsh but it is
> aggravating...
>
> Is there any way I can futze with the packages to get the old behavior
> back?
>
> Thanks,
>
> Jerry
>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.deepsoft.com/ -- Binaries for Linux and MS-Windows
hel...@deepsoft.com -- http://www.deepsoft.com/ModelRailroadSystem/

jerry...@gmail.com

unread,
Nov 22, 2009, 4:09:27 PM11/22/09
to
On Nov 22, 3:12 pm, Robert Heller <hel...@deepsoft.com> wrote:

> At Sun, 22 Nov 2009 11:42:36 -0800 (PST) "jerry.le...@gmail.com" <jerry.le...@gmail.com> wrote:
>
>
>
> > Howdy,
>
> > I just upgraded from Fedora 11 to Fedora 12 ( Tcl and Tk are at
> > 8.5.7).
>
> Is Tk in fact installed?  Tk is NOT installed by default...
>

Yes it is...

[jerry@localhost Desktop]$ tclsh
% package require Tk


can't find package Tk

% exit
[jerry@localhost Desktop]$ wish
% package require Tk
8.5.7
%

Jerry

jerry...@gmail.com

unread,
Nov 22, 2009, 5:16:53 PM11/22/09
to
On Nov 22, 4:09 pm, "jerry.le...@gmail.com" <jerry.le...@gmail.com>
wrote:

Ok,

The problem appears to be caused by tclConfig.sh

The previous version ( 8.5.6) included /usr/lib/tk8.5 in the
TCL_PACKAGE_PATH

The current version (8.5.7) *does not*.

Is the most trouble free method of fixing this problem solved by
creating a 'package'
in the /usr/lib/tcl8.5 directory that will load libtk?

I run my Tk apps on several different architectures, so I am not to
keen modifying my source
code for this problem.

I am no sure of who to complain to in the fedora world in order to get
the problem fixed.

Thanks

Jerry

Larry W. Virden

unread,
Nov 23, 2009, 10:56:05 AM11/23/09
to
On Nov 22, 4:09 pm, "jerry.le...@gmail.com" <jerry.le...@gmail.com>
wrote:

But is the wish that you found from Fedora 11 or Fedora 12? It is
conceivable that you have some things from one version and some from
the other version in your path.

In _MY_ opinion, installing ActiveTcl is the best solution for a Linux
system. You not only get the binaries, but you get teacup and things
set up to allow you to easily add additional packages to the system.

However, you can always try to work things out with the Fedora team.

Larry W. Virden

unread,
Nov 23, 2009, 11:03:04 AM11/23/09
to
On Nov 22, 5:16 pm, "jerry.le...@gmail.com" <jerry.le...@gmail.com>
wrote:

> Ok,
>
> The problem appears to be caused by tclConfig.sh
>
> The previous version ( 8.5.6) included /usr/lib/tk8.5 in the
> TCL_PACKAGE_PATH
>
> The current version (8.5.7) *does not*.
>

Just an FYI - on my "built from the source" version of Tcl 8.5.4 on
SPARC Solaris, I see:
$ grep TCL_PACKAGE_PATH tclConfig.sh
TCL_PACKAGE_PATH='/usr/tcl85/lib '

(where /usr/tcl85 is the --prefix I used for installation).

In your case, what is more important is the contents of the $auto_path
variable in tclsh:

$ tclsh8.5
% put $auto_path
/usr/tcl85/lib/tcl8.5 /usr/tcl85/lib
%

The contents of auto_path are the places that tclsh is configured to
look for Tk. If you don't see the tk8.5 directory as well as the tk
libraries, etc there, then it would appear that fedora configured tcl
and tk with different --prefix or --exec_prefix arguments.

jerry...@gmail.com

unread,
Nov 23, 2009, 1:41:24 PM11/23/09
to

Yes, the problem was that tcl was built without placing the Tk library
in the
package search path (bummer).

My local fix was to create a Tk directory in the Tcl library and add a
pkgIndex.tcl file that contained:

if {[catch {package present Tcl 8.5.0-8.6}]} { return }
package ifneeded Tk 8.5.7 [list load [file join $dir ../..
libtk8.5.so] Tk
]

This will load the Tk lib when a 'package require Tk' is encountered
in a tcl
script.

I filed a complaint with the Fedora Bugzilla :)

Jerry

Don Porter

unread,
Nov 23, 2009, 1:50:08 PM11/23/09
to
jerry...@gmail.com wrote:
> Yes, the problem was that tcl was built without placing the Tk library
> in the
> package search path (bummer).

No, the problem is that Fedora apparently arranged for Tk to be
installed somewhere other than where Tcl looks for its packages. Since
I'm assuming both the Tcl and Tk you are testing are under Fedora
control, this is just boneheaded.

> My local fix was to create a Tk directory in the Tcl library and add a
> pkgIndex.tcl file that contained:
>
> if {[catch {package present Tcl 8.5.0-8.6}]} { return }
> package ifneeded Tk 8.5.7 [list load [file join $dir ../..
> libtk8.5.so] Tk
> ]

OK, it looks like they revised the Tcl install layout and package
search defaults to avoid the "search all of /usr/lib for packages"
problem (so avoiding some of Tcl's own boneheadedness :^) ) but then
somehow forgot to adjust Tk to compensate, leaving it installed out
where it can only be found by a Tcl still playing by the "search
/usr/lib" rules.

At least as well as I can guess.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|

0 new messages