Hi, I have just learned how to use compile and link libraries using "make" and how to create R projects using R CMD build or INSTALL. My understanding of both is somewhat limited and hence the question. I have a main library written in c which depends on other external libraries. Main library is to be called from R using .Call. The goal is to create a single R project that will compile all the external libraries, the main library, R-C wrappers and install it. I am unsure about the proper structure of R project directories and the general workflow such that: (a) external libraries and the main libraries are built first using "make" that I already have (b) R-C Wrapper is compiled and installed using R CMD install. I understand that there are issues using Makefiles and that there are preferred ways of doing these things. I am not sure how to use Makevars instead of Makefile for this purpose. Any help and in particular pointers to examples of R packages with multiple external libraries would be appreciated. Thanks in advance, Russ [[alternative HTML version deleted]]
Seth Falcon
2010-Feb-11 22:52 UTC
[Rd] Compiling R projects with multiple external libraries
On 2/11/10 9:43 AM, rt wrote:> Hi, > > I have just learned how to use compile and link libraries using > "make" and how to create R projects using R CMD build or INSTALL. My > understanding of both is somewhat limited and hence the question. > > I have a main library written in c which depends on other external > libraries. Main library is to be called from R using .Call. The goal > is to create a single R project that will compile all the external > libraries, the main library, R-C wrappers and install it. I am unsure > about the proper structure of R project directories and the general > workflow such that: (a) external libraries and the main libraries are > built first using "make" that I already have (b) R-C Wrapper is > compiled and installed using R CMD install. > > I understand that there are issues using Makefiles and that there > are preferred ways of doing these things. I am not sure how to use > Makevars instead of Makefile for this purpose. Any help and in > particular pointers to examples of R packages with multiple external > libraries would be appreciated."1.2.1 Using Makevars" in WRE (R-ext manual) has some detail on this and suggests looking at fastICA for an example. Quote from manual:> If you want to create and then link to a library, say using code in a > subdirectory, use something like > > .PHONY: all mylibs > > all: $(SHLIB) $(SHLIB): mylibs > > mylibs: (cd subdir; make)+ seth -- Seth Falcon | @sfalcon | http://userprimary.net/user