[Rd] useDynLib
I would like to be able to load two versions of a package at once and to do that was thinking of giving each version a different package name in the DESCRIPTION file and the building and installing each such version separately. library(myPkg1) library(myPkg2) and then use myPkg1::myFun() and myPkg2::myFun(). To do that easily it would be convenient if one could change the package name in only one place (the DESCRIPTION file) and have that propagate to all other uses of the package name in the package. Suppose the package were named myPkg. Then the problem areas are: 1. The NAMESPACE file has myPkg hard-coded like this: useDynLib(myPkg, .registration=TRUE) 2. The configure.ac file has myPkg hard-coded like this: AC_INIT([myPkg], 1.0.0) 3. There are various references to myPkg hard-code throughout the R code, e.g. myPkg::myFun, but I am ok here as I assume this would work where an .onLoad would be used to grab the package name from the .onLoad's pkgname argument: `::`(pkgname, MyFun) (Also some or all of these may not be needed in the first place.) 1. Is there some way to cause these instances to change when the package name in the DESCRIPTION file changes or is there some other approach that would make it easy to change the package name in just one spot or some other way to load two packages that are versions of each other at one time. (The fact that the package has C++ code seems to be the complicating factor.) 2. Are there any examples of CRAN packages that have been set up to make this easy to do? Thanks. -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] useDynLib in older versions e.g. (2.10)
Hi, Has something changed regarding the useDynLib in the NAMESPACE file in packages? I've written a package that works in e.g. 2.12/2.13 but simply cannot find the dynamic library under windows. The version on CRAN is older than the one I'm talking about and depends on a newer version of R but I want to make the package available to people with older versions. utils:::menuInstallLocal() package 'lassoshooting' successfully unpacked and MD5 sums checked require(lassoshooting) Loading required package: lassoshooting Error in library.dynam(lib, package, package.lib) : shared library 'lassoshooting' not found In addition: Warning message: package 'lassoshooting' was built under R version 2.13.0 I'm usually under linux and don't know about the gory details of .dll files. NAMESPACE file -- useDynLib(lassoshooting) export(lassoshooting) happy easter! regards, Tobias -- Tobias Abenius Ph.D. Student, M.Sc. in Computer Science Mathematical Statistics Mathematical Sciences University of Gothenburg * installing *source* package 'lassoshooting' ... ** libs *** arch - i386 gcc -ID:/RCompile/recent/R-2.13.0/include -Id:/Rcompile/CRANpkg/extralibs/local/include -O3 -Wall -std=gnu99 -c ccd_common.c -o ccd_common.o ccd_common.c: In function 'ccd_common': ccd_common.c:118:2: warning: #warning Using R fortran BLAS calls gcc -ID:/RCompile/recent/R-2.13.0/include -Id:/Rcompile/CRANpkg/extralibs/local/include -O3 -Wall -std=gnu99 -c ccd_r.c -o ccd_r.o ccd_r.c: In function 'ccd': ccd_r.c:163:5: warning: too many arguments for format ccd_r.c:156:7: warning: unused variable 'ret' ccd_r.c:18:11: warning: 'X' may be used uninitialized in this function ccd_r.c:18:14: warning: 'y' may be used uninitialized in this function gcc -shared -s -static-libgcc -o lassoshooting.dll tmp.def ccd_common.o ccd_r.o -Ld:/Rcompile/CRANpkg/extralibs/local/lib -LD:/RCompile/recent/R-2.13.0/bin/i386 -lRblas -lgfortran -LD:/RCompile/recent/R-2.13.0/bin/i386 -lR installing to d:/RCompile/CRANguest/R-release/lib/lassoshooting/libs/i386 *** arch - x64 x86_64-w64-mingw32-gcc -ID:/RCompile/recent/R-2.13.0/include -Id:/Rcompile/CRANpkg/extralibs64new/local/include -O2 -Wall -std=gnu99 -c ccd_common.c -o ccd_common.o ccd_common.c: In function 'ccd_common': ccd_common.c:118:2: warning: #warning Using R fortran BLAS calls x86_64-w64-mingw32-gcc -ID:/RCompile/recent/R-2.13.0/include -Id:/Rcompile/CRANpkg/extralibs64new/local/include -O2 -Wall -std=gnu99 -c ccd_r.c -o ccd_r.o ccd_r.c: In function 'ccd': ccd_r.c:163:5: warning: too many arguments for format ccd_r.c:156:7: warning: unused variable 'ret' ccd_r.c:18:11: warning: 'X' may be used uninitialized in this function ccd_r.c:18:14: warning: 'y' may be used uninitialized in this function x86_64-w64-mingw32-gcc -shared -s -static-libgcc -o lassoshooting.dll tmp.def ccd_common.o ccd_r.o -Ld:/Rcompile/CRANpkg/extralibs64new/local/lib -LD:/RCompile/recent/R-2.13.0/bin/x64 -lRblas -lgfortran -LD:/RCompile/recent/R-2.13.0/bin/x64 -lR installing to d:/RCompile/CRANguest/R-release/lib/lassoshooting/libs/x64 ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ... ** testing if installed package can be loaded * MD5 sums packaged installation of 'lassoshooting' as lassoshooting_0.1.3-6.zip * DONE (lassoshooting) __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] useDynLib in older versions e.g. (2.10)
On 20.04.2011 13:30, Tobias Abenius wrote: Hi, Has something changed regarding the useDynLib in the NAMESPACE file in packages? I've written a package that works in e.g. 2.12/2.13 but simply cannot find the dynamic library under windows. The version on CRAN is older than the one I'm talking about and depends on a newer version of R but I want to make the package available to people with older versions. utils:::menuInstallLocal() package 'lassoshooting' successfully unpacked and MD5 sums checked require(lassoshooting) Loading required package: lassoshooting Error in library.dynam(lib, package, package.lib) : shared library 'lassoshooting' not found In addition: Warning message: package 'lassoshooting' was built under R version 2.13.0 Yes, your package was built doe R-2.13.0 but you are using R = 2.12.0 where the dll files were located in a different directory. Hence a) time to upgrade your R version or b) Install the package from sources yourself for the (unstated) version of R on your Windows machine. Uwe Ligges I'm usually under linux and don't know about the gory details of .dll files. NAMESPACE file -- useDynLib(lassoshooting) export(lassoshooting) happy easter! regards, Tobias 00install.out * installing *source* package 'lassoshooting' ... ** libs *** arch - i386 gcc -ID:/RCompile/recent/R-2.13.0/include -Id:/Rcompile/CRANpkg/extralibs/local/include -O3 -Wall -std=gnu99 -c ccd_common.c -o ccd_common.o ccd_common.c: In function 'ccd_common': ccd_common.c:118:2: warning: #warning Using R fortran BLAS calls gcc -ID:/RCompile/recent/R-2.13.0/include -Id:/Rcompile/CRANpkg/extralibs/local/include -O3 -Wall -std=gnu99 -c ccd_r.c -o ccd_r.o ccd_r.c: In function 'ccd': ccd_r.c:163:5: warning: too many arguments for format ccd_r.c:156:7: warning: unused variable 'ret' ccd_r.c:18:11: warning: 'X' may be used uninitialized in this function ccd_r.c:18:14: warning: 'y' may be used uninitialized in this function gcc -shared -s -static-libgcc -o lassoshooting.dll tmp.def ccd_common.o ccd_r.o -Ld:/Rcompile/CRANpkg/extralibs/local/lib -LD:/RCompile/recent/R-2.13.0/bin/i386 -lRblas -lgfortran -LD:/RCompile/recent/R-2.13.0/bin/i386 -lR installing to d:/RCompile/CRANguest/R-release/lib/lassoshooting/libs/i386 *** arch - x64 x86_64-w64-mingw32-gcc -ID:/RCompile/recent/R-2.13.0/include -Id:/Rcompile/CRANpkg/extralibs64new/local/include -O2 -Wall -std=gnu99 -c ccd_common.c -o ccd_common.o ccd_common.c: In function 'ccd_common': ccd_common.c:118:2: warning: #warning Using R fortran BLAS calls x86_64-w64-mingw32-gcc -ID:/RCompile/recent/R-2.13.0/include -Id:/Rcompile/CRANpkg/extralibs64new/local/include -O2 -Wall -std=gnu99 -c ccd_r.c -o ccd_r.o ccd_r.c: In function 'ccd': ccd_r.c:163:5: warning: too many arguments for format ccd_r.c:156:7: warning: unused variable 'ret' ccd_r.c:18:11: warning: 'X' may be used uninitialized in this function ccd_r.c:18:14: warning: 'y' may be used uninitialized in this function x86_64-w64-mingw32-gcc -shared -s -static-libgcc -o lassoshooting.dll tmp.def ccd_common.o ccd_r.o -Ld:/Rcompile/CRANpkg/extralibs64new/local/lib -LD:/RCompile/recent/R-2.13.0/bin/x64 -lRblas -lgfortran -LD:/RCompile/recent/R-2.13.0/bin/x64 -lR installing to d:/RCompile/CRANguest/R-release/lib/lassoshooting/libs/x64 ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ... ** testing if installed package can be loaded * MD5 sums packaged installation of 'lassoshooting' as lassoshooting_0.1.3-6.zip * DONE (lassoshooting) __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] useDynLib in older versions e.g. (2.10)
Dear R-devel, I investigated further by tracing into library.dynam. The .dll file export a symbol ccd. In e.g. R 2.8.1 the following command succeeds, dyn.load('/Program Files/R/R-2.8.1/library/lassoshooting/libs/i386/lassoshooting.dll') and the external symbol ccd becomes available. However, inside library.dynam it doesn't add i386 to the path because .Platform$r_arch is . One way would be to re-zip the package with a copy of the i386 version outside of the i386 directory, directly under libs. That would work, but then I know I cannot commit a binary package to CRAN. I guess I'm not the only one having this problem. Happy easter, Tobias -- Tobias Abenius Ph.D. Student, M.Sc. in Computer Science Mathematical Statistics Mathematical Sciences University of Gothenburg On 04/20/2011 01:30 PM, Tobias Abenius wrote: Hi, Has something changed regarding the useDynLib in the NAMESPACE file in packages? I've written a package that works in e.g. 2.12/2.13 but simply cannot find the dynamic library under windows. The version on CRAN is older than the one I'm talking about and depends on a newer version of R but I want to make the package available to people with older versions. utils:::menuInstallLocal() package 'lassoshooting' successfully unpacked and MD5 sums checked require(lassoshooting) Loading required package: lassoshooting Error in library.dynam(lib, package, package.lib) : shared library 'lassoshooting' not found In addition: Warning message: package 'lassoshooting' was built under R version 2.13.0 I'm usually under linux and don't know about the gory details of .dll files. NAMESPACE file -- useDynLib(lassoshooting) export(lassoshooting) __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] useDynLib in older versions e.g. (2.10)
On 21.04.2011 11:30, Tobias Abenius wrote: Dear R-devel, I investigated further by tracing into library.dynam. The .dll file export a symbol ccd. In e.g. R 2.8.1 the following command succeeds, dyn.load('/Program Files/R/R-2.8.1/library/lassoshooting/libs/i386/lassoshooting.dll') and the external symbol ccd becomes available. However, inside library.dynam it doesn't add i386 to the path because .Platform$r_arch is . One way would be to re-zip the package with a copy of the i386 version outside of the i386 directory, directly under libs. That would work, but then I know I cannot commit a binary package to CRAN. I guess I'm not the only one having this problem. Happy easter, Tobias I think you are mislead: CRAN accepts source packages only. Binaries are made by CRAN (or more particular by myself in Dortmund). For new packages or updates as of today, we make binaries for R-2.12.x and R-2.13.x available. Note that between major releases of R, you cannot assume that packages will work. The help system changed in R-2.10.x (and no binaries are compatible before vs. after the R-2.10.0 version) and the location of libraries in R-2.12.x changed under Windows. If you need a binary for R-2.8.x, you will have to INSTALL from sources with R-2.8.x, otherwise we cannot guarantee compatibility. Note that R-2.8.1 is unsupported and 5 major releases back! Uwe Ligges __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel