Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development version failing compilation with devtools::install_github("rexyai/rsparse") #43

Closed
zdebruine opened this issue Nov 26, 2020 · 1 comment

Comments

@zdebruine
Copy link

I've tried installing rsparse with devtools:

library(devtools)
install_github("rexyai/rsparse")

This returns the following error (tail of the system log result):

"C:/Rtools/mingw32/bin/"g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG  -I'C:/Users/zacha/Documents/R/win-library/4.0/Rcpp/include' -I'C:/Users/zacha/Documents/R/win-library/4.0/RcppArmadillo/include'     -I../inst/include/ -fopenmp -DARMA_32BIT_WORD -DARMA_DONT_USE_BLAS -DARMA_NO_DEBUG   -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o
RcppExports.cpp:396:73: error: 'uint' has not been declared
 arma::Mat<double> c_nnls_double(const arma::mat& x, const arma::mat& y, uint max_iter, double rel_tol);
                                                                         ^~~~
RcppExports.cpp: In function 'SEXPREC* _rsparse_c_nnls_double(SEXP, SEXP, SEXP, SEXP)':
RcppExports.cpp:402:36: error: 'uint' was not declared in this scope
     Rcpp::traits::input_parameter< uint >::type max_iter(max_iterSEXP);
                                    ^~~~
RcppExports.cpp:402:36: note: suggested alternative: 'Sint'
     Rcpp::traits::input_parameter< uint >::type max_iter(max_iterSEXP);
                                    ^~~~
                                    Sint
RcppExports.cpp:402:41: error: template argument 1 is invalid
     Rcpp::traits::input_parameter< uint >::type max_iter(max_iterSEXP);
                                         ^
RcppExports.cpp:402:49: error: expected initializer before 'max_iter'
     Rcpp::traits::input_parameter< uint >::type max_iter(max_iterSEXP);
                                                 ^~~~~~~~
RcppExports.cpp:404:54: error: 'max_iter' was not declared in this scope
     rcpp_result_gen = Rcpp::wrap(c_nnls_double(x, y, max_iter, rel_tol));
                                                      ^~~~~~~~
RcppExports.cpp:404:54: note: suggested alternative: 'max_iterSEXP'
     rcpp_result_gen = Rcpp::wrap(c_nnls_double(x, y, max_iter, rel_tol));
                                                      ^~~~~~~~
                                                      max_iterSEXP
make: *** [C:/PROGRA~1/R/R-40~1.2/etc/i386/Makeconf:229: RcppExports.o] Error 1
ERROR: compilation failed for package 'rsparse'
* removing 'C:/Users/zacha/Documents/R/win-library/4.0/rsparse'
Error: Failed to install 'rsparse' from GitHub:
  (converted from warning) installation of package ‘C:/Users/zacha/AppData/Local/Temp/RtmpsH0MQU/file4b1017134c0/rsparse_0.5.0.tar.gz’ had non-zero exit status

My sessionInfo():

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

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     

other attached packages:
[1] devtools_2.3.1 usethis_1.6.1 

loaded via a namespace (and not attached):
 [1] rstudioapi_0.11   magrittr_1.5      pkgload_1.1.0     lattice_0.20-41   R6_2.5.0         
 [6] rlang_0.4.7       fansi_0.4.1       tools_4.0.2       pkgbuild_1.1.0    grid_4.0.2       
[11] sessioninfo_1.1.1 cli_2.0.2         withr_2.2.0       remotes_2.2.0     ellipsis_0.3.1   
[16] yaml_2.2.1        assertthat_0.2.1  digest_0.6.25     rprojroot_1.3-2   crayon_1.3.4     
[21] processx_3.4.3    Matrix_1.2-18     callr_3.4.3       fs_1.4.2          ps_1.3.3         
[26] curl_4.3          testthat_2.3.2    memoise_1.1.0     glue_1.4.2        compiler_4.0.2   
[31] desc_1.2.0        backports_1.1.8   prettyunits_1.1.1

If I understand the issue correctly, the uint class used in RcppExports is throwing the issue. I can't get the RcppExports file to compile on it's own loading it directly via source. However, if I change uint to int it works fine.

Thanks again for your work.

@zdebruine
Copy link
Author

I forked the directory and changed all instances of uint to int in all files (nnls.hpp, RcppExports.cpp, and nnls.cpp).

The code now compiles! See Dirk Edelbuettel's guidance in the comment to the answer in this question:

https://stackoverflow.com/questions/17558658/rcpp-creating-a-dataframe-with-a-vector-of-long-long

Apparently it's better to simply use int or double in Rcpp exports, not uint as this is not supported by R.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant