[Rd] a package installation problem on windows

Gang Liang gumpleon at gmail.com
Tue Jul 29 08:27:04 CEST 2008


Dear all,

I encountered a problem when test installing a package of my own under
the windows platform. The latest Rtools is installed, and Makefile.win
is used for directing the compilation of C++ codes under the src
directory. A sketch of the Makefile.win is as follows:

--- Makefile.win (old) ---------
all: part1.dll part2.dll

%.dll: %.cpp
	R CMD SHLIB $<
---------------------------------------

When I run "R CMD build --binary pakname", the Makefile.win is
executed without error, but to my surprise, the wanted dll files are
not produced as expected; thus, the binary package will be created
without dlls. While if I run make in the src directory manually, all
dll files will be created. This problem can be by-passed using my
updated Makefile.win,

--- Makefile.win (new) ---------
all: part1.dll part2.dll copy

%.dll: %.cpp
	R CMD SHLIB $<

copy: part1.dll part2.dll
	mkdir -p ../inst/libs
	cp *.dll ../inst/libs
---------------------------------------

It is ugly because I have to access the libs directory directly. My
question is what is the right syntax to compile codes using Makefile
then? Thanks very much!

Gang Liang

PS: Re the missing dll problem, my guess is that the command "R CMD
SHLIB ..." is doing the compilation on a memory disk, and the final
result is discarded right away. I even interrupted the compilation
midway, and am still not able to find any intermediate files on my
harddrive. On the other hand, the compilation is clearly done.



More information about the R-devel mailing list