0

Installing statnet on mac 10.10.3 with R 3.2.x (RStudio 0.99.441).

ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [latentnet.so] Error 1
ERROR: compilation failed for package ‘latentnet’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/latentnet’
Warning in install.packages :
installation of package ‘latentnet’ had non-zero exit status
ERROR: dependency ‘latentnet’ is not available for package ‘statnet’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/statnet’
Warning in install.packages :
installation of package ‘statnet’ had non-zero exit status

I tried updating XCode/Command Line Tools. Also tried not installing dependencies. I have been able to install other packages, such as ergm and sna.

It looks like the install is looking for the GCC folder and not finding it.

whereis gcc

reveals that my gcc is in /usr/bin/gcc

It looks like the install is looking for it in /usr/local/lib/gcc/

Is there a way to fix this?

smci
  • 32,567
  • 20
  • 113
  • 146
Chris J. Vargo
  • 2,266
  • 7
  • 28
  • 43

2 Answers2

1

This is a compilation error that you only get if you are trying to install packages from source, or when a package requires a library to be compiled from source. Normally, if you don’t use the latest version of R, you can install statnet from binary and thus R won’t have to compile the source package.

The version you are mentioning at the beginning of your message (0.99.441) is the version of your R-Studio, and not R. The version of your R is 3.2.x (Hence its address in the Library folder: /Library/Frameworks/R.framework/Versions/3.2/Resources…). Before trying to fix the compilation error you may want to try to roll back your R to a version like 3.1.2 or 3.1.3 on which you can probably download and install statnet in binary format.

For the compiler, my guess is that even if you fix the address of your gcc with a symlink, you will still get an error about gfortran or the version of gcc. Once I solved this issue by installing R and the right version of gcc through Homebrew, but right now I don’t have the possibility to try the solution and tell you exactly how.

My experience (on Yosemite) is that if you use 3.1.2 or 3.1.3, even if there is need for compilation, the error with gcc won’t occur.

retrography
  • 6,302
  • 3
  • 22
  • 32
  • I'm having issues finding 2.1.2 or 2.1.3, do you have the link? It's not in the "old" repo on cran. – Chris J. Vargo Jun 04 '15 at 14:44
  • This is 3.1.3 not 2.1.3, is that intentional? – Chris J. Vargo Jun 04 '15 at 14:54
  • My mistake. The right version was 3.1.2/3.1.3. R package binaries are compatible across minor version changes, e.g. from 3.1.2 to 3.1.3. What you are struggling with is (hopefully) that you have moved up one major version to 3.2 which necessitates recompiling of some packages, and it seems the makefile is searching in the wrong folders. Check 3.1.3 and let me know if it works. Hopefully it will. When you run R after installing the older version make sure the R running is the version you have just installed. R makes a version prompt when you run it. Just type R in command line - case sensitive. – retrography Jun 04 '15 at 15:30
0

sudo mkdir /usr/bin/lib && sudo ln -s /usr/bin/gcc /usr/bin/lib/gcc

Creates a new directory in /usr/bin called `lib' and creates a symbolic link to gcc in that new directory.

If that doesn't fix the error, you can undo it with:

sudo rm -i /usr/bin/lib/gcc && sudo rm -id /usr/bin/lib

hgiesel
  • 5,430
  • 2
  • 29
  • 56
  • Thank you for trying, this link works, but it's still looking for a subfolder that isn't in my gcc install, and a library 'lgfortran' that doesn't appear to be there either – Chris J. Vargo Jun 03 '15 at 14:54