[Rd] Static R Build

Simon Urbanek simon.urbanek at r-project.org
Fri Nov 4 22:32:22 CET 2011


On Nov 4, 2011, at 4:37 PM, Michael Yan wrote:

> Hello,
> 
> I am trying to build a statically linked R linux binary that can be shipped around to different unknown linux environments without having to rely on its local shared libraries.  However, it seems like the configure flag
> 
> --enable-static
> 
> doesn't produce the desired effect.

That flag has nothing to do with that - it governs how R library will be built, not what it links against.


>  How may I do this?
> 

Make sure you link against static libraries, but you must make sure they have PIC (if relevant for your platform). How you do that depends heavily on your system setup (and it gets really hard if you want to have things like Tcl/Tk,  ..). The easiest is to simply install static libraries only so the linker picks them up automatically. Alternatively, you can specify static libraries directly as files (remmebr that you'll need to inslude dependecies, though, since static libraries don't have dependency chain resolution). Also depending on your compiler and/or how far you want to go, you may want to use -static-libgcc and friends (but, again, you must make sure they are PIC since they will be used from shared objects: packages).

Alternative route is to put dependent shared objects into $R_HOME/lib - that's in fact by far the easiest.

Cheers,
Simon



> Thank you for your help,
> Michael
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 



More information about the R-devel mailing list