Closed pat-s closed 3 years ago
I'm using the approach suggested at https://github.com/rmacoslib/r-macos-rtools. I use the clang7 provided at https://cloud.r-project.org/bin/macosx/tools and only have to specify the following in ~/.R/Makevars
:
CC=/usr/local/clang7/bin/clang
CXX=/usr/local/clang7/bin/clang++
CXX1X=/usr/local/clang7/bin/clang++
CXX11=/usr/local/clang7/bin/clang++
CXX14=/usr/local/clang7/bin/clang++
CXX17=/usr/local/clang7/bin/clang++
LDFLAGS=-L/usr/local/clang7/lib
And everything works smoothly and consistently.
I'm not sure why the macOS instructions look so complicated, which will easily make beginner users who use macOS have a hard time even installing latest data.table
from source.
For me, the gcc
approach is the fastest and most stable one so far.
I am not sure though what other caveats this might introduce on macOS. 🤔
@jangorecki Who is in charge for the C-related part in {data.table} or might have more in-depth knowledge about what is going on behind the scenes?
gcc
is the compiler used on all major Linux distros, is there anything preventing it from setting it as the default on macOS?
There is no single person in charge of C part of DT. Matt and Arun wrote most of C stuff. AFAIR @arunsrinivasan is on macOS so his views on this issue could be very helpful.
I prefer to use gcc myself as well, but it happens that clang is the default one on MacOS. Trying to change default compiler globally for Mac users would causes more issues than it resolves. So I don't think changing default is the way to go. Now that https://github.com/Rdatatable/data.table/pull/4735 is merged (and already published to CRAN as 1.13.2), users should be able to more easily customize their build of data.table. Therefore it should address your use case. If it doesn't please let us know.
Hi @pat-s. Thanks for your input here. I would just add that if the MacOS instructions on our Installation page can be simplified, that would be very welcome. Please go ahead and make the changes directly yourself to the wiki. There are no permissions needed to change the wiki, which is the very reason we made it a wiki.
After reading and trying the compiler instructions for macOS, I was wondering if
gcc
from homebrew would be a better alternative thanllvm
.As stated in the wiki, an openmp enabled compilers causes issues with other packages. It is quite cumbersome to comment out the llvm compiler all the time if one wants to compile other packages.
Currently I am using the following setup with
gcc
installed viabrew install gcc
. No issues so far for any packages.In addition, I am using
ccache
as you can see. Combined with the~/.ccache/ccache.conf
settings below, I have a robust C compiler setup which supports caching.(The
ccache
part is taken from this post by Dirk.)