Jason Liao
2006-Oct-03 13:30 UTC
[R] Linking R with Fortran 90: make: m2c: Command not found
Following the setup in Prof.Duncan Murdoch's page, I have successfully compiled the DLL for one Fortran 95 program using Gfortran and got 300 times speed boost. For the second set of fortran programs, However, I have this error message R CMD SHLIB -o jiangang kdtree2.f90 jian.f90 gang.f90 m2c -o jian.o jian.mod make: m2c: Command not found make: *** [jian.o] Error 127 Can anyone point me to the direction to solve this problem. Thank you in advance. Jason Liao, http://www.geocities.com/jg_liaoAssociate Professor of Biostatistics Drexel University School of Public Health 245 N. 15th Street, Mail Stop 660 Philadelphia, PA 19102-1192 phone 215-762-3934
Why is this an error? mat <- matrix(1:64, 8, 8) x <- y <- 1:8 z <- outer(x, y, function(x, y) mat[x,y]) when this is not an error: mat <- matrix(1:64, 8, 8) x <- y <- 1:8 z <- outer(x, y, function(x, y) paste("mat[", x, ",", y, "]", sep="")) Alberto Monteiro
Mike Prager
2006-Oct-03 20:58 UTC
[R] Linking R with Fortran 90: make: m2c: Command not found
Jason Liao <jg_liao at yahoo.com> wrote:> Following the setup in Prof.Duncan Murdoch's page, I have successfully compiled the DLL for one Fortran 95 program using Gfortran and got 300 times speed boost. For the second set of fortran programs, However, I have this error message > > R CMD SHLIB -o jiangang kdtree2.f90 jian.f90 gang.f90 > m2c -o jian.o jian.mod > make: m2c: Command not found > make: *** [jian.o] Error 127 > > Can anyone point me to the direction to solve this problem. Thank you in advance. >As there has been no other answer, I will point something out, even though I am NOT an expert in this procedure. m2c is a compiler for the language Modula-2. You are not using that (are you?), but it seems to be invoked (by make) because of your Fortran module file (jian.mod). Fortran compilers in my experience don't need to be told to look for x.mod when you have specified x.obj. Can you run this procedure without mentioning the module file? I hope this helps. MHP -- Mike Prager, NOAA, Beaufort, NC * Opinions expressed are personal and not represented otherwise. * Any use of tradenames does not constitute a NOAA endorsement.
Jason Liao
2006-Oct-04 15:20 UTC
[R] Linking R with Fortran 90: make: m2c: Command not found
many Thanks to Mike Prager and José Fernández Menéndez for your help. I tried what Mike suggested in various ways but the problem is still there. Jose's solution worked beautifully in producing a dll. After dyn.load() the dll, however, is.loaded() gives me a false answer. I still need to investigate this later part. Progress has been made, nevertheless. Jason from http://gcc.gnu.org/wiki/GfortranFAQ: Gfortran creates a file namemod= for each module name. This confuses the gnu make, which thinks that .mod files are Modula2 source code files. You must override this built-in rule by adding the following line somewhere in your Makefile. %.o : %.mod hope this helps!!! Jason Liao, http://www.geocities.com/jg_liaoAssociate Professor of Biostatistics Drexel University School of Public Health 245 N. 15th Street, Mail Stop 660 Philadelphia, PA 19102-1192 phone 215-762-3934 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]