uabrc / uabrc.github.io

UAB Research Computing Documentation
https://docs.rc.uab.edu
21 stars 12 forks source link

Add FAQ entry for R error while building `glmnet` that looks like `g++-7: command not found` #721

Closed wwarriner closed 5 months ago

wwarriner commented 5 months ago

What would you like to see added?

Description

The error g++-7: command not found tells us R is using an unexpected command to build the package on your system. The typical command for building packages written in C++ on Linux systems is g++, without the trailing -7.

On our system, we found that this error is caused by a line in an unexpected file. The file is ~/.R/Makevars and contains the following line.

CXX17 = g++-7 -std=gnu++17 -fPIC

The line causes the build tool make to use the g++-7 executable instead of the typical g++ whenever C++17 is being compiled. The g++-7 executable doesn't exist on our system, hence the error command not found.

Resolution

To resolve the issue, delete the unexpected file using rm ~/.R/Makevars.

Resources used to troubleshoot the originating issue

wwarriner commented 5 months ago

https://ask.cyberinfrastructure.org/t/why-is-r-in-rstudio-attempting-to-build-package-binaries-with-g-7/3121