提问人:user3466328 提问时间:9/17/2021 最后编辑:user3466328 更新时间:9/17/2021 访问量:1512
如何在 Mac 上启用 openMP 的 R 中安装 data.table(macOS Big Sur 11.5.1)
How can I install data.table in R with openMP enabled on Mac (macOS Big Sur 11.5.1)
问:
我想在启用 openMP 的情况下安装 data.table,以便默认情况下可以使用多个线程。我尝试按照以下步骤操作:
https://github.com/Rdatatable/data.table/wiki/Installation
我使用的是运行 macOS Big Sur 11.5.1 的 Mac。我已经按照安装指南中的 Mac 选项 1 进行操作,但是我仍然收到以下错误:
> install.packages("data.table", type = "source")
trying URL 'https://cran.rstudio.com/src/contrib/data.table_1.14.0.tar.gz'
Content type 'application/x-gzip' length 5303849 bytes (5.1 MB)
==================================================
downloaded 5.1 MB
* 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 ...
./configure: line 91: /usr/local/opt/llvm/bin/clang: No such file or directory
*** 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
/usr/local/opt/llvm/bin/clang -fopenmp -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -DNOZLIB -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c assign.c -o assign.o
/bin/sh: /usr/local/opt/llvm/bin/clang: No such file or directory
make: *** [assign.o] Error 127
ERROR: compilation failed for package ‘data.table’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/data.table’
Warning in install.packages :
installation of package ‘data.table’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/mv/33n4th797_58wlqz_f1sxx1h0000gn/T/Rtmp60sS3m/downloaded_packages’
我的 Makevars 文件如下所示:
LLVM_LOC = /usr/local/opt/llvm
## for data.table compilation, comment OUT 2 lines below; then uncomment 5 lines in block at the end. Reverse after finishing.
# CC=$(LLVM_LOC)/bin/clang
# CXX=$(LLVM_LOC)/bin/clang++
# O3 should be faster than -O2 (default) level optimisation ..
CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
LDFLAGS=-L/usr/local/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib -L/usr/local/opt/libomp/lib -lomp
CPPFLAGS=-I/usr/local/opt/gettext/include -I$(LLVM_LOC)/include
### For data.table only: uncomment these 5 lines ####
CC=$(LLVM_LOC)/bin/clang -fopenmp
CXX=$(LLVM_LOC)/bin/clang++ -fopenmp
CPPFLAGS=-I/usr/local/opt/gettext/include -I$(LLVM_LOC)/include -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp
SHLIB_OPENMP_CFLAGS = -fopenmp
SHLIB_OPENMP_CXXFLAGS = -fopenmp
关于我的 R 会话的一些额外的可能有用的上下文:
> R.version
_
platform aarch64-apple-darwin20
arch aarch64
os darwin20
system aarch64, darwin20
status
major 4
minor 1.1
year 2021
month 08
day 10
svn rev 80725
language R
version.string R version 4.1.1 (2021-08-10)
nickname Kick Things
我已经关注了其他社区成员的无数堆栈溢出问题,但我仍然被卡住了,希望得到一些帮助。
谢谢!
答: 暂无答案
评论