ZxZhou4150 / Redeconve

Deconvolution of spatial transcriptomics at single-cell resolution
MIT License
13 stars 0 forks source link

Error with missing gfortran during install on Mac Sonoma 14.5 #3

Closed pcantalupo closed 3 months ago

pcantalupo commented 3 months ago

I have gfortran installed on my Mac.

gfortran --version
GNU Fortran (Homebrew GCC 14.1.0) 14.1.0

however, when I try to install Redeconve, I get this error:

── R CMD build ─────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/private/var/folders/f0/2tg09kr923bfjpv_bw79bsb80000gq/T/RtmpuhLjHD/remotes1134a468b4b28/ZxZhou4150-Redeconve-751c73f/DESCRIPTION’ ...
─  preparing ‘Redeconve’: (513ms)
✔  checking DESCRIPTION meta-information
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts (345ms)
─  checking for empty or unneeded directories
     NB: this package now depends on R (>= 3.5.0)
     WARNING: Added dependency on R >= 3.5.0 because serialized objects in
     serialize/load version 3 cannot be read in older versions of R.
     File(s) containing such objects:
       ‘Redeconve/data/basic.rda’
─  building ‘Redeconve_1.1.1.tar.gz’

* installing *source* package ‘Redeconve’ ...
** using staged installation
** libs
using C compiler: ‘Apple clang version 15.0.0 (clang-1500.3.9.4)’
sh: /opt/gfortran/bin/gfortran: No such file or directory
using SDK: ‘MacOSX14.4.sdk’
/opt/gfortran/bin/gfortran -arch x86_64  -fPIC  -Wall -g -O2  -c  Hessian.f90 -o Hessian.o
make: /opt/gfortran/bin/gfortran: No such file or directory
make: *** [Hessian.o] Error 1
ERROR: compilation failed for package ‘Redeconve’
* removing ‘/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/Redeconve’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/f0/2tg09kr923bfjpv_bw79bsb80000gq/T//RtmpuhLjHD/file1134a9402bc0/Redeconve_1.1.1.tar.gz’ had non-zero exit status

What is going wrong? Thank you

pcantalupo commented 3 months ago

I think I figured it out. My gfortran is installed in /usr/local/gfortran. So I created a symlink /opt/gfortran with sudo ln -s /usr/local/gfortran /opt/gfortran. Then, installing the package was successful

ZxZhou4150 commented 3 months ago

Thanks for bringing this up. The fortran codes are for efficiently calculate the correlation coefficients. In the near future we will substitute the self-written fortran codes with some developed R packages to get the same effect. That will greatly reduce these compilation errors.

pcantalupo commented 3 months ago

That would be good to substitute with your own code. My situation got more complicated. I tried to install Redeconve on a different Mac but it failed. I eventually had to build my own ~/.R/Makevars (thank you ChatGPT) with the following contents to get it to install:

$ cat ~/.R/Makevars
FC = /usr/local/bin/gfortran
F77 = /usr/local/bin/gfortran
FLIBS = -L/usr/local/Cellar/gcc/14.1.0_1/lib/gcc/current -lgfortran

LDFLAGS += -L/usr/local/Cellar/gcc/14.1.0_1/lib/gcc/current
CPPFLAGS += -I/usr/local/Cellar/gcc/14.1.0_1/include
ZxZhou4150 commented 3 months ago

I'm glad to hear that you solved the problem. If you want, please try our new release v1.1.2, in which all the redundant non-R codes are deleted to avoid compilation errors. Thanks again for bringing this up!