A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Rdatatable/data.table/issues/5419 below:

Instructions for building from source for OpenMP support on Apple Silicon / M1

Thanks for all the great work on data.table. It's a really fantastic tool.

I've found that the instructions at https://github.com/Rdatatable/data.table/wiki/Installation for building data.table from source to enable OpenMP support on macOS 12.4 Monterey do not produce a working build via the preferred Option 1.1 Install libomp with brew approach.

If, after brew update && brew install libomp the recommended .R/Makevars flags are set (i.e. CPPFLAGS += -Xclang -fopenmp and LDFLAGS += -lomp).

With the documented flags, install.package from source errors out after failing to find omp.h. After a bit of fiddling around I found that the following will produce a working install:

LDFLAGS += -L/opt/homebrew/opt/libomp/lib -lomp
CPPFLAGS += -I/opt/homebrew/opt/libomp/include -Xclang -fopenmp

That build does not, however, pass test.data.table() which fails after about 1800 tests citing the absence of libz. To solve this problem I needed to also install pkg-config (i.e. brew install pkg-config). After doing this and reinstalling data.table from source test.data.table() completes all 9999 tests successfully.

As such, for me, on a clean native R arm64 4.2.1 install onto an Apple M1 running on 12.4 with no other brew packages installed what I needed to do for a working OpenMP enabled install of data.table was:

  1. brew install libomp and pkg-config
  2. Create ~/.R/Makevars with:
LDFLAGS += -L/opt/homebrew/opt/libomp/lib -lomp
CPPFLAGS += -I/opt/homebrew/opt/libomp/include -Xclang -fopenmp
  1. Install data.table from source within R install.packages("data.table", type = "source")

Sorry that I do not have the exact error messages encountered along the way. Given how fussy macOS / OpenMP support has always been I assumed that I was the problem and thus did not keep track of the steps required to fix what I've now come to think could be more general departure of current state brew / xcode build tools (i.e. xcode-select --install) on Apple Silicon from the documentation.

If those who know more believe that the steps I took to get a working build are likely those required I'm not sure how this should be best documented as the current macOS instructions worked well for me on an x86 Mac very recently so I think this may be a case of platform specific differences in brew not just a 'new normal'.

odani, m-muecke, vc77, arbuzovv, tonytrill and 2 morepintoa1-mskcc, shrektan and tonytrillderekschinke, arbuzovv and tonytrill


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4