From phgrosjean at sciviews.org  Sun May  4 13:02:39 2008
From: phgrosjean at sciviews.org (Philippe Grosjean)
Date: Sun, 04 May 2008 13:02:39 +0200
Subject: [Rd] Change in the Tcl/Tk loading in R 2.7.0 (under Unix/Mac OS
 X)?
In-Reply-To: <alpine.LFD.1.10.0805041128060.13887@auk.stats.ox.ac.uk>
References: <481D8844.4000906@sciviews.org>
	<alpine.LFD.1.10.0805041128060.13887@auk.stats.ox.ac.uk>
Message-ID: <481D97CF.3040103@sciviews.org>

Prof Brian Ripley wrote:
> First, this does depend on what build of R you use.  The 'HAVE_AQUA' 
> define matters, and is only defined on some Mac OS X builds (e.g. not 
> the default one, but the one used for the CRAN binary).
> 
> Second, there are several possible versions of Tcl/Tk and X11 on MacOS 
> X, and as I suspect one of your R versions was not a CRAN build, I am 
> not willing to make assumptions here.  (E.g. I do run a self-compiled 
> command-line version of R using ActiveTcl's 8.5.2 code.)

> Finally, I see no evidence that this is not specific to Mac OS X, and 
> your desired behaviour is still present on other Unix-alikes.

Indeed!

> If you want the ability to start Tcl and not Tk on a CRAN build of R for 
> Mac OS X, I think you need to negotiate a way to do it as I believe it 
> is not intended to be available.  But that's definitely an R-sig-mac topic.

OK, thanks. I repost this question to r-sig-mac.

Philippe

> On Sun, 4 May 2008, Philippe Grosjean wrote:
> 
>> Hello,
>>
>> Up to R 2.6.2, I used to start Tcl *without Tk* (I need only Tcl for 
>> some part of my work, like a socket server written in Tcl only, for 
>> instance) with this code under Mac OS X (particularly on this system, 
>> because I don't want to start X11 just to use Tcl code, which is 
>> required for Tk!):
>>
>>> Sys.unsetenv("DISPLAY")
>>> library(tcltk)
>>
>> I got then the message "no DISPLAY variable so Tk is not available", 
>> but could work with Tcl without problems.
> 
> That message is only given if (src/library/tcltk/src/tcltk.c in both 
> 2.6.2 and 2.7.0)
> 
> #if !defined(Win32) && !defined(HAVE_AQUA)
> 
> so your 2.6.x build appears not to have been defining HAVE_AQUA, which a 
> CRAN build would.
> 
>> Now, with R 2.7.0, I got the following and Tcl failed to load:
>> Loading Tcl/Tk interface ... Error in fun(...) : no display name and 
>> no $DISPLAY environment variable
>> Error : .onLoad failed in 'loadNamespace' for 'tcltk'
>> Error: package/namespace load failed for 'tcltk'
>>
>> I try to locate the message "no display name and no $DISPLAY 
>> environment variable" in the code but I cannot find it. Could someone 
>> help me please?
> 
> I think it is coming from Tk_Init, at
> 
>         code = Tk_Init(RTcl_interp);  /* Load Tk into interpreter */
>         if (code != TCL_OK)
>             error(Tcl_GetStringResult(RTcl_interp));
> 
>>> sessionInfo()
>> R version 2.7.0 Patched (2008-04-22 r45460)
>> i386-apple-darwin8.10.1
>>
>> locale:
>> en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> Many thanks,
>>
>> Philippe Grosjean
>> -- 
>> ..............................................<?}))><........
>> ) ) ) ) )
>> ( ( ( ( (    Prof. Philippe Grosjean
>> ) ) ) ) )
>> ( ( ( ( (    Numerical Ecology of Aquatic Systems
>> ) ) ) ) )   Mons-Hainaut University, Belgium
>> ( ( ( ( (
>> ..............................................................
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>



[Rd] Change in the Tcl/Tk loading in R 2.7.0 (under Unix/Mac OS X)?
Philippe Grosjean