[R] tcltk loading in R-2.2.1 from src

Erik Iverson iverson at biostat.wisc.edu
Thu Mar 9 20:00:49 CET 2006


Patrice -

I had a very similar problem using TCL/TK 8.3.
Below is the email I sent to my computing group at work about how I 
fixed it.  Note that since my TCL/TK header (.h) files were in an odd 
location, the first step probably isn't relevant for you.  But I bet the 
second step is.

----------------------------------------------------------------------
I believe I have found the solution to this problem.  There were 2 steps 
I took to get a build of R in my home directory that properly uses 
Tcl/Tk 8.3 under Linux.

The first was setting an environment variable to let R know where the 
tcl.h and tk.h files reside.  This environment variable was 
TCLTK_CPPFLAGS and is set to -I/s/include .  This can bet set in the 
config.site in R's build directory also.

(NOTE to R-help: The above is site specific to my location, /s is for 
software on the network.)

Second, there is some problem with the way R interacts with the 
tkConfig.sh file in /s/lib (or wherever your .sh file is located).  It 
comes from the following line in tkConfig.sh.


TK_XINCLUDES='# no special path needed'

The "#" character, indicating a comment, is somehow misinterpreted by 
the configure script which breaks the Tcl/Tk functionality.  I was able 
to get around this by simply removing the comment and leaving it as
TK_XINCLUDES=''

That got me a working version of the newest R using Tcl/Tk.  I'm not 
sure if Tcl/Tk version 8.4 would still put that comment in there, I 
believe it's changed though, so you'd only have to follow the first step 
to get R compiled with Tcl/Tk support.

I found reference to this problem on the R mailing list, it appears to 
only affect certain installations of Tcl/Tk.

---------------------------------------------------------------------
HTH,
Erik Iverson

Patrice Seyed wrote:
> Hi,
> 
> Having trouble loading tcltk in R 2.2.1 built from source.
> 
> ./configure, make, make check, and make install run ok.
> 
> 
>  > library(tcltk)
> Error in firstlib(which.lib.loc, package) :
>         Tcl/Tk support is not available on this system
> Error in library(tcltk) : .First.lib failed for 'tcltk'
> 
> even though it is listed in library() output.
> 
> I have the same problem even if i compile with options:
> ./configure --with-tcltk --with-tcl-config=/usr/lib/tclConfig.sh 
> --with-tk-config=/usr/lib/tkConfig.sh
> 
> Is there a dep for R 2.2.1 on a specific version of tcl? Any hints on 
> this issue appreciated.
> 
> running on linux (2.4.21-4) version:
> rpm -qa | grep tcl
> tcl-devel-8.3.5-92
> tcl-8.3.5-92
> 
> Specifically, the package pbatR loads this library during installation.
> 
> Thanks,
> Patrice
>




More information about the R-help mailing list