You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Instructions for building from source for OpenMP support on Apple Silicon / M1 / arm64 under Monterey 12.4 #5419
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:
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:
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'.
I just got access to a clean install of macOS 13.2.1 running on an m2 chip and was able to retest these instructions and confirm they continue to work but with a newly noted quirk in that they only work from the cli, not the R console GUI.
To recap with some extra notes on zlib / pkg-config:
Install the command line developer tools (xcode-select --install)
From an R interpreter running in your terminal emulator (e.g. iTerm2 or Terminal) install data.table (install.packages("data.table", type = "source")) ... this seems to be required for R installs to find pkg-config vs running the R console GUI app on macOS which seems unable to find pkg-config.
Test your install (data.table::test.data.table())
Reacted by Lino Ferreira, Hause Lin, Davide Biganzoli, Flavio Poletti, Mohamed A. Yusuf, Jonathan Vivas, Johan van den Hoogen, onurcanbektas and Claus Portner
Reacted by Claus Portner, Rodrigo Dal Ben, Mohamed A. Yusuf, onurcanbektas and Sergio Olmos
My sense is that this is documented but not supported and thus the present "works for me" level solution is adequate and thus the issue can be closed.
If some future reader is looking to clear up unknowns:
Why is pkg-config not picked up by the macOS R console GUI? (i.e. will this work if you try and do a data.table install in the console GUI)
Is pkg-config picked up by R Studio? (i.e. will this work if you try and do a data.table install in R Studio)
Is the impact of "successful" installation that lacks zlib (i.e. installs but doesn't pass the all tests) due to failure to detect pkg-config gentle enough that what amounts to silent failure is fine.
Ventura 13.5.2 / M2 Pro / clang-1500.0.40.1, built from source without problem, using instructions on this page, without @kylebutts 's tweak. Noting that the instructions on the page linked from the install.packages(data.table) message are not fully capturing the detail in this thread.
Hi! Thanks a lot. I was having trouble enabling parallel processing on the DECIPHER R package (specifically the IdTaxa() function) on my M2 mac (Ventura 13.5.2) and this helped me solve it. I'm leaving a comment here in the hopes that someone running in the same problem doesn't have to do all the googling I had to do to figure out it was an OpenMP problem.
Anyone on this thread able to test out #6034? Would be great to have more confirmation from Mac users that it's working (or at very least, not breaking anyone)
Anyone on this thread able to test out #6034? Would be great to have more confirmation from Mac users that it's working (or at very least, not breaking anyone)
Anyone on this thread able to test out #6034? Would be great to have more confirmation from Mac users that it's working (or at very least, not breaking anyone)
Activity
tdhock commentedon Jul 12, 2022
Can you please update the wiki with these instructions? (the wiki should be editable by anyone)
pintoa1-mskcc commentedon Aug 11, 2022
Great job @sciatro!
derekschinke commentedon Dec 8, 2022
Can confirm this still works on Ventura, as long as you make sure your
Makevarvsdoesn't save as an RTFsciatro commentedon Mar 11, 2023
I just got access to a clean install of macOS 13.2.1 running on an m2 chip and was able to retest these instructions and confirm they continue to work but with a newly noted quirk in that they only work from the cli, not the R console GUI.
To recap with some extra notes on zlib / pkg-config:
xcode-select --install)brew(see https://brew.sh/)pkg-configto provide zlib (brew install pkg-config)pkg-config --libs zlibshould return-lz)libompto get multiple threads (brew install libomp) ... this is the point~/.R/Makevars:install.packages("data.table", type = "source")) ... this seems to be required for R installs to findpkg-configvs running the R console GUI app on macOS which seems unable to findpkg-config.data.table::test.data.table())sciatro commentedon Mar 11, 2023
@tdhock I took a crack at updating the wiki in https://github.com/Rdatatable/data.table/wiki/Installation/370c4629742886190c08de5e199a8ca8d3d86b24
tdhock commentedon Mar 12, 2023
looks good thanks! ok to close this issue now? or do you think this info should be mentioned somewhere other than that wiki page?
sciatro commentedon Mar 13, 2023
My sense is that this is documented but not supported and thus the present "works for me" level solution is adequate and thus the issue can be closed.
If some future reader is looking to clear up unknowns:
pkg-confignot picked up by the macOS R console GUI? (i.e. will this work if you try and do a data.table install in the console GUI)pkg-configpicked up by R Studio? (i.e. will this work if you try and do a data.table install in R Studio)pkg-configgentle enough that what amounts to silent failure is fine.kylebutts commentedon Jun 25, 2023
Testing on Mac OS Ventura, the above wouldn't work, but with this small tweak, it worked perfectly!
pvanlaake commentedon Nov 2, 2023
Ventura 13.5.2 / M2 Pro / clang-1500.0.40.1, built from source without problem, using instructions on this page, without @kylebutts 's tweak. Noting that the instructions on the page linked from the
install.packages(data.table)message are not fully capturing the detail in this thread.jorondo1 commentedon Jan 23, 2024
Hi! Thanks a lot. I was having trouble enabling parallel processing on the DECIPHER R package (specifically the
IdTaxa()function) on my M2 mac (Ventura 13.5.2) and this helped me solve it. I'm leaving a comment here in the hopes that someone running in the same problem doesn't have to do all the googling I had to do to figure out it was an OpenMP problem.Briefly, here's what I did, summarized from above
BiocManager::install("DECIPHER", type="source")Jonavi04 commentedon Feb 18, 2024
@kylebutts's edits still working for MacOS Ventura 14.2 M3 pro! this thread saves my day!
MichaelChirico commentedon Mar 30, 2024
Anyone on this thread able to test out #6034? Would be great to have more confirmation from Mac users that it's working (or at very least, not breaking anyone)
cc reaction-only participants @odani @m-muecke @vc77 @arbuzovv @shrektan @linoferreira @hauselin @biga94 @polettif @truenomad @cportner @RodDalBen @sparrow925 @sigmafelix
truenomad commentedon Mar 31, 2024
Following the instructions and building from source solved it for me!
RodDalBen commentedon Jul 11, 2024
Works for me w/ version 1.15.99. Thank you!