[R-pkg-devel] Error in inDL(x, as.logical(local), as.logical(now), ...) unable to load shared object

Tomas Kalibera tom@@@k@||ber@ @end|ng |rom gm@||@com
Thu Dec 23 11:07:09 CET 2021


On 12/21/21 5:40 PM, Ezra Tucker wrote:
> Hi R package developers,
>
>
> I'm developing an R package that wraps NREL's SSC library
> (https://sam.nrel.gov/), which involves including one header file and
> linking to one dll. Thus far it is only tested in linux (works just fine
> there) but I am having trouble building/installing on Windows.
>
>
> The package name is "ssc", after it is all done compiling it says:
>
>
>   > * DONE (ssc)
>   > Error in inDL(x, as.logical(local), as.logical(now), ...) :
>   >   unable to load shared object
> 'C:/Users/EZRATU~1/AppData/Local/Temp/RtmpSaKZH0/pkgload13b41ff33604/ssc.dll':
>   >   LoadLibrary failure:  The specified procedure could not be found.
>   > Calls: suppressPackageStartupMessages ... <Anonymous> -> load_dll ->
> library.dynam2 -> dyn.load -> inDL
>   > Execution halted
>   >
>   > Exited with status 1.
>
>
> My Makevars.win file, if useful, looks like:
>
> PKG_CPPFLAGS=-I. -I"$C:/SAM/2021.12.02/runtime"
> PKG_LIBS=-Wl,-rpath,$C:/SAM/2021.12.02/x64 -L"$C:/SAM/2021.12.02/x64" -lssc
>
> the second includes is to pick up sscapi.h which is a necessary header
> file for using this library,
>
> The package relies heavily on Rcpp; My full sessionInfo() is:
>
> R version 4.1.2 (2021-11-01)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 10 x64 (build 19044)
>
> Matrix products: default
>
> locale:
> [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
> States.1252
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods base
>
> loaded via a namespace (and not attached):
>    [1] Rcpp_1.0.7        rstudioapi_0.13   magrittr_2.0.1 usethis_2.1.5
>    [5] devtools_2.4.3    pkgload_1.2.4     R6_2.5.1 rlang_0.4.12
>    [9] fastmap_1.1.0     fansi_0.5.0       tools_4.1.2 pkgbuild_1.3.0
> [13] sessioninfo_1.2.2 utf8_1.2.2        cli_3.1.0 withr_2.4.3
> [17] ellipsis_0.3.2    remotes_2.4.2     rprojroot_2.0.2 tibble_3.1.6
> [21] lifecycle_1.0.1   crayon_1.4.2      processx_3.5.2 purrr_0.3.4
> [25] callr_3.7.0       vctrs_0.3.8       fs_1.5.2 ps_1.6.0
> [29] testthat_3.1.1    memoise_2.0.1     glue_1.6.0 cachem_1.0.6
> [33] pillar_1.6.4      compiler_4.1.2    desc_1.4.0 prettyunits_1.1.1
> [37] pkgconfig_2.0.3
>
> and I have rtools40 installed in C:\rtools40. --no-multiarch is
>
> I read on the internet in various places that this could have something
> to do with 64 vs 32-bit architecture, but everything looks like it's
> targeting a 64-bit architecture and the DLL I'm linking to is 64-bit.

I see these potential problems:

You cannot have your package named "ssc" if ssc.dll is also the name of 
the external DLL you are linking, because you cannot have two different 
DLLs with the same name linked to a process.

-rpath does not work on Windows. You need to have the directory with the 
external DLL on PATH for Windows to find that DLL.

Then I am not sure why you have the dollar sign in the paths, why not 
"C:/...".

You can have a look at CRAN package Rblpapi which is using an external DLL.

Best
Tomas


>
>
> Any ideas? Thanks so much!
>
> -Ezra
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list