[R] build R on windows

Jennifer Lai lai at lindaspaces.com
Wed Mar 22 19:32:31 CET 2006

I narrowed down the problem to the socketConnection call within the 
package that I was trying to build.
The build package process seems to evaluate initialize function, which 
is where socketConnection invoked in the package.

example code:
 >    socketConnection("localhost", 8888)

So,  if there is no server listening on the localhost, port 8888, then 
the build process will hang until  N seconds (specify by timeout value) 
has passed. With a very large timeout value, the process can look like 
it's hanging and never returns.

I then experiment with firewall settings on Windows, thinking it might 
have some clues to what was happening.
It turned out that firewall has no effect when the client is a Windows 
box, and server resides on a Linux box or a Windows box. By no effect, I 
socketConnection to a host and non-listening port will only return after 
timeout value has expired.
However, firewall has effect when the client is a Linux box, and the 
server resides on a Windows box.  With firewall on, socketConnection 
will return
after timeout value expired. With firewall off, socketConnection returns 
almost immediately.

What about if both client and server are Linux boxes. As it turned out, 
socketConnection also returns immediately, even if no one is listening 
to the port.

Is there any workaround to this, besides setting timeout value to a very 
small value?  Since this timeout value also controls the timeout on 
receiving data, therefore we would like to make it as large as possible.


Duncan Murdoch wrote:

> On 3/21/2006 6:14 PM, Jennifer Lai wrote:
>> Hi,
>>     I'm not sure if this question has been answered before, but when 
>> I execute command  "Rcmd INSTALL --build nws" to build an R package 
>> on Windows,
>> the build process got stucked on the save image step.
>> Here is the snapshot of the build process,
>> --- Making package nws ----
>>    adding build stamp to DESCRIPTION
>>    installing NAMESPACE file and metadata
>>    installing R files
>>    save images
>> The build process never returns unless I Ctrl-C out of it.
>> I also tried with removing SaveImage option from the DESCRIPTION 
>> file. This time, the build process got stucked at lazy loading step.
>> I then set LazyLoad option to no in the DESCRIPTION file, this allows 
>> the build process to generate a zip file. However, when I load the 
>> library in R command console
>> by typing "library(nws)", the command just hung trying to load the 
>> library.
>> Here is the content of the description file,
>> Package: nws
>> Title: R functions for NetWorkSpaces and Sleigh
>> Version: 1.3.0
>> License:  GPL Version 2 or later
>> Depends: R (>=2.1), methods
>> SaveImage: true
>> URL: http://nws-r.sourceforge.net
>> Is there any subtlety between building R packages in Linux and 
>> Windows? I can build and load this package under Linux. But can't 
>> figure out what's causing the hang on Windows and how to debug the 
>> problem.  Has anyone ran into similar problem before, and steps you 
>> took to debug the problem?
>> I very much appreciate any help you can provide. Thanks!
> The main subtlety is that on Windows you need to install most of the 
> tools yourself.  Read the instructions in the R Installation and 
> Administration manual, and follow them exactly.  A common error is not 
> to put the R tools first in the PATH; then Windows finds the wrong 
> commands, and things go wrong.
> I don't know what debugging tools are available, other than editing 
> the scripts to print things out as they go along.  The scripts are 
> normally installed in the RHOME/bin directory.
> Duncan Murdoch
> Duncan Murdoch

More information about the R-help mailing list