I'm starting a new project using renv
. I have initialized the project, and have begun installing projects. I can install binary package files into my renv
project without issue, but compiling with source fails, despite succeeding outside of any renv
project. For example: renv::install("data.table", type = "source")
(or install.packages("data.table", type = "source")
) yields:
Retrieving 'https://cran.rstudio.com/src/contrib/data.table_1.14.2.tar.gz' ...
OK [file is up to date]
Installing data.table [1.14.2] ...
FAILED
Error installing package 'data.table':
======================================
* installing *source* package ‘data.table’ ...
** package ‘data.table’ successfully unpacked and MD5 sums checked
** using staged installation
*** pkg-config is not installed.
*** Compilation will now be attempted and if it works you can ignore this message. In
*** particular, this should be the case on Mac where zlib is built in or pkg-config
*** is not installed. However, if compilation fails, try 'locate zlib.h zconf.h' and
*** ensure the zlib development library is installed :
*** deb: zlib1g-dev (Debian, Ubuntu, ...)
*** rpm: zlib-devel (Fedora, EPEL, ...)
*** There is a zlib in brew for OSX but the built in zlib should work.
*** Note that zlib is required to compile R itself so you may find the advice in the R-admin
*** guide helpful regarding zlib. On Debian/Ubuntu, zlib1g-dev is a dependency of r-base as
*** shown by 'apt-cache showsrc r-base | grep ^Build-Depends | grep zlib', and therefore
*** 'sudo apt-get build-dep r-base' should be sufficient too.
*** To silence this message, please ensure that :
*** 1) 'pkg-config --exists zlib' succeeds (i.e. $? -eq 0)
*** 2) 'pkg-config --libs zlib' contains -lz
*** Compilation will now be attempted ...
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
*** OpenMP not supported! data.table uses OpenMP to automatically
*** parallelize operations like sorting, grouping, file reading, etc.
*** For details on how to install the necessary toolchains on your OS see:
*** https://github.com/Rdatatable/data.table/wiki/Installation
*** Continuing installation without OpenMP support...
*** Compilation without compression support in fwrite
** libs
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -Xclang -fopenmp -DNOZLIB -fPIC -falign-functions=64 -Wall -g -O2 -c assign.c -o assign.o
In file included from assign.c:1:
In file included from ./data.table.h:1:
./myomp.h:2:12: fatal error: 'omp.h' file not found
#include <omp.h>
^~~~~~~
1 error generated.
make: *** [assign.o] Error 1
ERROR: compilation failed for package ‘data.table’
* removing ‘/Volumes/GoogleDrive-114494246111519559339/.shortcut-targets-by-id/1zKSXwMLk4PD0AIhuLsac6eSCUrefwgKP/2021-Transportation/Connor/atlas_veh_choice/renv/staging/1/data.table’
------------------------------------------------------------------------------
R is currently configured to use a compiler that does not have OpenMP support.
You may need to disable OpenMP, or update your compiler toolchain.
Please see https://support.bioconductor.org/p/119536/ for a related discussion.
Reason(s):
- "clang: error: unsupported option '-fopenmp'"
Error: install of package 'data.table' failed [error code 1]
I do not get this error when compiling the package from source outside an renv
. I have tried to compile a couple of other packages from source as well, without success. The error message is not always the same, but the failure is consistent. System Info below:
R version 4.2.0 (2022-04-22)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.4
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.0 tools_4.2.0 renv_0.15.5