Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling on macOS 10.6 with OpenMP (Homebrew LLVM) - export class ITime error on load #5251

Open
JDMcIninch opened this issue Nov 5, 2021 · 1 comment

Comments

@JDMcIninch
Copy link

I'm attempting to compile data.table from source to use with R 4.1.2 on macOS 15.6 using the Homebrew LLVM toolchain. The code appropriately finds the OpenMP support and compiles, but the package fails at the testing stage with an error complaining about class ITime being an undefined export Any ideas?

** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘data.table’ in namespaceExport(ns, exports):
 undefined exports: class ITime
Error: loading failed
Execution halted

Older versions of data.table will not compile do to an issue with the definition of the macro "match" in the R headers and the usage in the OpenMP code. I haven't really explored that.

Compilation:

> install.packages('data.table', type = 'source')
trying URL 'https://cran.rstudio.com/src/contrib/data.table_1.14.2.tar.gz'
Content type 'application/x-gzip' length 5301817 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 ...
R CMD SHLIB supports OpenMP without any extra hint
*** Compilation without compression support in fwrite
** libs
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c assign.c -o assign.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c between.c -o between.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c bmerge.c -o bmerge.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c chmatch.c -o chmatch.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c cj.c -o cj.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c coalesce.c -o coalesce.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c dogroups.c -o dogroups.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c fastmean.c -o fastmean.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c fcast.c -o fcast.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c fifelse.c -o fifelse.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c fmelt.c -o fmelt.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c forder.c -o forder.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c frank.c -o frank.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c fread.c -o fread.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c freadR.c -o freadR.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c froll.c -o froll.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c frollR.c -o frollR.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c frolladaptive.c -o frolladaptive.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c fsort.c -o fsort.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c fwrite.c -o fwrite.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c fwriteR.c -o fwriteR.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c gsumm.c -o gsumm.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c ijoin.c -o ijoin.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c init.c -o init.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c inrange.c -o inrange.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c nafill.c -o nafill.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c nqrecreateindices.c -o nqrecreateindices.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c openmp-utils.c -o openmp-utils.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c quickselect.c -o quickselect.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c rbindlist.c -o rbindlist.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c reorder.c -o reorder.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c shift.c -o shift.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c snprintf.c -o snprintf.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c subset.c -o subset.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c transpose.c -o transpose.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c types.c -o types.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c uniqlist.c -o uniqlist.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c utils.c -o utils.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c vecseq.c -o vecseq.o
/usr/local/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot `xcrun -show-sdk-path` -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include	-I/usr/local/opt/tcl-tk/include -I/usr/local/include  -fopenmp -DNOZLIB -fPIC  -g -O3 -mtune=native -pipe -c wrappers.c -o wrappers.o
/usr/local/opt/llvm/bin/clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -o data.table.so assign.o between.o bmerge.o chmatch.o cj.o coalesce.o dogroups.o fastmean.o fcast.o fifelse.o fmelt.o forder.o frank.o fread.o freadR.o froll.o frollR.o frolladaptive.o fsort.o fwrite.o fwriteR.o gsumm.o ijoin.o init.o inrange.o nafill.o nqrecreateindices.o openmp-utils.o quickselect.o rbindlist.o reorder.o shift.o snprintf.o subset.o transpose.o types.o uniqlist.o utils.o vecseq.o wrappers.o -fopenmp -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
PKG_CFLAGS = -fopenmp -DNOZLIB
PKG_LIBS = -fopenmp
if [ "data.table.so" != "datatable.so" ]; then mv data.table.so datatable.so; fi
if [ "" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ]; then install_name_tool -id datatable.so datatable.so; fi
installing to /Library/Frameworks/R.framework/Versions/4.1/Resources/library/00LOCK-data.table/00new/data.table/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘data.table’ in namespaceExport(ns, exports):
 undefined exports: class ITime
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/data.table’
Warning in install.packages :
  installation of package ‘/var/folders/s9/hc7p8yc13vnbxrf40d34894r0000gn/T//Rtmpcn55QA/downloaded_packages/data.table_1.14.2.tar.gz’ had non-zero exit status

Session info:

R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/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 utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.1.2  rentrez_1.2.3   fastmap_1.1.0   DBI_1.1.1       htmltools_0.5.2 tools_4.1.2     yaml_2.2.1     
 [8] rmarkdown_2.11  RMySQL_0.10.22  knitr_1.36      xfun_0.28       digest_0.6.28   jsonlite_1.7.2  rlang_0.4.12   
[15] evaluate_0.14   XML_3.99-0.8   

Makevars file:

# Homebrew bin / opt / lib locations
HB=/usr/local/bin
HO=/usr/local/opt
HL=/usr/local/lib
HI=/usr/local/include
HF=/usr/local/gfortran
LIBOMP=$(HO)/libomp

# MacOS Xcode header location
# (do "xcrun -show-sdk-path" in terminal to get path)
XH=`xcrun -show-sdk-path`

# Make using all cores (set # to # of cores on your machine)
# MAKE=make -j4

# LLVM (Clang) compiler options
CC=$(HO)/llvm/bin/clang
CXX=$(CC)++
CXX98=$(CC)++
CXX11=$(CC)++
CXX14=$(CC)++
CXX17=$(CC)++

# FORTRAN
FC=$(HF)/bin/gfortran
F77=$(FC)
FLIBS=-L$(HF)/lib -lgfortran -lquadmath -lm

# STD libraries
CXX1XSTD=-std=c++0x
CXX11STD=-std=c++11
CXX14STD=-std=c++14
CXX17STD=-std=c++17

# FLAGS
# STD_FLAGS=-g -O3 -Wall -pedantic -mtune=native -pipe
STD_FLAGS=-g -O3 -mtune=native -pipe
CFLAGS=$(STD_FLAGS)
CXXFLAGS=$(STD_FLAGS)
CXX98FLAGS=$(STD_FLAGS)
CXX11FLAGS=$(STD_FLAGS)
CXX14FLAGS=$(STD_FLAGS)
CXX17FLAGS=$(STD_FLAGS)

# Preprocessor FLAGS
# NB: -isysroot refigures the include path to the Xcode SDK we set above
CPPFLAGS=-isysroot $(XH) \
	-I$(HO)/llvm/include -I$(HO)/openssl/include \
	-I$(HO)/gettext/include	-I$(HO)/tcl-tk/include \
	-I$(HI)

# Linker flags (suggested by homebrew)
LDFLAGS+=-L$(HO)/llvm/lib -Wl,-rpath,$(HO)/llvm/lib

# Flags for OpenMP support that should allow packages that want to use
# OpenMP to do so (data.table), and other packages that bork with
# -fopenmp flag (stringi) to be left alone
SHLIB_OPENMP_CFLAGS=-fopenmp
SHLIB_OPENMP_CXXFLAGS=-fopenmp
SHLIB_OPENMP_CXX98FLAGS=-fopenmp
SHLIB_OPENMP_CXX11FLAGS=-fopenmp
SHLIB_OPENMP_CXX14FLAGS=-fopenmp
SHLIB_OPENMP_CXX17FLAGS=-fopenmp
SHLIB_OPENMP_FCFLAGS=-fopenmp
SHLIB_OPENMP_FFLAGS=-fopenmp
@JDMcIninch JDMcIninch changed the title Compiling on macOS 11.6 with OpenMP (Homebrew LLVM) - export class ITime error on load Compiling on macOS 10.6 with OpenMP (Homebrew LLVM) - export class ITime error on load Nov 5, 2021
@jurjoroa
Copy link

jurjoroa commented Feb 1, 2023

Hey!

You can run this into your Makevars file =

HOMEBREW_LOC=/usr/local
LLVM_LOC=$(HOMEBREW_LOC)/opt/llvm
CC=$(LLVM_LOC)/bin/clang -fopenmp
CXX=$(LLVM_LOC)/bin/clang++ -fopenmp
CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
LDFLAGS=-L$(HOMEBREW_LOC)/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib
CPPFLAGS=-I$(HOMEBREW_LOC)/opt/gettext/include -I$(LLVM_LOC)/include


You need to run this lines as well in your terminal (install packages):

brew install libopenmp

brew install libopenmpt

brew install --cask openmtp

brew install gcc

brew install llvm

Check please that you set your paths correctly:

export PATH=/opt/homebrew/bin:$PATH

export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"

export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"

With this, you are ready to go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants