Entering edit mode
benoahb
•
0
@benoahb-20352
Last seen 5.8 years ago
Hi all,
I'm new to R and it looks like I'm having issues setting up BiocManager and linked to the mgcv package and clang? See below. I'm running on macosx Mojave, I installed R, Rstudio, Xcode and Xcode command lines.
Any ideas?
Thanks, Ben
> BiocManager::install()
Bioconductor version 3.8 (BiocManager 1.30.4), R 3.5.3 (2019-03-11)
Update old packages: 'mgcv'
Update all/some/none? [a/s/n]:
a
There is a binary version available but the source version is later:
binary source needs_compilation
mgcv 1.8-27 1.8-28 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘mgcv’
trying URL 'https://cran.rstudio.com/src/contrib/mgcv_1.8-28.tar.gz'
Content type 'application/x-gzip' length 915991 bytes (894 KB)
==================================================
downloaded 894 KB
* installing *source* package ‘mgcv’ ...
** package ‘mgcv’ successfully unpacked and MD5 sums checked
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c coxph.c -o coxph.o
clang: error: unsupported option '-fopenmp'
make: *** [coxph.o] Error 1
ERROR: compilation failed for package ‘mgcv’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mgcv’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mgcv’
The downloaded source packages are in
‘/private/var/folders/k7/4zfz3tnj6sv7c5vx6khz09kr0000gn/T/RtmpP8RQpe/downloaded_packages’
Warning message:
In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘mgcv’ had non-zero exit status
Well, as I said, I already installed Xcode, and it is up to date. I checked and gfortran is also up to date. The only thing missing was clang. It seemed outdated on your link but updated it with Homebrew and the LLVM package. I also took the last Command Line Tools macOS 10.14 for Xcode 10.2.
But I end up with the exact same error message in R
Sorry not to read your question closely enough. I think this is an R installation issue rather than Bioconductor (probably
install.packages("mgcv")
fails in the same way...?) but to troubleshoot, I'd guess that the-fopenmp
flag is present in the file atR.home("etc/Makeconf")
. Can you verify that, and if so show the line(s) where it occurs?Actually, perhaps short-circuiting this trouble-shooting, see perhaps https://stackoverflow.com/a/43943631/547331
Yeah, I tried
install.packages("mgcv")
with the same results.Ok this is when I start to get lost. How do I verify "that the -fopenmp flag is present in the file at R.home("etc/Makeconf")"?
Also, I looked at the topic you linked. I already got clang but ran
brew install gcc
I looked into
/usr/local/opt/llvm/bin/clang
and the files are there and gcc is at/usr/local/opt/gcc
. "then you will have to add the compiler path to your~/.R/Makevars
file." I'm not sure what that means?.. still the same missing
-fopenmp
results.Type
R.home("etc/Makeconf")
into the R console, you'll get a path to a plain text file that you can open with any editor, e.g., RStudio. Look for lines containing-fopenmp
.The simplest solution is to simply say 'no' when asked to install the source version of mgcv.
The next simplest solution is likely to create a plain text file called 'Makevars' at the location returned by the R command
normalizePath("~/.R/Makevars")
. Use an editor (like RStudio) to insert two linesI'm not really sure how you installed your R, but that's likely important if neither of the above two solutions are good enough.
I installed R using the macOS package from CRAN website.
Here are the lines containing
-fopenmp
And here's what I get
There is no
~/.R
directory for that matter...create the .R directory in your home directory (
normalizePath("~/.")
and a plain text file Makevars. Edit the Makevars file as indicated above.I would guess that your version of clang is different from the one used by CRAN, and that you should use the version described on the page that I indicated above, but that would be an alternative solution and I would suggest trying to get the edited Makevars approach to work first.
I created .R in my home directory
normalizePath("~/.R")
and made a plain text Makevars file as you suggested, however I still get this error messageI took the version of clang from CRAN but it doesn't work. It does say that it is the last version is for El Capitan. Is it that the commands have not been updated to Mojave and I'm screwed until it is?
Did you create Makevars in the ~/.R directory?
I did, a plain text document...
Troubleshoot why
normalizePath("~/.R/Makevars")
fails -- it says that the path doesn't exist, but you say that it does.In the terminal, I can access
~/.R
and thels
command gives me aMakevars.txt
file.Said file contains
Yet, in R, I still get this error message
The file needs to be
Makevars
, without the.txt
extension.Finally, it worked!! Thanks for the help!