Skip to content

Wrong C++ compiler being used #2134

@jemorlanes

Description

@jemorlanes

Hi!

I am encountering an issue that I think stems from renv using a C++ compiler that is not right for the package it's trying to build:

renv::install("fgsea")

Do you want to proceed? [Y/n]: 
# Installing packages --------------------------------------------------------
- Installing Rcpp ...                           OK [linked from cache]
- Installing data.table ...                     OK [linked from cache]
- Installing formatR ...                        OK [linked from cache]
- Installing lambda.r ...                       OK [linked from cache]
- Installing futile.options ...                 OK [linked from cache]
- Installing futile.logger ...                  OK [linked from cache]
- Installing snow ...                           OK [linked from cache]
- Installing BH ...                             OK [linked from cache]
- Installing BiocVersion ...                    OK [linked from cache]
- Installing BiocParallel ...                   OK [linked from cache]
- Installing gtable ...                         OK [linked from cache]
- Installing isoband ...                        OK [linked from cache]
- Installing farver ...                         OK [linked from cache]
- Installing labeling ...                       OK [linked from cache]
- Installing R6 ...                             OK [linked from cache]
- Installing RColorBrewer ...                   OK [linked from cache]
- Installing viridisLite ...                    OK [linked from cache]
- Installing scales ...                         OK [linked from cache]
- Installing fansi ...                          OK [linked from cache]
- Installing utf8 ...                           OK [linked from cache]
- Installing pillar ...                         OK [linked from cache]
- Installing tibble ...                         OK [linked from cache]
- Installing withr ...                          OK [linked from cache]
- Installing ggplot2 ...                        OK [linked from cache]
- Installing cowplot ...                        OK [linked from cache]
- Installing fastmatch ...                      OK [linked from cache]
- Installing fgsea ...                          FAILED
Error: Error installing package 'fgsea':
=================================

* installing *source* package ‘fgsea’ ...
** using staged installation
** libs
using C++ compiler: ‘g++ (GCC) 11.5.0 20240719 (Red Hat 11.5.0-2)’
using C++11
g++ -std=gnu++11 -I"/opt/R/4.4.0/lib/R/include" -DNDEBUG  -I'/srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/Rcpp/include' -I'/srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/BH/include' -I/usr/local/include    -fpic  -g -O2   -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/opt/R/4.4.0/lib/R/include" -DNDEBUG  -I'/srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/Rcpp/include' -I'/srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/BH/include' -I/usr/local/include    -fpic  -g -O2   -c ScoreCalculation.cpp -o ScoreCalculation.o
g++ -std=gnu++11 -I"/opt/R/4.4.0/lib/R/include" -DNDEBUG  -I'/srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/Rcpp/include' -I'/srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/BH/include' -I/usr/local/include    -fpic  -g -O2   -c ScoreRuler.cpp -o ScoreRuler.o
In file included from /srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/BH/include/boost/math/special_functions/digamma.hpp:16,
                 from util.h:5,
                 from ScoreRuler.cpp:2:
/srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/BH/include/boost/math/tools/config.hpp:28:6: warning: #warning "Boost.Math requires C++14" [-Wcpp]
   28 | #    warning "Boost.Math requires C++14"
      |      ^~~~~~~
In file included from /srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/BH/include/boost/math/special_functions/digamma.hpp:17,
                 from util.h:5,
                 from ScoreRuler.cpp:2:
/srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/BH/include/boost/math/tools/type_traits.hpp:208:12: error: ‘is_final’ has not been declared in ‘std’
  208 | using std::is_final;
      |            ^~~~~~~~

And then the end of the traceback:

In file included from /srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/BH/include/boost/math/special_functions/digamma.hpp:25,
                 from util.h:5,
                 from ScoreRuler.cpp:2:
/srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/BH/include/boost/math/special_functions/math_fwd.hpp:1176:79: note: previous declaration ‘boost::math::tools::promote_args_t<T> boost::math::pow(T)’
 1176 |    BOOST_MATH_GPU_ENABLED BOOST_MATH_CXX14_CONSTEXPR tools::promote_args_t<T> pow(T base);
      |                                                                               ^~~
make: *** [/opt/R/4.4.0/lib/R/etc/Makeconf:204: ScoreRuler.o] Error 1
ERROR: compilation failed for package ‘fgsea’
* removing ‘/srv/home/javier.escudero/work/semla_stuff/semla/renv/staging/1/fgsea’
install of package 'fgsea' failed [error code 1]

I am further inclined to think that this comes from the wrong C++ compiler because when I try to install the fgsea package from outside of my renv project, it works perfectly with the following traceback. Note the gnu++17 flag:

* installing *source* package ‘fgsea’ ...
** package ‘fgsea’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘g++ (GCC) 11.5.0 20240719 (Red Hat 11.5.0-2)’
g++ -std=gnu++17 -I"/opt/R/4.4.0/lib/R/include" -DNDEBUG  -I'/srv/home/javier.escudero/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I'/srv/home/javier.escudero/R/x86_64-pc-linux-gnu-library/4.4/BH/include' -I/usr/local/include    -fpic  -g -O2   -c RcppExports.cpp -o RcppExports.o

I have tried to modify compiler variables with Sys.setenv(), but none have worked. I am not listing them here because I do not recall all the stuff that I've tried xD.

How can I communicate to/force renv which compilers to use?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions