From luke.hartigan at bigpond.com  Fri Jun 27 12:17:55 2014
From: luke.hartigan at bigpond.com (Luke Hartigan)
Date: Fri, 27 Jun 2014 20:17:55 +1000
Subject: [Rd] R CMD SHLIB failure (Win7 64-bit OS)
Message-ID: <000001cf91f1$105908d0$310b1a70$@bigpond.com>

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
directed.

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:

PATH=C:\R\Rtools\bin;C:\R\Rtools\gcc-4.6.3\bin;C:\R\R-3.1.0\bin\x64;C:\Progr
am Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files
(x86)\Intel\iCLS Client\;C:\Program 
Files\Intel\iCLS
Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\S
ystem32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;
C:
\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\Intel\Intel(R) 
Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R)
Management Engine Components\IPT;C:\Program Files\MiKTeX
2.9\miktex\bin\x64\;C:\SDE\TDM-GCC-64\bin;C:
\Anaconda;C:\Anaconda\Scripts;C:\Program
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:

library(devtools)
has_deve()

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,

Luke



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