Hi, I am uploading my R package to CRAN. One of the dynamic libraries the package requires depends on LAPACKE library which usually integrated with BLAS and CBLAS in the same .so file (as I understand). CRAN has OpenBLAS already installed on the system. However, this OpenBLAS library does not maintain implementation of LAPACKE library. Thus, I have modified my configure file to install a standalone OpenBLAS library to use it. The problem that my installation has successfully passed, however, CRAN fails in loading my package giving me this error: /srv/hornik/tmp/CRAN/exageostatr.Rcheck/exageostatr/lib/libcoreblas.so: undefined symbol: LAPACKE_slarfb_work LAPACKE_slarfb_work is a function defined in the LAPACKE library. I have tried to set the PKG_LIBS path to my OpenBLAS lib but again it fails. Any suggestions? --Sameh
[R-pkg-devel] Package or namespace load failed: undefined symbol
9 messages · Sameh M. Abdulah, Tomas Kalibera, Ralf Stubner
On Tue, Sep 24, 2019 at 12:10 PM Sameh M. Abdulah
<sameh.abdulah at kaust.edu.sa> wrote:
I am uploading my R package to CRAN. One of the dynamic libraries the package requires depends on LAPACKE library which usually integrated with BLAS and CBLAS in the same .so file (as I understand). CRAN has OpenBLAS already installed on the system. However, this OpenBLAS library does not maintain implementation of LAPACKE library. Thus, I have modified my configure file to install a standalone OpenBLAS library to use it. The problem that my installation has successfully passed, however, CRAN fails in loading my package giving me this error: /srv/hornik/tmp/CRAN/exageostatr.Rcheck/exageostatr/lib/libcoreblas.so: undefined symbol: LAPACKE_slarfb_work
This looks as if you are building OpenBLAS as a /dynamic/ library installed in your package directory. This cannot work since the run-time linker will not search your package directory for dynamic libraries. You could build OpenBLAS as a /static/ library instead. However, I am unsure why you want to build OpenBLAS in the first place, since any R package can reliably link with the BLAS and LAPACK versions used by R. See WRE on Makevars, BLAS_LIBS etc. for details. cheerio ralf
Thanks Ralf I am installing OpenBLAS because I need LAPACKE libraries which I cannot find on the current version of OpenBLAS on CRAN. I add the libraries directory in my package to the PKG_CONFIG_PATH. Is this enough for the system to use my OpenBLAS library? Thanks Sameh
?On 9/25/19, 10:23 AM, "Ralf Stubner" <ralf.stubner at gmail.com> wrote:
On Tue, Sep 24, 2019 at 12:10 PM Sameh M. Abdulah
<sameh.abdulah at kaust.edu.sa> wrote:
> I am uploading my R package to CRAN. One of the dynamic libraries the package requires depends on LAPACKE library which usually integrated with BLAS and CBLAS in the same .so file (as I understand). CRAN has OpenBLAS already installed on the system. However, this OpenBLAS library does not maintain implementation of LAPACKE library. Thus, I have modified my configure file to install a standalone OpenBLAS library to use it.
>
> The problem that my installation has successfully passed, however, CRAN fails in loading my package giving me this error:
>
> /srv/hornik/tmp/CRAN/exageostatr.Rcheck/exageostatr/lib/libcoreblas.so: undefined symbol: LAPACKE_slarfb_work
This looks as if you are building OpenBLAS as a /dynamic/ library
installed in your package directory. This cannot work since the
run-time linker will not search your package directory for dynamic
libraries. You could build OpenBLAS as a /static/ library instead.
However, I am unsure why you want to build OpenBLAS in the first
place, since any R package can reliably link with the BLAS and LAPACK
versions used by R. See WRE on Makevars, BLAS_LIBS etc. for details.
cheerio
ralf
On Wed, Sep 25, 2019 at 10:29 AM Sameh M. Abdulah
<sameh.abdulah at kaust.edu.sa> wrote:
I am installing OpenBLAS because I need LAPACKE libraries which I cannot find on the current version of OpenBLAS on CRAN. I add the libraries directory in my package to the PKG_CONFIG_PATH. Is this enough for the system to use my OpenBLAS library?
I seem to be missing some context here. I might be able to help you if provide a higher level description of what you are trying to achieve. For example, why do you need LAPACKE instead of the C interface to LAPACK provided by R_ext/Lapack.h? And if you really need LAPACKE, why not include only that in your package and link with the BLAS/LAPACK used by R? cheerio ralf
On 9/25/19 1:00 PM, Ralf Stubner wrote:
On Wed, Sep 25, 2019 at 10:29 AM Sameh M. Abdulah <sameh.abdulah at kaust.edu.sa> wrote:
I am installing OpenBLAS because I need LAPACKE libraries which I cannot find on the current version of OpenBLAS on CRAN. I add the libraries directory in my package to the PKG_CONFIG_PATH. Is this enough for the system to use my OpenBLAS library?
I seem to be missing some context here. I might be able to help you if provide a higher level description of what you are trying to achieve. For example, why do you need LAPACKE instead of the C interface to LAPACK provided by R_ext/Lapack.h? And if you really need LAPACKE, why not include only that in your package and link with the BLAS/LAPACK used by R?
Also with LAPACKE you will have the problem of (in)compatibility in calls from C to Fortran with the hidden length arguments for character arguments. It would be better to use LAPACK directly, passing the hidden length arguments as described in Writing R Extensions (the R-devel version of it, section 6.6.1). Or, if you wanted a standards-based solution, use iso_c_binding (also described in WRE). You would use the LAPACK already provided in the system (either reference from R, or any other as selected by administrator/user), not include it with your package. Best Tomas
cheerio ralf
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Dear Ralf My package depends on another C-based software that needs LAPACKE to compile. I do not know a lot about it. I think adding LAPACKE to my package will be a good solution. Could you please give me more information of how to do this? --Sameh
?On 9/25/19, 2:00 PM, "Ralf Stubner" <ralf.stubner at gmail.com> wrote:
On Wed, Sep 25, 2019 at 10:29 AM Sameh M. Abdulah
<sameh.abdulah at kaust.edu.sa> wrote:
> I am installing OpenBLAS because I need LAPACKE libraries which I cannot find on the current version of OpenBLAS on CRAN.
>
> I add the libraries directory in my package to the PKG_CONFIG_PATH. Is this enough for the system to use my OpenBLAS library?
I seem to be missing some context here. I might be able to help you if
provide a higher level description of what you are trying to achieve.
For example, why do you need LAPACKE instead of the C interface to
LAPACK provided by R_ext/Lapack.h? And if you really need LAPACKE, why
not include only that in your package and link with the BLAS/LAPACK
used by R?
cheerio
ralf
On Wed, Sep 25, 2019 at 3:34 PM Sameh M. Abdulah
<sameh.abdulah at kaust.edu.sa> wrote:
My package depends on another C-based software that needs LAPACKE to compile. I do not know a lot about it. I think adding LAPACKE to my package will be a good solution. Could you please give me more information of how to do this?
Including LAPACKE in your package won't help you in this case, since it is not your package but one of its dependencies that needs it. So LAPACKE needs to be installed when that dependency is installed, which happens before your package gets installed. How do you expect the dependencies to get installed? Is that done by an admin before the package installation? cheerio ralf
I am installing my dependencies including OpenBLAS during the package installation via the configure file. What is surprising me that even all dependencies are installed successfully. R cannot load one of the library that depends on LAPACKE. My method is to install all my dependencies inside the installation directory of my R package and set PKG_CONFIG_PATH to this path. Do I need to set any other paths so that R can see my new OpenBLAS which include LAPACKE? --Sameh
?On 9/26/19, 4:34 PM, "Ralf Stubner" <ralf.stubner at gmail.com> wrote:
On Wed, Sep 25, 2019 at 3:34 PM Sameh M. Abdulah
<sameh.abdulah at kaust.edu.sa> wrote:
> My package depends on another C-based software that needs LAPACKE to compile. I do not know a lot about it. I think adding LAPACKE to my package will be a good solution.
> Could you please give me more information of how to do this?
Including LAPACKE in your package won't help you in this case, since
it is not your package but one of its dependencies that needs it. So
LAPACKE needs to be installed when that dependency is installed, which
happens before your package gets installed.
How do you expect the dependencies to get installed? Is that done by
an admin before the package installation?
cheerio
ralf
On Thu, Sep 26, 2019 at 3:41 PM Sameh M. Abdulah
<sameh.abdulah at kaust.edu.sa> wrote:
I am installing my dependencies including OpenBLAS during the package installation via the configure file. What is surprising me that even all dependencies are installed successfully. R cannot load one of the library that depends on LAPACKE. My method is to install all my dependencies inside the installation directory of my R package and set PKG_CONFIG_PATH to this path. Do I need to set any other paths so that R can see my new OpenBLAS which include LAPACKE?
With PKG_CONFIGURE _PATH you enable finding the right compiler flags for compilation. However, this does not help you with the necessary run time linking, since you seem to be building dynamic libraries. One way forward might be: * Build a static version of LAPACKE * Build a static version of your dependency * Build your package linking with your static libs and BLAS/LAPACK as described in WRE. cheerio ralf