USCCANA / netdiffuseR

netdiffuseR: Analysis of Diffusion and Contagion Processes on Networks
https://USCCANA.github.io/netdiffuseR
Other
85 stars 21 forks source link

netdiffuseR won't install on OSX #3

Closed gvegayon closed 8 years ago

gvegayon commented 8 years ago

Reported by Pablo Lucas, trying to install the github version of the package returns with an error. This seems to be a problem with OSX + Packages depending on Rcpp. A solution to this problem (potential) is presented here https://github.com/hartleys/JunctionSeq/issues/2 with more details here http://thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/

In order to test this, the .travis.yml file has been modified to test installation on OSX environment.

> devtools::install_github("USCCANA/netdiffuseR")
Downloading GitHub repo USCCANA/netdiffuseR@master
Installing netdiffuseR
Installing 1 packages: RcppArmadillo

  There is a binary version available (and will be installed) but the source version is later:
                   binary      source
RcppArmadillo 0.6.300.2.2 0.6.400.2.2

'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore CMD INSTALL  \
  '/private/var/folders/x4/59wvgqpx6kv14y1740t5cwrm0000gp/T/RtmpbbBRmQ/devtools2dd17064327c/USCCANA-netdiffuseR-c226e61'  \
  --library='/Library/Frameworks/R.framework/Versions/3.2/Resources/library' --install-tests 

* installing *source* package ‘netdiffuseR’ ...
** libs
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c adjmat.cpp -o adjmat.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c infection.cpp -o infection.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c plot.cpp -o plot.o
plot.cpp:200:10: warning: unused variable 'mins' [-Wunused-variable]
  double mins = vertex_size.min();
         ^
plot.cpp:201:10: warning: unused variable 'maxs' [-Wunused-variable]
  double maxs = vertex_size.max();
         ^
2 warnings generated.
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c rgraph_ba.cpp -o rgraph_ba.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c rgraph_dyn.cpp -o rgraph_dyn.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c rgraph_er.cpp -o rgraph_er.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c selectionfunction.cpp -o selectionfunction.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c stats.cpp -o stats.o
stats.cpp:236:7: warning: unused variable 'T' [-Wunused-variable]
  int T = exposure.n_cols;
      ^
1 warning generated.
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c struct_equiv.cpp -o struct_equiv.o
clang++ -std=c++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o netdiffuseR.so RcppExports.o adjmat.o infection.o plot.o rgraph_ba.o rgraph_dyn.o rgraph_er.o selectionfunction.o stats.o struct_equiv.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
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: *** [netdiffuseR.so] Error 1
ERROR: compilation failed for package ‘netdiffuseR’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/netdiffuseR’
Error: Command failed (1)
gvegayon commented 8 years ago

As explained here http://thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/ there is a problem with the version of gfortran. In order to solve this, before installing netdiffuseR, the user must open the terminal and type:

curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /

After that, the user can install the package using devtools as

devtools::install_github("USCCANA/netdiffuseR")