Last active
April 8, 2023 17:52
-
-
Save dereckmezquita/ed860601138a46cf591a1bdcc95db0a2 to your computer and use it in GitHub Desktop.
Makevars and instructions for installing installing data.table on an M1 Mac; note config also works for installing slam/syuzhet.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if you downloaded llvm manually above, replace with your chosen NEW_PATH/clang | |
LLVM_LOC = /opt/homebrew/opt/llvm | |
CC=$(LLVM_LOC)/bin/clang -fopenmp | |
CXX=$(LLVM_LOC)/bin/clang++ -fopenmp | |
# -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/opt/homebrew/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib | |
CPPFLAGS=-I/opt/homebrew/opt/gettext/include -I$(LLVM_LOC)/include |
Versions
R --version
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20.6.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.
brew --version
Homebrew 3.3.4
Homebrew/homebrew-core (git revision 9ba60a6af62; last commit 2021-11-17)
Homebrew/homebrew-cask (git revision 8f52edfbb5; last commit 2021-11-17)
RStudio
RStudio
2021.09.1 Build 372
© 2009-2021 RStudio, PBC
RStudio troubleshooting
If you have trouble running RStudio, installed by one user launched from another user on the same machine. Your permissions and ownership might be broken. Try first to re-install RStudio. If this doesn't work the run:
sudo chown -R root RStudio.app
sudo chmod -R 0755 RStudio.app
As a note, this worked for me after being failed by the data.table
instructions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install multithreaded openMP
data.table
on anM1
MacInstalling
data.table
on an M1 Mac with multithreading support can be frustrating. Here is the process I used to accomplish this.If you've come across an error something like, cannot link file wrong architecture it is likely you've experienced the same erroneous set up I had:
ld: warning: ignoring file /Library/Frameworks/R.framework/R, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
The solution, install an
arm
version ofR
(I had intel) the new version ofRStudio
which supports thearm
version ofR
, and then setup yourMakevars
so everything can compile toarm
. What was happening before is you had anintel
version ofR
installed and wanted to compile forarm
which is incompatible when linking.Install
arm R
Install
R
by usingbrew
the package manager. The current version available is:For more detailed information on installing
data.table
visit: data.table installation instructionsThis will install in the following directory:
/opt/homebrew/opt/r/
Note if you want to have a multi-user set up for your
brew
installations use this guide: github.com/dereckdemezquita/mac-setupInstall
llvm
We need
llvm
to compiledata.table
:Make sure the path is exported in your
.zshrc
:Makevars
Now that you have
R
installed (should be the Apple silicon version; brew installs this one for you). You can create theMakevars
. This is simply a file with the nameMakevars
. This files holds the configurations necessary to compile packages on installation or withRcpp
. You don't have to have this configuration active at all times, just for compilingdata.table
.The location of this file is:
~/.R/Makevars
Paste the content shown in the gist.
Install
data.table
Install
data.table
through an externalR
console (terminal then type R). Note ifR
in the terminal window doesn't work this is because you haven't exported the path toR
executable to your console.library("data.table")