[R] Can R (without GUI) be compiled with static linking?

Duncan Murdoch murdoch.duncan at gmail.com
Fri Jul 29 01:11:22 CEST 2011

On 28/07/2011 5:54 PM, Jonathan Callahan wrote:
> I have a potential client that is considering R for data analysis and
> visualization modules within a larger framework. The host systems run either
> Solaris or a version of Linux.

Hopefully this client will respect the R license, and license their 
larger framework in a compatible way.

> One of their requirements (hard or soft?) is that each module in the
> framework be compiled with statically linked libraries into a standalone
> binary that can be run from the command line.
> I intend to recommend using R for many of their analytical components. I
> will recommend setting up a full R environment and packaging up new
> functionality for easy deployment. Then they can simply use R in batch
> mode:  R --vanilla<xyz.r>  xyz.out
> But if they insist on only using modules that are stand-alone, statically
> linked binaries I will need answers to the following questions:
> 1) Are the distributed R binaries statically linked?

I think this depends on the target platform, but clearly the answer is: 
  just look at the one that interests you.

> 2) Is the R code that runs in batch mode statically linked? (i.e. Will it
> break depending upon what shared libraries are installed?)

It will be the same as the rest of the install.

> 3) Is it possible to create a statically linked R that can be run "in batch
> mode"?

I believe so.

> 4) If not, how much C (or python? ;-D) code do I have to write to get to the
> point of having a stand-alone binary that can follow the instructions in an
> R script?

See the "Writing R Extensions" manual chapter on front ends.

Duncan Murdoch

More information about the R-help mailing list