[Rd] R CMD SHLIB failure (Win7 64-bit OS)

Luke Hartigan luke.hartigan at bigpond.com
Fri Jun 27 12:17:55 CEST 2014

Dear all,

I am struggling to get the 'Rtools' tool chain to successfully build .dlls
using the "R CMD SHLIB" method on my home Win7 64-bit (Ultimate) PC.
Strangely I did get it working on my work PC (also Win7 64-bit but
Enterprise) so I am totally at a loss as to what to do.

When I type, "R CMD SHLIB foo.c" using the Command Prompt I get:

make: *** No rule to make target 'foo.o', needed by 'foo.dll'. Stop.
Warning message:
running command 'make -f "C:/R/R-3.1.0/etc/x64/Makeconf" -f
"C:/R/R-3.1.0/share/make/winshlib.mk" SHLIB="filename.dll" WIN=64 TCLBIN=64
OBJECTS="filename.o"' has status 2

NB: I am using R-3.1.0 and the most current Rtools suitable for R-3.1.0 as

To clarify, I installed R-3.1.0 (64-bit) on "C:\R\R-3.1.0". I installed
Rtools to "C:\R\Rtools". I have placed these at the front of my PATH as
directed as well.

Here is my path:

am Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files
(x86)\Intel\iCLS Client\;C:\Program 
\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R)
Management Engine Components\IPT;C:\Program Files\MiKTeX
Files\MATLAB\R2013b\runtime\win64;C:\Program Files\MATLAB\R2013b\bin

There does not seem to be any spaces which might cause an issue.

Strangely, if I type: "R --version" at the Command Prompt I get the usual
notice saying I have R version 3.1.0 (2014-04-10)

If I type: "R CMD config CC" I get: 

gcc -m64

If I type: "R CMD config CFLAGS" I get: 

-O2 -Wall -std=gnu99 -mtune=core2

If I manually type in:

gcc -m64 -I"C:/R/R-3.1.0/include" -O2 -Wall -std=gnu99 -mtune=core2 -c
<filename.c> -o <filename.o>

gcc -m64 -shared -s -static-libgcc -o <filename.dll> <filename.o>
-LC:/R/R-3.1.0/bin/x64 -lR

I do get a .dll file which does work in R using dynload("filename.dll"), so
I am wondering if it might be related to the "Makeconf" file?

As another test, if I type in R:


I get:

make: *** No rule to make target `foo.o', needed by `foo.dll'.  Stop.
Warning message:
running command 'make -f "C:/R/R-3.1.0/etc/x64/Makeconf" -f
"C:/R/R-3.1.0/share/make/winshlib.mk" SHLIB="foo.dll" WIN=64 TCLBIN=64
OBJECTS="foo.o"' had status 2 
Error: Command failed (1)

I would greatly appreciate any suggestions on how I could get this to work
or what I am doing wrong.

Many thanks,


More information about the R-devel mailing list