ashiklom/pecan

Issue installing on Mac OSX with gfortran 4.9

serbinsh opened this issue · 5 comments

I attempted to install on my laptop today:


> library(devtools)
> install_github("ashiklom/pecan", subdir="modules/rtm", ref="sail_fortran")
Downloading github repo ashiklom/pecan@sail_fortran
Installing PEcAnRTM
Installing 2 packages: chron, data.table
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ  \
  --no-save --no-restore CMD INSTALL  \
  '/private/var/folders/lh/6pcb927n1sn8cygbpjp573cm0000gn/T/Rtmpvv7B9K/devtools9f4e38802197/ashiklom-pecan-2fc0357/modules/rtm'  \
  --library='/Users/shawnserbin/R/library' --install-tests 

* installing *source* package ‘PEcAnRTM’ ...
** libs
gfortran-4.8  -fno-common -Wall -g -O2  -c  RTM/modules/mod_types.f90 -o RTM/modules/mod_types.o
make: gfortran-4.8: No such file or directory
make: *** [RTM/modules/mod_types.o] Error 1
ERROR: compilation failed for package ‘PEcAnRTM’
* removing ‘/Users/shawnserbin/R/library/PEcAnRTM’
Error: Command failed (1)

Not sure why it had issues with gfortran. However, I am running 4.9 not 4.8? WIll try downloading and making localy, outside of R.

This is because, for whatever reason, R defaults to an old version of
gfortran. The way to fix this is to set the Fortran version in the
~/.R.Makevars file.

From "R Installation and Administration" (
http://cran.r-project.org/doc/manuals/r-devel/R-admin.html):

"The default compilers specified in
/Library/Frameworks/R.framework/Resources/etc/Makeconf depend on the
version of OS X under which R was installed, and are appropriate to the
latest version of the command-line tools for that version of OS X. The
settings can be changed, either by editing that file or in a file such as
~/.R/Makevars (see the next section). Entries which may need to be changed
include ‘CC’, ‘CXX’, ‘FC’, ‘F77’, ‘FLIBS’ and the corresponding flags, and
perhaps ‘CXXCPP’, ‘DYLIB_LD’, ‘MAIN_LD’, ‘SHLIB_CXXLD’, ‘SHLIB_FCLD’ and ‘
SHLIB_LD’.

So for example you could select clang for both C and C++ with extensive
checking by having in ~/.R/Makevars

CC=clang
CXX=clang++
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion

and for a version of gfortran-4.2 we needed

FLIBS=-lgfortran"

Let me know if that works!

On Mon, Jul 6, 2015 at 9:34 AM, Shawn P. Serbin notifications@github.com
wrote:

I attempted to install on my laptop today:

library(devtools)
install_github("ashiklom/pecan", subdir="modules/rtm", ref="sail_fortran")
Downloading github repo ashiklom/pecan@sail_fortran
Installing PEcAnRTM
Installing 2 packages: chron, data.table
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ
--no-save --no-restore CMD INSTALL
'/private/var/folders/lh/6pcb927n1sn8cygbpjp573cm0000gn/T/Rtmpvv7B9K/devtools9f4e38802197/ashiklom-pecan-2fc0357/modules/rtm'
--library='/Users/shawnserbin/R/library' --install-tests

  • installing source package ‘PEcAnRTM’ ...
    ** libs
    gfortran-4.8 -fno-common -Wall -g -O2 -c RTM/modules/mod_types.f90 -o RTM/modules/mod_types.o
    make: gfortran-4.8: No such file or directory
    make: *** [RTM/modules/mod_types.o] Error 1
    ERROR: compilation failed for package ‘PEcAnRTM’
  • removing ‘/Users/shawnserbin/R/library/PEcAnRTM’
    Error: Command failed (1)

Not sure why it had issues with gfortran. However, I am running 4.9 not
4.8? WIll try downloading and making localy, outside of R.


Reply to this email directly or view it on GitHub
#11.

Trying this now, thanks!

Fixed. Had to add this to my .R/Makevars file in my home:

FC=gfortran

Now finds my "custom" install of gfortran 4.9.2 and makes/builds/installs OK

Glad it worked! I also added the fix to the README.md. It probably makes more sense to put it there since it's the first thing people see before installing.