R Issues
Help notes for debugging issues with R (code, install, infrastructure)
macOS package.install w/gfortran
Shane trying to install.packages('eegUtils')
on macOS hit
ld: warning: directory not found for option '-L/opt/gfortran/lib' ld: library not found for -lgfortran clang: error: linker command failed with exit code 1 (use -v to see invocation)
Solution from stack overflow: run brew install gfortran
and update vim ~/.R/Makevars
to look like
FC = /opt/homebrew/Cellar/gcc/11.3.0_2/bin/gfortran F77 = /opt/homebrew/Cellar/gcc/11.3.0_2/bin/gfortran FLIBS = -L/opt/homebrew/Cellar/gcc/11.3.0_2/lib/gcc/11
NB. 11.3.0_2
is likely out of date. Use files that actually exist.
Use ctrl+x
ctrl+f
in Vim to “tab complete” file names (esp current gcc version). Or copy paste from
ls -d /opt/homebrew/Cellar/gcc/*/bin/gfortran\ /opt/homebrew/Cellar/gcc/*/lib/gcc/*