Source package calling Fortran in Packrat

62 views
Skip to first unread message

Foster Ting

unread,
Jun 4, 2015, 12:14:27 PM6/4/15
to packrat...@googlegroups.com
I am trying to add a package into Packrat that calls some Fortran code using useDynLib(). The problem is that I can't get Packrat to install the package when I have that specific line of code in the namespace file. Without the Fortran line Packrat will install the package just fine. But then my code does not run properly. Is there any way to put the source package into Packrat so that it still calls the Fortran code?
I'm sorry if I am a little unclear in this question; I'm not a very experienced coder.
Thanks so much.

Kevin Ushey

unread,
Jun 4, 2015, 1:18:34 PM6/4/15
to Foster Ting, packrat...@googlegroups.com
Hi Foster,

Can you provide more information:

1. What is the specific line of code?
2. What do you mean by 'does not run properly' -- do you get an error message, and what is it?

Thanks,
Kevin

--
You received this message because you are subscribed to the Google Groups "packrat-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packrat-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Foster Ting

unread,
Jun 4, 2015, 1:53:32 PM6/4/15
to packrat...@googlegroups.com, foster...@gmail.com
Thanks for getting back to me.
The line in the namespace file that is causing the problem is useDynLib(meuk2)
If this line of code is in the namespace file when I try to install the package via packrat::install_local("meuk2") then I get the long error message below.

Installing package from 'C:/Users/fostert/Documents/R Working/meuk2'
Installing meuk2
"C:/PROGRA~1/R/R-31~1.0/bin/x64/R" --vanilla CMD INSTALL "C:\Users\fostert\Documents\R Working\meuk2" --library="P:/DIR/packrat/lib/x86_64-w64-mingw32/3.1.0" --install-tests 

Error: Command failed (1)

The command failed with output:
* installing *source* package 'meuk2' ...
** libs

*** arch - i386
make: Nothing to be done for `all'.
installing to P:/DIR/packrat/lib/x86_64-w64-mingw32/3.1.0/meuk2/libs/i386

*** arch - x64
make: Nothing to be done for `all'.
installing to P:/DIR/packrat/lib/x86_64-w64-mingw32/3.1.0/meuk2/libs/x64
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Warning: package 'sp' was built under R version 3.1.3
Warning: package 'data.table' was built under R version 3.1.3
Warning: package 'rgdal' was built under R version 3.1.3
Warning: package 'rgeos' was built under R version 3.1.3
Warning: package 'raster' was built under R version 3.1.3
Warning: package 'gstat' was built under R version 3.1.3
** help
Warning: C:/Users/fostert/Documents/R Working/meuk2/man/meuk2-package.Rd:32: All text must be in

If I do not include the useDynLib(meuk2) line in the namespace file then Packrat installs the package, meuk2, without a problem. But then later on when I try to run my code it fails because meuk2 does not have the line that calls the Fortran code. That error message being:
Error in .Fortran("LS_aem_sub", as.double(P1), as.double(P2), as.double(X1),  : 
  "ls_aem_sub" not available for .Fortran() for package "meuk2"
In addition: Warning message:
In alloc.col(X, length(NAMES)) :
  Attempt to reduce allocation from 100 to 6 ignored. Can only increase allocation via shallow copy.

Thanks so much for your time in this matter,
Foster
Reply all
Reply to author
Forward
0 new messages