[R-pkg-devel] Error in dyn.load(dllfile) : unable to load shared object
Hello, I am new to R package development. I am working on a package that has in its src folder one (prime) cpp file and some helper cpp (X.Cpp, Y.Cpp) and one c file (Z.C) and their header files (X.h, Y.h and Z.h) I am getting the following error when I do 'Build & Reload' in Rstudio. " Error in dyn.load(dllfile) : unable to load shared object '/Users/abcd/BART/bart_pkg1/src/bartpkg.so': dlopen(/Users/abcd/BART/bart_pkg1/src/bartpkg.so, 6): Symbol not found: __ZN3RNG4nfixElm Referenced from: /Users/abcd/BART/bart_pkg1/src/bartpkg.so Expected in: flat namespace in /Users/abcd/BART/bart_pkg1/src/bartpkg.so Calls: suppressPackageStartupMessages ... -> load_all -> load_dll -> library.dynam2 -> dyn.load Execution halted Exited with status 1. " I have followed the basic guidelines to build the package. The .R file has directive #' @useDynLib bartpkg in the right place. Also, the prime cpp file has the following tags in the right place. 1. #include using namespace Rcpp; 2. //' @param x A single integer. //' @export // [[Rcpp::export]] And my NAMESPACE file shows 'useDynLib(bartpkg)' correctly. I am able to see the 'bartpkg.so' shared object file in the src directory. I tried in the terminal this command "c++filt -n _ZN3RNG4nfixElm" and was able to see that the symbol in the error ' Symbol not found: __ZN3RNG4nfixElm' is coming from the .C file RNG.C and is because of a function 'nfix'. But even if I remove the function 'nfix' or remove the RNG.C file altogether, the same error ' Symbol not found: __ZN3RNG4nfixElm' comes. can it be a flag issue that my compiler is not able to compile the 'C' file? I am able to see that all the cpp files generate respective object files, but I dont see anything like that for the C file. I am using RStudio is the session info is > sessionInfo() R version 3.3.1 (2016-06-21) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.11.6 (El Capitan) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] bartpkg_0.1.0packrat_0.4.8-1 Rcpp_0.12.8 msm_1.6.4LaplacesDemon_16.0.1 loaded via a namespace (and not attached): [1] roxygen2_5.0.1 lattice_0.20-34 mvtnorm_1.0-5 digest_0.6.10 grid_3.3.1 magrittr_1.5 [7] stringi_1.1.2 Matrix_1.2-7.1 splines_3.3.1 tools_3.3.1 stringr_1.1.0 survival_2.39-5 [13] parallel_3.3.1 rsconnect_0.5 inline_0.3.14 expm_0.999-0 I am stuck at this problem for weeks now. Any help would be highly appreciated. Thank you. -Aarti [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
[R-pkg-devel] R checks, compiling C code and Windows ISO C warning
I’m trying to submit an R package to CRAN that contains C code and I cannot get past an issue with compiling on Windows. Specifically I have this line of C code, reading data in 64 bit: > sscanf (hdrstr, " %"SCNd64, &datasize); To me this seems like good and portable code. But CRAN checks on Windows give this warning: > warning: ISO C does not support the 'I64' ms_scanf length modifier [-Wformat=] The code as it is works fine on Windows, but I can’t find a way to get around this warning. Does anyone know of a better solution to read in 64 bit data? Thanks, Gillian Sharer gill...@iris.washington.edu __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Error in dyn.load(dllfile) : unable to load shared object
On 1 December 2016 at 17:15, Aarti Singh wrote: | Hello, | | I am new to R package development. I am working on a package that has in | its src folder one (prime) cpp file and some helper cpp (X.Cpp, Y.Cpp) and | one c file (Z.C) and their header files (X.h, Y.h and Z.h) | | I am getting the following error when I do 'Build & Reload' in Rstudio. | | " | Error in dyn.load(dllfile) : | unable to load shared object '/Users/abcd/BART/bart_pkg1/src/bartpkg.so': | dlopen(/Users/abcd/BART/bart_pkg1/src/bartpkg.so, 6): Symbol not found: | __ZN3RNG4nfixElm | Referenced from: /Users/abcd/BART/bart_pkg1/src/bartpkg.so | Expected in: flat namespace | in /Users/abcd/BART/bart_pkg1/src/bartpkg.so | Calls: suppressPackageStartupMessages ... -> load_all -> | load_dll -> library.dynam2 -> dyn.load | Execution halted | | Exited with status 1. | | " | | I have followed the basic guidelines to build the package. | | The .R file has directive #' @useDynLib bartpkg in the right place. | | Also, the prime cpp file has the following tags in the right place. | 1. #include | using namespace Rcpp; | 2. //' @param x A single integer. | //' @export | // [[Rcpp::export]] | | | And my NAMESPACE file shows 'useDynLib(bartpkg)' correctly. | | I am able to see the 'bartpkg.so' shared object file in the src directory. | | | I tried in the terminal this command "c++filt -n _ZN3RNG4nfixElm" and was | able to see that the symbol in the error ' Symbol not found: | __ZN3RNG4nfixElm' is coming from the .C file RNG.C and is because of a | function 'nfix'. | | But even if I remove the function 'nfix' or remove the RNG.C file | altogether, the same error ' Symbol not found: __ZN3RNG4nfixElm' comes. | | can it be a flag issue that my compiler is not able to compile the 'C' | file? | I am able to see that all the cpp files generate respective object files, | but I dont see anything like that for the C file. | | I am using RStudio is the session info is | > sessionInfo() | R version 3.3.1 (2016-06-21) | Platform: x86_64-apple-darwin13.4.0 (64-bit) | Running under: OS X 10.11.6 (El Capitan) | | locale: | [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 | | attached base packages: | [1] stats graphics grDevices utils datasets methods base | | other attached packages: | [1] bartpkg_0.1.0packrat_0.4.8-1 Rcpp_0.12.8 | msm_1.6.4LaplacesDemon_16.0.1 | | loaded via a namespace (and not attached): | [1] roxygen2_5.0.1 lattice_0.20-34 mvtnorm_1.0-5 digest_0.6.10 | grid_3.3.1 magrittr_1.5 | [7] stringi_1.1.2 Matrix_1.2-7.1 splines_3.3.1 tools_3.3.1 | stringr_1.1.0 survival_2.39-5 | [13] parallel_3.3.1 rsconnect_0.5 inline_0.3.14 expm_0.999-0 | | I am stuck at this problem for weeks now. | Any help would be highly appreciated. Please don't cross post, but I just gave you a hint at your identical StackOverflow question: http://stackoverflow.com/questions/40922814/error-in-dyn-loaddllfile-unable-to-load-shared-object-expected-in-flat-na#comment69060886_40922814 Dirk | Thank you. | | -Aarti | | [[alternative HTML version deleted]] | | __ | R-package-devel@r-project.org mailing list | https://stat.ethz.ch/mailman/listinfo/r-package-devel -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel