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. Liqiang Liqiang Ni Assistant Professor, Department of Statistics, University of Central Florida, Orlando, FL 32816-2370 Email: lni at mail.ucf.edu
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
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.sosuccessfully>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
Thanks, Prof Ripley. I changed the file name and it works just fine. Liqiang Ni Assistant Professor, Department of Statistics, University of Central Florida, Orlando, FL 32816-2370 Email: lni at mail.ucf.edu>>> Prof Brian Ripley <ripley at stats.ox.ac.uk> 10/17/2004 5:29:47 PM >>>On Sun, 17 Oct 2004 16:08:04 -0400, "Liqiang Ni" <lni at mail.ucf.edu> wrote:>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.sosuccessfully>in Linux using R SHLIB. Any suggestion? Thanks.The problem is the name all.f. Try another name. `all' is a target in the Makefile and some implicit rule is being triggered. Given that no one has reported this in all the years it has been done this way, it just seems an unlucky choice of name. Adding .PHONY : all libR makeMakedeps to src/gnuwin32/MakeDll will fix it, at least with my make. Incidentally, it would have helped if you had given the correct output, which was something like [c:/R/svn/trunk/src/gnuwin32/tmp]% rcmd SHLIB all.f cox.f g77 -O2 -Wall -c all.f -o all.o g77 -O2 -Wall -c cox.f -o cox.o ar cr all.a all.o cox.o ranlib all.a gcc --shared -s -o all.dll all.def all.a -Lc:/R/svn/trunk/src/gnuwin32 -lg2c -lR 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 so this did in fact work! I think the output given is from a second run. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595