const-ae / sparseMatrixStats

Implementation of the matrixStats API for sparse matrices
Other
54 stars 3 forks source link

sparseMatrixStats does not compile under R 4.4.0 #28

Closed kmavrommatis closed 5 months ago

kmavrommatis commented 5 months ago

Hi, I recently upgraded from R 4.0 to R 4.4 and trying to install the package 'sparseMatrixStats' fails with compilation errors.

Ubuntu 22.04.4 LTS R version 4.4.0 (2024-04-24) -- "Puppy Cup"

error:

* installing *source* package ‘sparseMatrixStats’ ...
** using staged installation
** libs
using C++ compiler: ‘g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
using C++11
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG  -I'/lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include' -I/usr/local/include    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g   -c RcppExports.cpp -o RcppExports.o
In file included from /lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/Rcpp/routines.h:26,
                 from /lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/RcppCommon.h:127,
                 from /lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/Rcpp.h:27,
                 from RcppExports.cpp:4:
/lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/Rcpp/iostream/Rstreambuf.h: In member function ‘std::streamsize Rcpp::Rstreambuf<OUTPUT>::xsputn(const char*, std::streamsize) [with bool OUTPUT = true; std::streamsize = long int]’:
/lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/Rcpp/iostream/Rstreambuf.h:53:20: warning: field precision specifier ‘.*’ expects argument of type ‘int’, but argument 2 has type ‘std::streamsize’ {aka ‘long int’} [-Wformat=]
   53 |         Rprintf("%.*s", num, s);
      |                  ~~^~   ~~~
      |                    |    |
      |                    int  std::streamsize {aka long int}
/lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/Rcpp/iostream/Rstreambuf.h: In member function ‘std::streamsize Rcpp::Rstreambuf<OUTPUT>::xsputn(const char*, std::streamsize) [with bool OUTPUT = false; std::streamsize = long int]’:
/lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/Rcpp/iostream/Rstreambuf.h:57:21: warning: field precision specifier ‘.*’ expects argument of type ‘int’, but argument 2 has type ‘std::streamsize’ {aka ‘long int’} [-Wformat=]
   57 |         REprintf("%.*s", num, s);
      |                   ~~^~   ~~~
      |                     |    |
      |                     int  std::streamsize {aka long int}
In file included from /lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/RcppCommon.h:180,
                 from /lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/Rcpp.h:27,
                 from RcppExports.cpp:4:
/lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/Rcpp/print.h: In function ‘void Rcpp::warningcall(SEXP, const string&)’:
/lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include/Rcpp/print.h:30:19: error: format not a string literal and no format arguments [-Werror=format-security]
   30 |     Rf_warningcall(call, s.c_str());
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
make: *** [/usr/local/lib/R/etc/Makeconf:204: RcppExports.o] Error 1
ERROR: compilation failed for package ‘sparseMatrixStats’
* removing ‘/lab/ni/P-20210811-0003/scripts/R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/sparseMatrixStats’

The downloaded source packages are in
    ‘/tmp/RtmpWDvwqd/downloaded_packages’
Warning message:
In .inet_warning(msg) :
  installation of package ‘sparseMatrixStats’ had non-zero exit status
const-ae commented 5 months ago

You might be using an outdated Rcpp version. The issue appears fixed with the latest release, 1.0.12 (https://github.com/RcppCore/Rcpp/issues/1287#issuecomment-1829886024).

Please let me know if this fixes the problem. Otherwise could you please post the output of sessionInfo() after trying to install sparseMatrixStats?

kmavrommatis commented 5 months ago

Thanks for your response. I updated Rcpp along other packages that were suggested by the install mechanism and it is working now. Thanks K

const-ae commented 5 months ago

Great :)