Hi all I have a R code that incorporates a C++ programm. I compiled the C++ code with the following: R CMD SHLIB Model.cpp -Wall funzioni.cpp it seems to work fine but when i run the R code i get this error message Error in dyn.load(paste(dir_func, "Model.so", sep = "")) : unable to load shared object '/lustre/work/uuu/RCpp/Model.so': libR.so: cannot open shared object file: No such file or directory I don't know how to fix it. The code is running on a cluster. Thanks.
libR.so: cannot open shared object file
14 messages · Dirk Eddelbuettel, Geoff Jentry, gianluca.mastrantonio at yahoo.it +2 more
On 3 September 2013 at 22:48, gianluca.mastrantonio at yahoo.it wrote:
| Hi all | | I have a R code that incorporates a C++ programm. I compiled the C++ | code with the following: | | R CMD SHLIB Model.cpp -Wall funzioni.cpp | | it seems to work fine but when i run the R code i get this error message | | Error in dyn.load(paste(dir_func, "Model.so", sep = "")) : | unable to load shared object '/lustre/work/uuu/RCpp/Model.so': | libR.so: cannot open shared object file: No such file or directory | | I don't know how to fix it. | The code is running on a cluster. Qualified guess: you ran R CMD SHLIB on the _central / master_ node, but not the _compute_ nodes. They never got the object file. One more rigorous approach would be to wrap your function up in a package, and have each compute node load the package. Hope this helps, Dirk
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
One problem is that i have not the privileges to install a package. Il 03/09/13 23:14, Dirk Eddelbuettel ha scritto:
On 3 September 2013 at 22:48, gianluca.mastrantonio at yahoo.it wrote: | Hi all | | I have a R code that incorporates a C++ programm. I compiled the C++ | code with the following: | | R CMD SHLIB Model.cpp -Wall funzioni.cpp | | it seems to work fine but when i run the R code i get this error message | | Error in dyn.load(paste(dir_func, "Model.so", sep = "")) : | unable to load shared object '/lustre/work/uuu/RCpp/Model.so': | libR.so: cannot open shared object file: No such file or directory | | I don't know how to fix it. | The code is running on a cluster. Qualified guess: you ran R CMD SHLIB on the _central / master_ node, but not the _compute_ nodes. They never got the object file. One more rigorous approach would be to wrap your function up in a package, and have each compute node load the package. Hope this helps, Dirk
One problem is that i have not the privileges to install a package.
If you have a writable area you can install to there with the --library=LIB argument and then load the package using the lib.loc command.
On 03/09/2013 23:04, Geoff Jentry wrote:
One problem is that i have not the privileges to install a package.
If you have a writable area you can install to there with the --library=LIB argument and then load the package using the lib.loc command.
Actually, that will all happen automatically: package installation will create a personal library for you. See e.g. ?.libPaths
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
Can you add some details? Suppose i have the package Model.tar.gz and my writable are is in user/area, what i have to do next to install the package? Il 04/09/13 00:04, Geoff Jentry ha scritto:
One problem is that i have not the privileges to install a package.
If you have a writable area you can install to there with the --library=LIB argument and then load the package using the lib.loc command.
Can you add some details? Suppose i have the package Model.tar.gz and my writable are is in user/area, what i have to do next to install the package?
What I was picturing was something like this (forgive me if syntax isn't 100%): mkdir user/area/myRLib R CMD INSTALL --library=user/area/myRLib Model.tar.gz and then in R: library(Model, lib.loc="user/area/myRLib") Note though Brian Ripley's response to me where he indicates that this is handled automatically. -J
On 04/09/2013 19:58, Geoff Jentry wrote:
Can you add some details? Suppose i have the package Model.tar.gz and my writable are is in user/area, what i have to do next to install the package?
What I was picturing was something like this (forgive me if syntax isn't 100%): mkdir user/area/myRLib R CMD INSTALL --library=user/area/myRLib Model.tar.gz and then in R: library(Model, lib.loc="user/area/myRLib") Note though Brian Ripley's response to me where he indicates that this is handled automatically.
Yes, install.packages("Model.tar.gz") should suffice.
-J
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
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
First of all, thanks for your help. I did all the things you told me. I was able to load the library, but then Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/lustre/work/gjona2/Wrap/BayesWrap/libs/BayesWrap.so': libR.so: cannot open shared object file: No such file or directory In addition: Warning message: package 'BayesWrap' was built under R version 2.15.2 Error: package/namespace load failed for 'BayesWrap' Execution halted what does it means? G.M. Il 04/09/13 22:42, Prof Brian Ripley ha scritto:
On 04/09/2013 19:58, Geoff Jentry wrote:
Can you add some details? Suppose i have the package Model.tar.gz and my writable are is in user/area, what i have to do next to install the package?
What I was picturing was something like this (forgive me if syntax isn't 100%): mkdir user/area/myRLib R CMD INSTALL --library=user/area/myRLib Model.tar.gz and then in R: library(Model, lib.loc="user/area/myRLib") Note though Brian Ripley's response to me where he indicates that this is handled automatically.
Yes, install.packages("Model.tar.gz") should suffice.
-J
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
just for completion
i need to use
library(Model, lib.loc="user/area/myRLib")
because if i use
library(Model)
i get this message
Error in library("BayesWrap") : there is no package called 'BayesWrap'
Il 05/09/13 11:59, gianluca.mastrantonio at yahoo.it ha scritto:
First of all, thanks for your help. I did all the things you told me. I was able to load the library, but then Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/lustre/work/gjona2/Wrap/BayesWrap/libs/BayesWrap.so': libR.so: cannot open shared object file: No such file or directory In addition: Warning message: package 'BayesWrap' was built under R version 2.15.2 Error: package/namespace load failed for 'BayesWrap' Execution halted what does it means? G.M. Il 04/09/13 22:42, Prof Brian Ripley ha scritto:
On 04/09/2013 19:58, Geoff Jentry wrote:
Can you add some details? Suppose i have the package Model.tar.gz and my writable are is in user/area, what i have to do next to install the package?
What I was picturing was something like this (forgive me if syntax isn't 100%): mkdir user/area/myRLib R CMD INSTALL --library=user/area/myRLib Model.tar.gz and then in R: library(Model, lib.loc="user/area/myRLib") Note though Brian Ripley's response to me where he indicates that this is handled automatically.
Yes, install.packages("Model.tar.gz") should suffice.
-J
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
On 05/09/2013 21:28, gianluca.mastrantonio at yahoo.it wrote:
just for completion
i need to use
library(Model, lib.loc="user/area/myRLib")
because if i use
library(Model)
i get this message
Error in library("BayesWrap") : there is no package called 'BayesWrap'
For the record: not if you follow my suggestion. See ?.libPaths for why.
Il 05/09/13 11:59, gianluca.mastrantonio at yahoo.it ha scritto:
First of all, thanks for your help. I did all the things you told me. I was able to load the library, but then Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/lustre/work/gjona2/Wrap/BayesWrap/libs/BayesWrap.so': libR.so: cannot open shared object file: No such file or directory In addition: Warning message: package 'BayesWrap' was built under R version 2.15.2 Error: package/namespace load failed for 'BayesWrap' Execution halted what does it means? G.M. Il 04/09/13 22:42, Prof Brian Ripley ha scritto:
On 04/09/2013 19:58, Geoff Jentry wrote:
Can you add some details? Suppose i have the package Model.tar.gz and my writable are is in user/area, what i have to do next to install the package?
What I was picturing was something like this (forgive me if syntax isn't 100%): mkdir user/area/myRLib R CMD INSTALL --library=user/area/myRLib Model.tar.gz and then in R: library(Model, lib.loc="user/area/myRLib") Note though Brian Ripley's response to me where he indicates that this is handled automatically.
Yes, install.packages("Model.tar.gz") should suffice.
-J
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20130906/44f9bd5b/attachment.pl>
On 06/09/2013 14:28, brian avants wrote:
Hello Everyone I have been following this thread because I have similar issues with an outside-of-R package. The problem is related to dylib loading i.e. of the form Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/Users/stnava/code/gitANTs/ANTsR/src/ANTS/ANTS-build/lib/ANTsR/libs/libRantsRegistration.so': dlopen(/Users/stnava/code/gitANTs/ANTsR/src/ANTS/ANTS-build/lib/ANTsR/libs/libRantsRegistration.so, 6): Library not loaded: libitkdouble-conversion-4.5.1.dylib Referenced from: /Users/stnava/code/gitANTs/ANTsR/src/ANTS/ANTS-build/lib/libl_antsRegistration.dylib Reason: image not found A solution that seems to work on both osx and linux is: export R_LD_LIBRARY_PATH=/Users/stnava/code/gitANTs/ANTsR/src/ANTS/ANTS-build/lib/ but I would really like to avoid this, if possible. I tried using .libPaths ( suspecting it would not work ) and I got the same error as above ...
But that was about installing packages, not the linking problem: this thread wandered.
as an aside, there seems very little documentation for R_LD_LIBRARY_PATH & I don't recall how I came across it ... i have some other notes here:
It is not intended for end-user use. You could just as well have set LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH) in the standard way for your OS. Any approach to setting a library path has problems: on platforms that support it and for personal installations I would use -rpath or similar, but it has problems for system-wide installations since it uses absolute paths. There is a section ?5.8 in 'Writing R Extensions' about this (use a current copy from http://cran.r-project.org/manuals.html).
https://github.com/stnava/ANTsR/blob/master/configure any thoughts appreciated , at your leisure ... & thanks, as usual, brian On Thu, Sep 5, 2013 at 4:38 PM, Prof Brian Ripley <ripley at stats.ox.ac.uk <mailto:ripley at stats.ox.ac.uk>> wrote: On 05/09/2013 21:28, gianluca.mastrantonio at yahoo.it <mailto:gianluca.mastrantonio at yahoo.it> wrote: just for completion i need to use library(Model, lib.loc="user/area/myRLib") because if i use library(Model) i get this message Error in library("BayesWrap") : there is no package called 'BayesWrap' For the record: not if you follow my suggestion. See ?.libPaths for why. Il 05/09/13 11:59, gianluca.mastrantonio at yahoo.it <mailto:gianluca.mastrantonio at yahoo.it> ha scritto: First of all, thanks for your help. I did all the things you told me. I was able to load the library, but then Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/lustre/work/gjona2/Wrap/__BayesWrap/libs/BayesWrap.so': libR.so: cannot open shared object file: No such file or directory In addition: Warning message: package 'BayesWrap' was built under R version 2.15.2 Error: package/namespace load failed for 'BayesWrap' Execution halted what does it means? G.M. Il 04/09/13 22:42, Prof Brian Ripley ha scritto: On 04/09/2013 19:58, Geoff Jentry wrote: Can you add some details? Suppose i have the package Model.tar.gz and my writable are is in user/area, what i have to do next to install the package? What I was picturing was something like this (forgive me if syntax isn't 100%): mkdir user/area/myRLib R CMD INSTALL --library=user/area/myRLib Model.tar.gz and then in R: library(Model, lib.loc="user/area/myRLib") Note though Brian Ripley's response to me where he indicates that this is handled automatically. Yes, install.packages("Model.tar.__gz") should suffice. -J
________________________________________________
R-devel at r-project.org <mailto:R-devel at r-project.org>
mailing list
https://stat.ethz.ch/mailman/__listinfo/r-devel
<https://stat.ethz.ch/mailman/listinfo/r-devel>
--
Brian D. Ripley, ripley at stats.ox.ac.uk <mailto:ripley at stats.ox.ac.uk>
Professor of Applied Statistics,
http://www.stats.ox.ac.uk/~__ripley/
<http://www.stats.ox.ac.uk/~ripley/>
University of Oxford, Tel: +44 1865 272861
<tel:%2B44%201865%20272861> (self)
1 South Parks Road, +44 1865 272866 <tel:%2B44%201865%20272866> (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
<tel:%2B44%201865%20272595>
________________________________________________
R-devel at r-project.org <mailto:R-devel at r-project.org> mailing list
https://stat.ethz.ch/mailman/__listinfo/r-devel
<https://stat.ethz.ch/mailman/listinfo/r-devel>
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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20130906/35d29f55/attachment.pl>