[Rd] Re: [R] Rcmd SHLIB problem
Uwe Ligges
ligges@statistik.uni-dortmund.de
Wed, 12 Dec 2001 13:28:37 +0100
[moved to R-devel]
Prof Brian Ripley wrote:
>
> it should and does work with Fortran (and C++) files. The right format is
>
> Rcmd SHLIB tryf.f
>
> I've just tested that under rw1031 and the pretest of 1.4.0, so I've
> no idea what's up for you.
> B
>
> On Mon, 10 Dec 2001, Liaw, Andy wrote:
>
> > Dear R-help,
> >
> > I'm having problem creating a dll using Rcmd SHLIB with R-1.3.1 on WinNT4:
> >
> > C:\TEMP>Rcmd SHLIB tryf.o
> > make[1]: `libR.a' is up to date.
> > make: *** No rule to make target `'tryf.o', needed by `tryf.a'. Stop.
> >
> > C:\TEMP>Rcmd SHLIB tryf.f
> > make[1]: `libR.a' is up to date.
> > make: *** No rule to make target `'tryf.o', needed by `tryf.a'. Stop.
^^^^
Notice the quotes! Same problem here (R-1.4.0, unstable, NT4).
Not sure if it is a bug in R, in perl or in (what I presume) make.
To debug it, I took the relevant line from SHLIB (inserting the
variables):
make -f d:/uwe-ns/R140-071201/src/gnuwin32/MakeDll
RHOME=d:/uwe-ns/R140-071201 DEBUG=T DLLNAME=pan CFSOURCES='pan.f'
CXXSOURCES='' RCOBJ=
make: *** No rule to make target `'pan.o', needed by `pan.a'. Stop.
Now leaving out quotes at some places:
d:\uwe>make -f d:/uwe-ns/R140-071201/src/gnuwin32/MakeDll
RHOME=d:/uwe-ns/R140-071201 DEBUG=T DLLNAME=pan CFSOURCES='pan.f'
CXXSOURCES= RCOBJ=
make: *** No rule to make target `'pan.o', needed by `pan.a'. Stop.
make -f d:/uwe-ns/R140-071201/src/gnuwin32/MakeDll
RHOME=d:/uwe-ns/R140-071201 DEBUG=T DLLNAME=pan CFSOURCES=pan.f
CXXSOURCES='' RCOBJ=
g77 -O2 -g -Wall -c pan.f -o pan.o
make: *** No rule to make target `''.o', needed by `pan.a'. Stop.
make -f d:/uwe-ns/R140-071201/src/gnuwin32/MakeDll
RHOME=d:/uwe-ns/R140-071201 DEBUG=T DLLNAME=pan CFSOURCES=pan.f
CXXSOURCES= RCOBJ=
rm -f -f pan.a
ar cr pan.a *.o
ranlib pan.a
------- Building pan.dll from pan.a --------
echo LIBRARY pan > pan.def
echo EXPORTS >> pan.def
nm pan.a > Defs
sed -n '/^........ [BCDRT] _/s/^........ [BCDRT] _/ /p' Defs >> pan.def
rm -f Defs
gcc --shared -o pan.dll pan.def pan.a -lg2c
d:/uwe-ns/R140-071201/bin/R.dll
OK. This works now --- without any quotes - but where is the error?
The following line also works (other kind of quotes):
make -f d:/uwe-ns/R140-071201/src/gnuwin32/MakeDll
RHOME=d:/uwe-ns/R140-071201 DEBUG=T DLLNAME=pan CFSOURCES="pan.f"
CXXSOURCES="" RCOBJ=
As a summary: Changing the relevant line in SHLIB to
system("make -f $R_HOME/src/gnuwin32/MakeDll RHOME=$R_HOME $debug
DLLNAME=$dllname CFSOURCES=$srcs CXXSOURCES=$cxx RCOBJ=");
works, but that's not a general solution. And "double-quotes" cannot be
used two times.
Any ideas?
> > I compiled R from source, so I'm quite sure I've got all the right tools.
> > Can anyone explain what I'm missing? The FAQ only mentioned compiling C
> > code. I'd imagine that Fortran code works the same way, no?
> >
> > Any help/hint are much appreciated!
Uwe
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._