timothyfrasier / related

8 stars 7 forks source link

problems with gfortran on mac install R v4.0 #6

Open tommydevitt opened 3 years ago

tommydevitt commented 3 years ago

Hi Tim,

Trying to install related on a mac running R 4.0.2 and got the following. Any suggestions?

Thanks in advance.

install.packages("~/Downloads/related_1.0.tar.gz", repos = NULL, type = "source") Installing package into ‘/Users/tjd66/Library/R/4.0/library’ (as ‘lib’ is unspecified)

  • installing source package ‘related’ ... using staged installation libs clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c family_sim.c -o family_sim.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c related.f90 -o related.o make: gfortran: No such file or directory make: *** [related.o] Error 1 ERROR: compilation failed for package ‘related’
  • removing ‘/Users/tjd66/Library/R/4.0/library/related’ Warning in install.packages : installation of package ‘/Users/tjd66/Downloads/related_1.0.tar.gz’ had non-zero exit status
timothyfrasier commented 3 years ago

Hi:

Did you try the .tgz file rather than the tar.gz file? The tgz file was compiled specifically for mac OS X.

I have not yet updated my version of R to 4.0, which I hear is actually quite different. I would believe that there is something different about 4.0 that is not dealing well with the older compiled version of related.

I’m afraid that my teaching load, with all courses here being virtual, is just about killing me, and I won’t have time to look into this for a while. I apologize, but I can let you know when I am able to come up with a fix. Alternatively, you may be able to build it yourself from the source code if you have the devtools R package as well as a Fortran compiler.

-Tim


Timothy R. Frasier Coordinator - Forensic Sciences Program Associate Professor - Department of Biology Saint Mary's University 923 Robie Street Halifax, NS B3H 3C3, Canada Email: timothy.frasier@smu.ca Tel: (902) 491-6382 www.frasierlab.ca http://frasierlab.ca/

On Sep 24, 2020, at 1:10 PM, tommydevitt notifications@github.com wrote:

CAUTION: This email is from an external sender. Do not click on links or open attachments unless you trust the sender. Please forward suspected phishing emails to reportphishing@smu.ca

Hi Tim,

Trying to install related on a mac running R 4.0.2 and got the following. Any suggestions?

Thanks in advance.

install.packages("~/Downloads/related_1.0.tar.gz", repos = NULL, type = "source") Installing package into ‘/Users/tjd66/Library/R/4.0/library’ (as ‘lib’ is unspecified)

installing source package ‘related’ ... using staged installation libs clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c family_sim.c -o family_sim.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c related.f90 -o related.o make: gfortran: No such file or directory make: *** [related.o] Error 1 ERROR: compilation failed for package ‘related’ removing ‘/Users/tjd66/Library/R/4.0/library/related’ Warning in install.packages : installation of package ‘/Users/tjd66/Downloads/related_1.0.tar.gz’ had non-zero exit status — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/timothyfrasier/related/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3NYWNTMLFI4ATN5K6NJBTSHNVQNANCNFSM4RYPYQPQ.

tommydevitt commented 3 years ago

No worries, I understand. The .tgz file didn't work for me either:

install.packages("~/Downloads/related_1.0.tgz", repos = NULL, type = .Platform$pkgType) Installing package into ‘/Users/tjd66/Library/R/4.0/library’ (as ‘lib’ is unspecified)

library(related) Loading required package: tools Loading required package: ggplot2 Error: package or namespace load failed for ‘related’: package ‘related’ was installed before R 4.0.0: please re-install it

bragef commented 3 years ago

Hi @tommydevitt,

I recently installed related from the source package using in R 4.0.3 on Mac OS, and it both compiled and run without problems as far as I can see.

You need to install a fortran compiler to compile the fortran code. There are several options, but I would suggest to use brew (https://brew.sh) to install a recent version of gcc which includes gfortran as part of the package. I had some trouble with R looking for the libraries in the wrong location, so you may also need to tell R where the fortran libraries are located. GCC 10 installed from brew put the library files in /usr/local/lib/gcc/10, to make R find the libraries you can add this to ~/.R/Makevars:

FC = /usr/local/bin/gfortran
FLIBS = -L/usr/local/lib/gcc/10 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm

Hi Tim,

Trying to install related on a mac running R 4.0.2 and got the following. Any suggestions?

Thanks in advance.

install.packages("~/Downloads/related_1.0.tar.gz", repos = NULL, type = "source") DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c family_sim.c -o family_sim.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c related.f90 -o related.o make: gfortran: No such file or directory

tommydevitt commented 3 years ago

Thanks @bragef . I've installed gcc with homebrew and created the Makevars file as you suggested, but I still get the following: Error: package or namespace load failed for ‘related’: package ‘related’ was installed before R 4.0.0: please re-install it

bragef commented 3 years ago

Thanks @bragef . I've installed gcc with homebrew and created the Makevars file as you suggested, but I still get the following: Error: package or namespace load failed for ‘related’: package ‘related’ was installed before R 4.0.0: please re-install it

Did you install build the source package? From the error it looks like you tried to install the binary package. Or have an old installation of the package you need to deinstall?

tommydevitt commented 3 years ago

@bragef I tried uninstalling and then reinstalling (via RStudio), following the instructions in the 'related' tutorial. I also installed the three library files into /usr/local/lib.

bragef commented 3 years ago

@bragef I tried uninstalling and then reinstalling (via RStudio), following the instructions in the 'related' tutorial. I also installed the three library files into /usr/local/lib.

I installed the same way you tried originally (from .tar.gz source package)

install.packages("~/Downloads/related_1.0.tar.gz", repos = NULL, type = "source")

If that compiles fine without any compiler errors, I don't know why it does not work. You should not need the library files if you build the package yourself.

kjloope commented 2 years ago

Thanks @bragef, I had this same issue when trying to install for R 4.1.0 in Rstudio and your instructions worked perfectly! I had to change the 10 to an 11 in the FLIBS path in the Makevars file i created since my version of gcc was 11 from the brew install, but otherwise it worked perfectly with mac os 10.15.7.