renv: error installing packages that require C++ compiler

,

I'm using tidymodels to run xgboost, it works fine when not using renv.
However, when I incorporate renv into my project, i'm unable to install any packages (like xgboost) that require C++ compilation.

renv::install("xgboost")
# Downloading packages ----------------------------------------------
- Downloading xgboost from CRAN ...             OK [file is up to date]
Successfully downloaded 1 package in 1.2 seconds.

The following package(s) will be installed:
- xgboost [1.7.5.1]
These packages will be installed into "~/git/nba_pts_mod/renv/library/R-4.3/aarch64-apple-darwin20".

Do you want to proceed? [Y/n]: y

# Installing packages -----------------------------------------------
- Installing xgboost ...                        FAILED
Error: Error installing package 'xgboost':
===================================

* installing *source* package ‘xgboost’ ...
** package ‘xgboost’ successfully unpacked and MD5 sums checked
** using staged installation
checking Backtrace lib... 
checking whether the C++ compiler works... no
configure: error: in `/private/var/folders/nm/zvd1vshn7q38lv276ps59kfr0000gn/T/Rtmpkz0gCA/R.INSTALL990e4c28b93f/xgboost':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘xgboost’
* removing ‘/Users/fred/git/nba_pts_mod/renv/staging/1/xgboost’
install of package 'xgboost' failed [error code 1]

I'm guessing this happens because renv contains everything within it's own environment, so the path to my C++ cannot be found. I'm just unsure how to fix this...I'm not certain where "config.log" (as referenced in the error message) is stored either.

I should mention that i'm using Mac:

Sys.info()['version']

version 
"Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:34 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T8103"

Any help is greatly appreciated.

Thanks,
Oliver

I think theres a https://cran.r-project.org/bin/macosx/big-sur-arm64/contrib/4.3/xgboost_1.7.5.1.tgz macos binary for arm64 architecture available. I would think you could install from that, and snapshot the result.
try

renv::install("https://cran.r-project.org/bin/macosx/big-sur-arm64/contrib/4.3/xgboost_1.7.5.1.tgz")

Epic! That worked, thank you very much.

By chance, do you know why renv can't build packages dependent on C++ from CRAN?

in principle it can; its likely an issue with your particular setup; any error messages should point the way....

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.