Can't install on a Mac
slucey opened this issue · 30 comments
Several people have had issues installing on a Mac. This issue was addressed on the old RpathDev repository here.
In case this is a persistent question, I'll just move the answer from @Goiageshiketa to this thread (edited and corrected for the new repository structure)
- In terminal run:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- In terminal run (g++ then installed in /usr/local/bin/g++ in default):
brew install gcc
- Make "Makevars" file in ~/.R/
- Write in Makevars
CC = gcc
CXX = /usr/local/bin/g++ - In R run:
devtools::install_github('NOAA-EDAB/Rpath', build_vignettes = TRUE)
@slarge Thanks, fine for me.
Thanks...couldn't figure out how to move an issue from a repository I own to one I'm an admin on.
Hi @Goiageshiketa,
Thanks for sharing your fix. I also have an issue installing Rpath on Mac, and saw this closed issue.
Unfortunately, I'm stuck at step 3.
Which ~/.R/ folder are you talking about? I have several "Makevars" there already, for example: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppArmadillo/skeleton/Makevars
Would I add the lines below in this existing Makevars?
CC = gcc
CXX = /usr/local/bin/g++
I've tried it and it doesn't work, so I'm surely doing something wrong.
Thanks in advance for any help!
Best,
Rosalie
Here are my steps:
Open the terminal
Type cd ~/.R
in the terminal
Type ls
(this lists all the files in the directory
The file Makevars (no extension) is in that directory already for me.
Type open -e Makevars
to open the file in TextEdit (you can use any editor you like)
Mine looks like this:
##CC=/usr/local/clang6/bin/clang
##CXX=/usr/local/clang6/bin/clang++
CC=gcc
CXX=/usr/local/bin/g++-9
CXX1X=/usr/local/clang6/bin/clang++
CXX98=/usr/local/clang6/bin/clang++
CXX11=/usr/local/clang6/bin/clang++
CXX14=/usr/local/clang6/bin/clang++
CXX17=/usr/local/clang6/bin/clang++
LDFLAGS=-L/usr/local/clang6/lib
So you need to comment out the old entries for CC and CXX and add the new ones.
Hope this helps!
Thanks a lot, it worked!!
(In case future users read this, it only worked for me when I used the lines Sarah included in the last comment).
Thanks a lot for your help!
Thank you very much. It worked, on macOS Catalina 10.15. It is the same for me as #rosalied:
I modified Makevars with:
##CC=/usr/local/clang6/bin/clang
##CXX=/usr/local/clang6/bin/clang++
CC=gcc
CXX=/usr/local/bin/g++-9
CXX1X=/usr/local/clang6/bin/clang++
CXX98=/usr/local/clang6/bin/clang++
CXX11=/usr/local/clang6/bin/clang++
CXX14=/usr/local/clang6/bin/clang++
CXX17=/usr/local/clang6/bin/clang++
LDFLAGS=-L/usr/local/clang6/lib
G'day guys,
What macOS are you using. I'm on High Sierra and I don't have a "~/.R" directory. Has anyone else had to get it going on OS 10.13.6?
For now I think I'll try and just get the windows version going on a virtual box
Thanks
Beth
Hi Beth,
Thanks for taking an interest in Rpath. Unfortunately, I don't use a Mac but I'm flagging @sgaichas who does. I may need to start investigating this more as this is the single biggest headache with installing Rpath.
Sean
Thanks. I will also have a crack at figuring out how to get the compile working. Rpath can't be the only R package dealing with this.
Hi Beth,
I am running High Sierra, but originally installed on Sierra. I do still have the "~/.R" directory, perhaps because I had it before. I can't remember what I did originally, but I think you can make that directory and put a makevars file in it? Then R knows which compiler to use for Rpath.
I have had to switch the compiler for other things, such as VAST which has similar compiler issues. See here for making makevars and TMB/VAST compilation issues here.
Hope this helps!
--Sarah
G'day
Oh the solution is in ecosim.h
Replace
std::transform(base.begin(), base.end(), exp.begin(), out.begin(), ::pow); return out; }
With
std::transform(base.cbegin(), base.cend(), exp.cbegin(), out.begin(), [](double a, double b) {return ::pow(a, b); });
Then it should install fine under Rccp on mac.
If that screws anyone else up because the lambda doesn't work you could make your own wrapper function and switch that in instead. Basically follow the logic at
https://stackoverflow.com/questions/56260846/rcpp-no-matching-function-for-call-to-transform
Cheers
Beth
Thanks Beth! I tried to implement your fix but alas at least on my windows machine the lambdas do not work. I tried creating my own wrapper as well but apparently that works with c++11 or higher. I'll do a little more digging and try and figure out the best way to not break this for windows and linux.
@kaydin if you have a chance to look at this let me know. You know the C++ end better than me.
I don't have access to a mac to test (and can't get to one due to current situation...) but I will dig as well.
I'll have a crack next week.
Here is the code I tried but couldn't compile on windows
NumericVector vpow(const NumericVector base, const NumericVector exp) {
struct pow_wrapper{
public: double operator()(double a, double b){
return ::pow(a, b);
}
};
NumericVector out(base.size());
std::transform(base.cbegin(), base.cend(), exp.cbegin(), out.begin(),
pow_wrapper());
return out;
}
I probably have something out of order.
Try this:
struct pow_wrapper{
public: double operator()(double a, double b){
return ::pow(a, b);
}
};
NumericVector vpow(const NumericVector base, const NumericVector exp) {
NumericVector out(base.size());
std::transform(base.cbegin(), base.cend(), exp.cbegin(), out.begin(), pow_wrapper());
return out;
}
This compiled on my Windows laptop. I'll see if @sgaichas can test on her Mac. Changes have been implemented in our private repo but will push to public if successful.
This has been implemented in the public code.
To simplify testing, I've created a new branch with travis-ci to build using OSX and Unix systems. There is an argument in the .travis.yml "warnings_are_errors: false" that is necessary because of build warnings (build tests want more documentation and there is an undefined BAB somewhere). These warnings should be easy to fix and need to be addressed before submitting to CRAN. RPath builds on both the travis linux and travis osx builds. Note: I also created a null test from before the fix and it also builds so 🤷
Hi all,
I am having issues with installing Rpath. It was running fine on my old version of R, but after upgrading to 4.0.2 with a MacOS High Sierra 10.13.6, it will not run anymore.
I am able to make the Makevars file fine and complete every step up until step 5 of the original post. When I run the devtools command, it says that I need to install command line tools. I have already done this multiple times and no matter what, when I run the code for step 5, it keeps saying that I need to install command line tools.
Did anyone else run into this issue?
I need to look at the GitHub actions and see if I can figure out why this is breaking.
Trying to find a Mac to test on. This may be an R4.0 issue rather than an Rpath issue.
This does seem to be an R4.0 issue. Some advice here for R4.x and MacOS tools. I have not tested any of this because I have not yet installed R 4.0. Will report back when I am able to.
Hi Sean and Sarah,
My Rpath finally installed! I just followed the steps from the link that you sent, Sarah, and now it is good to go. Thank you both so much!
Great!