emmanuelparadis / ape

analysis of phylogenetics and evolution
http://ape-package.ird.fr/
GNU General Public License v2.0
52 stars 11 forks source link

Compilation failed during installation: `cc1plus: some warnings being treated as errors`. #123

Closed iago-lito closed 1 month ago

iago-lito commented 1 month ago

Hello, installation failed today on my machine with the following logs :(

$ R -e "options(repos = structure(c(CRAN = 'http://cran.rstudio.com/'))); install.packages('ape', Ncpus=$(nproc))"
R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> options(repos = structure(c(CRAN = 'http://cran.rstudio.com/'))); install.packages('ape', Ncpus=20)
Installing package into ‘/home/iago-lito/R/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/ape_5.8.tar.gz'
Content type 'application/x-gzip' length 1579438 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘ape’ ...
** package ‘ape’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (GCC) 14.1.1 20240522’
using C++ compiler: ‘g++ (GCC) 14.1.1 20240522’
gcc -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c BIONJ.c -o BIONJ.o
gcc -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c NNI.c -o NNI.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects   -c RcppExports.cpp -o RcppExports.o
In file included from /usr/lib/R/library/Rcpp/include/Rcpp/routines.h:26,
                 from /usr/lib/R/library/Rcpp/include/RcppCommon.h:128,
                 from /usr/lib/R/library/Rcpp/include/Rcpp.h:27,
                 from RcppExports.cpp:4:
/usr/lib/R/library/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]’:
/usr/lib/R/library/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}
/usr/lib/R/library/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]’:
/usr/lib/R/library/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 /usr/lib/R/library/Rcpp/include/RcppCommon.h:181:
/usr/lib/R/library/Rcpp/include/Rcpp/print.h: In function ‘void Rcpp::warningcall(SEXP, const std::string&)’:
/usr/lib/R/library/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/lib64/R/etc/Makeconf:204: RcppExports.o] Error 1
ERROR: compilation failed for package ‘ape’
* removing ‘/home/iago-lito/R/x86_64-pc-linux-gnu-library/4.4/ape’

The downloaded source packages are in
    ‘/tmp/RtmpMfxcZJ/downloaded_packages’
Warning message:
In install.packages("ape", Ncpus = 20) :
  installation of package ‘ape’ had non-zero exit status

Should I attempt to have the compiler ignore the warnings? Or should they rather be fixed in ape sources?

iago-lito commented 1 month ago

Possible relevant discussion about the issue: https://github.com/RcppCore/Rcpp/issues/1287.

iago-lito commented 1 month ago

Okay, the problem seems to be that my /usr/lib/R/library/Rcpp was a somewhat lingering old version of Rcpp. The problem is solved with a fresh Rcpp install ;)