The package ravetools contains C++ code that requires general compilers such as gcc or clang to compile. In addition, the signal processing code requires FFTW3 library, which could be installed easily.
This guide contains three parts. In the first part, we will install proper compilers on your machine. If you have already installed them, please skip and proceed to the second part, in which you will install the FFTW3 library. The last part simply installs ravetools.
The development of ravetools is and will always be on the latest version of R. While I will try my best to maximize backward compatibility, it is unlikely for me to test ravetools on every single old versions of R. Choosing the latest R is always the best choice.
-
Please go to this website and follow their instructions to download
Rtools. As ofravetoolsis developed (R version4.1.2), the latestRtoolsversion is4. -
Once
Rtoolsis downloaded and installed, please open your R console, copy-paste the following R command and hit return:
write('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', file = "~/.Renviron", append = TRUE)-
Open your Windows start menu, search
Rtools Bash. IfRtoolshas been installed successfully, you will see an application with a purple icon and letterM. Open the application, you will see a terminal window. -
In the terminal, paste the following script and execute.
pacman -S mingw-w64-{i686,x86_64}-fftw
- You will be prompted with a question
Proceed with installation? (Y/n). Please enterYto agree. TheFFTW3library will be added to your system.
- If you have previously opened any, please close all of them just in case.
- Open your
RorRStudio. In your newly openedRconsole, paste the following code and return line-by-line.
if(system.file(package = 'remotes') == ""){ install.packages('remotes') }
remotes::install_github('dipterix/ravetools')Open your R. In the start-up message, you will see text similar to these
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)
Alternatively, you can run the following R command:
R.version$platform
##> [1] "aarch64-apple-darwin20"
Check the architecture keywords after Platform. If you see aarch64, then you have ARM CPU (such as M1 chip), and an ARM version of R installed. If you see x86_64, then you have an Intel version of R installed (even if you have ARM chips, your R is still Intel-based).
If you have ARM CPU (like M1-chip), it is always (strongly) recommended that you install R with the same architecture, because your compilers need to be consistent in architectures. If you have Intel-based R installed, then you have to set up a whole compiler chain that is Intel-based. (This tutorial does not cover such advanced case)
-
Open your
Terminal.app. It can be easily found in/Applicationfolder, or by pressingcommandkey and thespacekey at the same time, type "terminal". -
Run
xcode-select --installin the terminal and hitreturn/enterkey. You will be prompted with an "Agreement" window. Please accept and wait the installation process to finish.
If you see the message:
code-select: error: command line tools are already installed, use "Software Update" to install updates, this means the command-line tools have been already installed on your machine in the past, and you are safe to proceed to the next step.
Please go to HomeBrew's installation site to install HomeBrew. If you don't like to read, simply paste the following command into your terminal window and hit the return key:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Please answer all the prompted questions and wait till brew to brew itself.
Open a new terminal window. If you are using ARM CPU, then type
eval "$(/opt/homebrew/bin/brew shellenv)"
brew install pkg-config fftw
If you have Intel-based machine, type
eval "$(/usr/local/bin/brew shellenv)"
brew install pkg-config fftw
- If you have previously opened any, please close all of them just in case.
- Open your
RorRStudio. In your newly openedRconsole, paste the following code and return line-by-line.
if(system.file(package = 'remotes') == ""){ install.packages('remotes') }
remotes::install_github('dipterix/ravetools')- The following command will install essential build tools, system package configuration tools, and
FFTW3
sudo apt-get install build-essential pkg-config libfftw3-dev
Please search their alternatives if you are using other Linux systems such as RedHat or CentOS.
- After installation, type
Rin the terminal, hit return/enter key to open R environment, and run the following R commands.
if(system.file(package = 'remotes') == ""){ install.packages('remotes') }
remotes::install_github('dipterix/ravetools')Please check this Dockerfile. It takes 24 minutes to compile everything from source with 2 CPUs, 1 GB RAM
