I installed tkdiff as root, and it runs fine under that user, but when I switch to a local user I get the error:

Application initialization failed: Can't find a usable init.tcl in the following directories:
/usr/local/lib/tcl8.0 /pune/tools/synopsys/vera/2009.12-6/vera_vD-2009.12-6_linux/lib/tcl8.0 /pune/tools/synopsys/vera/2009.12-6/tcl8.0/library /pune/tools/synopsys/vera/2009.12-6/vera_vD-2009.12-6_linux/library

This probably means that Tcl wasn't installed properly.

Error in startup script: can't find package Tk 8.0
while executing
"package require Tk 8.0"
(file "./tkdiff" line 32)

How do I fix this?


Where did the installation of TCL/Tk come from? It looks like it's bundled with Synopsys, particularly their Vera software. Do you really mean to use their version of TCL/Tk with tkdiff?

This looks to me to be a $PATH issue. You're not picking up the correct installation that tkdiff was built to use, you're using the one provided by Synopsys.

tkdiff packaging

I'm on CentOS 5.8 and I have the following package that's available from the repositories that provides tkdiff.

$ yum search tkdiff
Loaded plugins: fastestmirror
========================================================= Matched: tkdiff ==========================================================
tkcvs.noarch : Graphical interface to the CVS and Subversion

You can make sure that the executable, tkdiff is in fact part of this package using this command:

$ repoquery -l tkcvs |  grep tkdiff

This package depends on the following other packages:

$ yum deplist tkcvs
Loaded plugins: fastestmirror
Finding dependencies: 
package: tkcvs.noarch 8.2.2-1.el5.rf
  dependency: /usr/bin/env
   provider: coreutils.x86_64 5.97-34.el5_8.1
  dependency: /bin/sh
   provider: bash.x86_64 3.2-32.el5
   provider: bash.x86_64 3.2-32.el5_9.1
  dependency: tcl
   provider: tcl.x86_64 8.4.13-6.el5
   provider: tcl.i386 8.4.13-6.el5
  dependency: tk
   provider: tk.x86_64 8.4.13-5.el5_1.1
   provider: tk.i386 8.4.13-5.el5_1.1

To confirm

You could test my hypothesis out by temporarily removing the Synopsys software from your $PATH, and then trying to launch tkdiff without the references to Synopsys.

Simply set the $PATH variable without inclusion of any of these paths:

  • /usr/local/lib/tcl8.0
  • /pune/tools/synopsys/vera/2009.12-6/vera_vD-2009.12-6_linux/lib/tcl8.0
  • /pune/tools/synopsys/vera/2009.12-6/tcl8.0/library
  • /pune/tools/synopsys/vera/2009.12-6/vera_vD-2009.12-6_linux/library

Also make sure that $TCL or $TCL* type variables aren't referencing these directories either.

Works for userA not for userB, how to debug?

If you've come across the situation where this is working for userA but not for userB then it's most likely a environment configuration problem. To debug this I'd do the following:

[userA]$ env > userA_env.txt
[userB]$ env > userB_env.txt

Then diff the 2 files to see what's different:

$ diff -y userA_env.txt userB_env.txt | less
rvm_gemsets_path=/home/saml/.rvm/gemsets                        rvm_gemsets_path=/home/saml/.rvm/gemsets
MANPATH=/home/saml/apps/perl5/perlbrew/perls/perl-5.14.0/man:   MANPATH=/home/saml/apps/perl5/perlbrew/perls/perl-5.14.0/man:
ORBIT_SOCKETDIR=/tmp/orbit-saml                                 ORBIT_SOCKETDIR=/tmp/orbit-saml
rvm_scripts_path=/home/saml/.rvm/scripts                        rvm_scripts_path=/home/saml/.rvm/scripts
PERLBREW_VERSION=0.59                                           PERLBREW_VERSION=0.59
HOSTNAME=grinchy                                                HOSTNAME=grinchy
rvm_bin_path=/home/saml/.rvm/bin                                rvm_bin_path=/home/saml/.rvm/bin
GPG_AGENT_INFO=/tmp/keyring-Xewu2I/gpg:0:1                      GPG_AGENT_INFO=/tmp/keyring-Xewu2I/gpg:0:1
PERLBREW_PERL=perl-5.14.0                                       PERLBREW_PERL=perl-5.14.0

The entries on the left will be from userA and the entries on the right will be from userB.

  • Xlib: connection to "ospvnc01:22.0" refused by server Xlib: No protocol specified Application initialization failed: couldn't connect to display "ospvnc01:22" Error in startup script: can't find package Tk 8.0 while executing "package require Tk 8.0" (file "./tkdiff" line 32) Now i am getting this error – user45898 Aug 27 '13 at 11:08
  • @user45898 - when do you get this error? When invoking tkdiff? This is an issue with your $DISPLAY not being set correctly. If you're sitting on the machine make sure it's set like so: export DISPLAY=:0.0. – slm Aug 27 '13 at 13:54
  • When i set the DISPLAY after that if am running tkdiff getting the same error which i mentioned first "Application initialization failed ...".As per your answer i checked all and set the PATH also.One of my colligue said it will be the user Env. problem, because he can set the DISPLAY and able to use tkdiff,even we both are same team. If it is like that how can i check .I am new to this field please help me.and THANKS for giving response for my queries.. – user45898 Aug 28 '13 at 17:07
  • @user45898 - if one user's env. is working OK and another's is not, then I would suggest dumping both out to 2 files and then diffing the files. I'll add a section in the answer on how to do this shortly. – slm Aug 29 '13 at 0:16
  • @user45898 - see updates. – slm Aug 29 '13 at 0:24

A common short-cut to figuring out such problems is to strace the program when run as root, grep for the file that you have trouble finding as user (in your case init.tcl) and make that part of the file system usable by normal users and not just by root via chmod.

  • Hi I run strace "package require Tk 8.0" (file "/usr/local/bin/tkdiff" line 32)) = 113 write(2, "\n", 1 ) = 1 fcntl64(2, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE) fcntl64(2, F_SETFL, O_RDWR|O_LARGEFILE) = 0 fcntl64(2, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE) exit_group(1) = ? I am new can any one advice and provide a solution – user45898 Aug 26 '13 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.