[R] question about Rcmd SHLIB

Liqiang Ni lni at mail.ucf.edu
Sun Oct 17 23:28:37 CEST 2004


Yes. I think I followed readme.packages advice about mingw, perl etc. I
am using R 1.8.1. Here is another experiment I just ran. It was
successful.

C:\Fu>Rcmd SHLIB lasso.f
gcc  --shared -s  -o lasso.dll lasso.def lasso.a 
-LC:/PROGRA~1/R/rw1081/src/gnu
win32  -lg2c -lR

But if I ran one of the two fortran files I wanted to created a shared
object .dll, it does not work. 
C:\lasso>Rcmd SHLIB cox.f
g77 -O2 -Wall   -c cox.f -o cox.o
cox.f: In subroutine `initcx':
cox.f:3: warning: unused variable `p'
cox.f: In function `linvc':
cox.f:182: warning: `linvc' might be used uninitialized in this
function
cox.f: In function `weigtc':
cox.f:186: warning: `weigtc' might be used uninitialized in this
function
cox.f: In function `dirivc':
cox.f:190: warning: `dirivc' might be used uninitialized in this
function
ar cr cox.a *.o
ranlib cox.a
gcc  --shared -s  -o cox.dll cox.def cox.a 
-LC:/PROGRA~1/R/rw1081/src/gnuwin32
 -lg2c -lR
f77 -O2 -Wall    all.f libR makeMakedeps cox.dll   -o all
make: *** [all] Error 255

Thanks for any suggestion.

Liqiang Ni
Assistant Professor,  
Department of Statistics,  University of Central Florida, 
Orlando, FL 32816-2370  Email: lni at mail.ucf.edu

>>> Duncan Murdoch <murdoch at stats.uwo.ca> 10/17/2004 4:20:29 PM >>>
On Sun, 17 Oct 2004 16:08:04 -0400, "Liqiang Ni" <lni at mail.ucf.edu>
wrote:

>Dear R-people:
>
>I tried to create a shared library in Windows XP. However I got error
>messages which attached below:
>
>C:\lasso>Rcmd SHLIB all.f cox.f
>gcc    all.o libR makeMakedeps all.dll   -o all
>gcc.exe: libR: No such file or directory
>gcc.exe: makeMakedeps: No such file or directory
>make: *** [all] Error 1
>
>I have created shard libraries successfully before. Also for the same
>fortran files: all.f cox.f, I can create the object all.so
successfully
>in Linux using R SHLIB. Any suggestion? Thanks. 

You don't say which versions you're using.  I just tried this in
version 2.0.0, and got the following:

$ Rcmd SHLIB test.f test2.f
g77 -O2 -Wall   -c test.f -o test.o
g77 -O2 -Wall   -c test2.f -o test2.o
ar cr test.a test.o test2.o
ranlib test.a
gcc  --shared -s  -o test.dll test.def test.a
-Lf:/R/rw2000/src/gnuwin32  -lg2c
 -lR

So it looks to me as though you're not using the same SHLIB script as
me, or there's something wrong with your setup.  Did you set up your
path the way README.packages advises?

Duncan Murdoch




More information about the R-help mailing list