From andy_liaw@merck.com  Wed Dec 12 13:45:35 2001
From: andy_liaw@merck.com (Liaw, Andy)
Date: Wed, 12 Dec 2001 08:45:35 -0500
Subject: [Rd] RE: [R] Rcmd SHLIB problem
Message-ID: <51F9C42DA15CD311BD220008C707D81903DC840D@usrymx10.merck.com>

Yes, changing line 67 of SHLIB as Uwe suggested worked:

C:\TEMP>Rcmd SHLIB tryf.f
make[1]: `libR.a' is up to date.
rm -f -f tryf.a
ar cr tryf.a *.o
ranlib tryf.a
------- Building tryf.dll from tryf.a --------
echo LIBRARY tryf > tryf.def
echo EXPORTS >> tryf.def
nm tryf.a > Defs
sed -n '/^........ [BCDRT] _/s/^........ [BCDRT] _/ /p' Defs >> tryf.def
rm -f Defs
gcc  --shared -s  -o tryf.dll tryf.def tryf.a  -Lc:/progra~1/R/rw1031/src/
gnuwin32  -lg2c -Lc:/Rtools/ATLAS/lib/WinNT_PIIISSE1 -lcblas -lf77blas
-latlas -lR

Thanks very much for the (temporary) solution.  The question is, could this
be a permanent fix?

Regards,
Andy

> -----Original Message-----
> From: Uwe Ligges [mailto:ligges@statistik.uni-dortmund.de]
> Sent: Wednesday, December 12, 2001 7:29 AM
> To: Prof Brian Ripley
> Cc: Liaw, Andy; R-devel
> Subject: Re: [R] Rcmd SHLIB problem
> 
> 
> [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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] RE: [R] Rcmd SHLIB problem
Liaw, Andy