Installing igraph on OS X Mavericks - r

I'm having trouble installing igraph on R 3.1.0 on OS X Mavericks with XCode 5.1.1. The error message I get is:
ld: illegal text-relocation to '___gmp_binvert_limb_table' in /usr/local/lib/libgmp.a(mp_minv_tab.o) from '___gmpn_divexact_1' in /usr/local/lib/libgmp.a(dive_1.o) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [igraph.so] Error 1
ERROR: compilation failed for package ‘igraph’
Looking around, I found that I'm not the only one to have this issue and it's not limited to igraph (here and here), but adding CXXFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future to ~/.R/Makevars didn't help. From the error message, it looks like R found the system installation of GMP and not the Macports version, which could conceivably have been built for a different architecture. (Installing from binaries also didn't work for me, with an error message of image not found, but it looks like this is a separate issue.) Has anyone else encountered similar issues?
sessionInfo() gives:
R version 3.1.0 (2014-04-10)
Platform: x86_64-apple-darwin13.0.2 (64-bit)
Thanks in advance!

In case this is helpful to anyone else, here is the solution from Gabor Csardi that worked for me: Try with the binary distribution of R. I had built R from source, and that version didn't work with installing igraph from either source or binary.

Related

Error: Install papaja package and updating R

Problem: I was trying to install the papaja package
devtools::install_github("crsh/papaja")
I received this error:
Error: Failed to install 'reprex' from GitHub:
System command 'Rcmd.exe' failed, exit status: -1, stdout + stderr empty
To potentially resolve this error, I tried to update R and this came up:
Warning message:
In shell(install_cmd, wait = wait, ...) :
'C:\Users\naomi\AppData\Local\Temp\RtmpyQPZSR/R-4.0.3-win.exe' execution failed with error code 127
The first error is my main issue which I am trying to resolve. I would appreciate your help with diagnosing both.
This is my current R version: R version 4.0.2 (2020-06-22)
There are several potential issues and it isn't completely clear to me what the issue is just judging from the error code. Here's what I'd try to do:
Check your installation of Rtools and if it is the right version for R 4.0.2
Check if devtools is updated/reinstalled after upgrading to R 4.0.2 (potentially from 3.x.x)
Try installing R 4.0.3 using admin rights, then it should work.
If you still can't install using devtools, try to download the package as .tar.gz and install from the local file.
I hope this helps. I will check if my suggestions helped you out.

Unable to install R packages due to library not found

In any R package I try to install, I get the following error message:
ld: library not found for -lintl
collect2: error: ld returned 1 exit status
make: *** [utf8.so] Error 1
I'm not sure how to make this a reprex, but I am running:
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin19.5.0 (64-bit)
Running under: macOS Catalina 10.15.5
What does this error message (ld: library not found for -lintl) mean and how can I fix it to be able to install R packages (the packages I have tried are texreg and lme4)? Thank you.
Edit: I apologize, I thought I had included this with my post. I am not missing gettext (as per Link error installing Rcpp "library not found for -lintl"), and I followed the instructions to export the LPDFLAGS and CPPFLAGS so that they are linked.
As best I can tell, the problem is the ~/.R/Makevars file, which currently looks like this, where I've commented out things I've added to it based on googling.
CC=/usr/local/Cellar/gcc/9.3.0_1/bin/gcc-9
CXX=/usr/local/Cellar/gcc/9.3.0_1/bin/g++-9
CXX11=/usr/local/Cellar/gcc/9.3.0_1/bin/g++-9
CXX14=/usr/local/Cellar/gcc/9.3.0_1/bin/g++-9
cxx17=/usr/local/cellar/gcc/9.3.0_1/bin/g++-9
cxx1X=/usr/local/cellar/gcc/9.3.0_1/bin/g++-9
LDFLAGS=-L/usr/local/Cellar/gcc/9.3.0_1/lib
#FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0
#CC=/usr/local/clang4/bin/clang
#CXX=/usr/local/clang4/bin/clang++
#CXX1X=/usr/local/clang4/bin/clang++
#CXX98=/usr/local/clang4/bin/clang++
#CXX11=/usr/local/clang4/bin/clang++
#CXX14=/usr/local/clang4/bin/clang++
#CXX17=/usr/local/clang4/bin/clang++
#LDFLAGS=-L/usr/local/clang4/lib
Apparently, I needed to remove all the lines from ~/.R/Makevars and I was able to install lme4. I did get some warnings, but library(lme4) works.
If you're using a mac with an Apple Silicon chip (like the M1), then you can try adding this to ~/.R/Makevars:
CFLAGS=-I/opt/homebrew/include
CPPFLAGS=-I/opt/homebrew/include
CXXFLAGS=-I/opt/homebrew/include
CXX11FLAGS=-I/opt/homebrew/include
LDFLAGS=-L/opt/homebrew/lib
This allows R to find the needed libraries. You will need to first ensure you have the needed compilers and dependencies installed. You can usually do this with brew.

Installing ProStaR on mac

I am trying to install the ProStaR and DAPAR packages with Rstudio (R version 3.6.3). Following the instructions from the instruction manual (https://www.bioconductor.org/packages/release/bioc/vignettes/DAPAR/inst/doc/Prostar_UserManual.pdf) after running the following code:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version='3.10')
BiocManager::install("DAPAR")
BiocManager::install("Prostar")
library(Prostar)
Prostar()
I receive the following error messages:
>library(Prostar)
Error: package or namespace load failed for ‘Prostar’:
.onLoad failed in loadNamespace() for 'shiny', details:
call: NULL
error: invalid version specification ‘1,5’
> Prostar()
Error in Prostar() : could not find function "Prostar"
When trying to separately install the shiny package:
install.packages("shiny")
library("shiny")
I get the same error message:
Error: package or namespace load failed for ‘shiny’:
.onLoad failed in loadNamespace() for 'shiny', details:
call: NULL
error: invalid version specification ‘1,5’
I have to mention that I'm not extremely familiair with R yet. Any help would be greatly appreciated.
You did not include versions of several items in your setup so it's possible this comes from mismatching components (rather than my initial guess that it was due to a corrupt package from whatever mirror was being used.) I needed to upgrade to R 3.6.3 to match that aspect of your set up and in the process noted that Catalina OS users need a different version of R. I'm on Mojave, so my version now produces this on startup:
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
I then needed to update my BioConductor installation which was fairly quick but installing the DAPAR package takes a loooong time because of an extensive list of dependencies, some of which have unmet dependencies that required repeated attempts to get the process to completion. Then the Prostar package installation had another batch of unmet dependencies. After finally getting all the unmet dependencies installed, I'm unable to reproduce the error, so I'm thinking you should probably use another repository. I suggest first doing something like:
options(repos = "https://cloud.r-project.org/")
Or choose that mirror specification from the Rstudio setup panel. Then make another attempt.
I suppose it's possible that this issue arises because of a version mismatch of compilers. The CRAN page for MacOS says clang 7 is needed. In my setup I get this (in a Terminal window)
Comutername:~ myusername$ clang --version
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
And for gfortran I get:
GNU Fortran (GCC) 4.2.3
Copyright (C) 2007 Free Software Foundation, Inc.
I did all the R package installations from the R.app interface, so I suppose it's possible that some infelicity in Rstudio's package install process will be needed to explain this. Obviously all teh system installations such as clang and gfortran (and probably PROJ and other GIS packages) would need to be done from the Terminal command line. Sometimes it is safer to do all these installations from a minimal interface, possibly even from R running in a Terminal window. I've generally had good luck with R.app (over a span of 12 years) and less consistent results with Rstudio.

R packages failed to install: x86_64-apple-darwin13.4.0-ar: No such file or directory - What is "ar"?

I go this error when installing R packages like RStan (and anything that depends on it such as brms) and Devtools. Since in the message displayed during the installation, everything before this look normal, I think the failure to install can be boiled down to this:
/Users/lambda/anaconda3/bin/x86_64-apple-darwin13.4.0-ar -rs ../lib/libStanHeaders.a cvodes/src/cvodes/cvodes.o cvodes/src/cvodes/cvodes_io.o cvodes/src/cvodes/cvodea.o cvodes/src/cvodes/cvodea_io.o cvodes/src/cvodes/cvodes_direct.o cvodes/src/cvodes/cvodes_band.o cvodes/src/cvodes/cvodes_dense.o cvodes/src/cvodes/cvodes_diag.o cvodes/src/cvodes/cvodes_spils.o cvodes/src/cvodes/cvodes_spbcgs.o cvodes/src/cvodes/cvodes_spgmr.o cvodes/src/cvodes/cvodes_sptfqmr.o cvodes/src/cvodes/cvodes_sparse.o cvodes/src/cvodes/cvodes_bandpre.o cvodes/src/cvodes/cvodes_bbdpre.o cvodes/src/sundials/sundials_band.o cvodes/src/sundials/sundials_direct.o cvodes/src/sundials/sundials_math.o cvodes/src/sundials/sundials_pcg.o cvodes/src/sundials/sundials_spbcgs.o cvodes/src/sundials/sundials_spgmr.o cvodes/src/sundials/sundials_dense.o cvodes/src/sundials/sundials_iterative.o cvodes/src/sundials/sundials_nvector.o cvodes/src/sundials/sundials_sparse.o cvodes/src/sundials/sundials_spfgmr.o cvodes/src/sundials/sundials_sptfqmr.o cvodes/src/nvec_ser/nvector_serial.o
make: /Users/lambda/anaconda3/bin/x86_64-apple-darwin13.4.0-ar: No such file or directory
make: *** [static] Error 1
ERROR: compilation failed for package ‘StanHeaders’
I got this same error both with Xcode compiler and clang4 compiler; I don't think the problem is with the compiler, but with the thing called ar. BTW, I have installed Rcpp and it works. I have seen others having the same problem when installing RPy2. So what is that ar thing and how to fix it?
R version:
> version
_
platform x86_64-apple-darwin13.4.0
arch x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
status
major 3
minor 4.2
year 2017
month 09
day 28
svn rev 73368
language R
version.string R version 3.4.2 (2017-09-28)
nickname Short Summer
I just faced the same problem and I am using anaconda's Rstudio.
My way to fixed it is to install it in terminal, first to try these two on your terminal.
>conda install -c mittner r-rstan
>conda install -c r r-stanheaders #to install the packages in terminal
although I'm not sure where was wrong but it did work fine on me.
hope it helps.
// In the end it seems that there's something wrong with my Anaconda-Navigator, I reinstalled a RStudio and it goes fine.
I had the same problem with Rstudio from anaconda3. Then I from the anaconda navigator (Environments) I installed the gfortran_osx-64 package.
This got me the x86_64-apple-darwin15.5.0-gfortran binary under /anaconda3/bin.
Making a symbolic link did the trick:
elisa#~>ln -s /anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran /anaconda3/bin/x86_64-apple-darwin1
I already solved this problem. I got this problem when using RStudio inside Anaconda. Later I installed R 3.4.3 and RStudio outside Anaconda and everything went smoothly. It might have been some problem with the Anaconda RStudio.

Problems compiling rJava with RStudio on macOS Sierra 10.12.6

I am trying to install the rJava package into Rstudio using these instructions:
https://github.com/MTFA/CohortEx/wiki/Run-rJava-with-RStudio-under-OSX-10.10,-10.11-(El-Capitan)-or-10.12-(Sierra)
However, when I run this command:
unset JAVA_HOME R --quiet -e 'install.packages("rJava", type="source", repos="http://cran.us.r-project.org")'
I am getting this error:
clang: error: unsupported option '-fopenmp'
Any workarounds or suggestions?
Take a look here. Lots depends on R version. It might be that you need to recompile rJava
R 3.4, rJava, macOS and even more mess ;)
R, Java, rJava and macOS adventures
You need compiler with OpenMP support - thus, you need to use different clang version comparing to what you get out of the box.

Resources