Closed indy5000 closed 8 years ago
Taking up the conversation here rather than the google group
Hi Indy -
The compiler requirements are determined by R and R won't look for another compiler. Thankfully, they make it easy to get gfortran-4.8 that will work with R. You can find instructions for installing here:
I'm sure you need the Mavericks compiler. The link to #FOOT57 shows you a command to easily install.
Let me know if that works.
Kyle
Hi Kyle, I couldn't get the older version of gfortran to work with OSX 10.11 (El Capitan), and other uses have reported the same:
http://stackoverflow.com/questions/32977363/gfortran-doesnt-work-after-upgrading-to-el-capitan
4.8 also broke my NONMEM and Pmetrics installs.
In the end it turns out that all I needed to do was update the file that tells R where the native compilers are and what command to use to invoke them (Makevars).
Your mac users would probably appreciate additional instructions on how to get mrgsolve to work on their machines, whilst preserving their other gfortran dependant packages.
Indy
Hi Indy -
Re-opening this issue because I don't believe it has been resolved yet.
4.8 also broke my NONMEM and Pmetrics installs.
You didn't share any details about what happened with this, so it's hard to know for sure. But I'm guessing you should have gfortran
linked to 6.1
and gfortran-4.8
linked to gfortran-4.8
. There is no reason why you couldn't run two gfortran
compilers on your system if it's properly installed.
In the end it turns out that all I needed to do was update the file that tells R where the native compilers are and what command to use to invoke them (Makevars).
Your mac users would probably appreciate additional instructions on how to get mrgsolve to work on their machines, whilst preserving their other gfortran dependant packages.
We recommend gfortran-4.8
because R
recommends gfortran-4.8
. That requirement is not built into mrgsolve
, but, rather, it is built into R
. That's why you got the original error message. I don't think it is a given that a non 4.8
compiler will break things, but for most users, 4.8
makes the most sense. mrgsolve
is, after all, an R
package.
I'm glad that you found a workaround to use 6.1
. The toolchain to build shared objects for R
is a pretty tricky issue which is evident from the large number of posts on r-devel
. If you are concerned about getting information out to users potentially facing the same issue, the way to do it is to share your solution by posting it in the issue tracker. I don't use El Capitan so I don't have any insights on what is happening there. We brought mrgsolve
to github
as a way to reach out and understand what is happening in the real world where people are probably not using the same platform that we are. For example, we've made great improvements in the windows
implementation as well as improving the information we provide on the Wiki through interaction and feedback from windows
users. We depend on your feedback to understand what is happening and issue the proper advice. But if you don't share the solution or at least work with us to find the solution, we cannot advance the knowledge base. In other words, it's up to you to help create the "additional instructions on how to get mrgsolve to work on their machines".
I updated the Compilers
page to provide the following additional instructions about gfortran
on MacOSX
. What do you think? Does this adequately address the issue?
Kyle
@indy5000 Also, can you report back on whether or not models compile and run properly with 6.1
? I think that would be useful information to have as well.
We've had a report like this from someone using gcc installed via Homebrew: https://github.com/metrumresearchgroup/mrgsolve/issues/7#issuecomment-191235680
The solution there was to install R
via Homebrew as well.
@dpastoor Are you still using Homebrew R
and compilers? Any issues so far?
Kyle
Hi Kyle,
I couldn't get gfortran 4.8 to work on my system at all due to the "gfortran: warning: couldn’t understand kern.osversion" error which seems to be a well described issue with old packages and new OSX versions. I couldn't find a solution to this that worked for me.
I don't believe that v4.8 is an R requirement, I suspect that it's just the default version that the CRAN package looks for. Prior to this PMetrics (also an R package) had been working fine with v6.1, and mrgsolve is now also working fine.
These are the instructions that I used from the CRAN help file (the relevant bit is at the end): https://cran.r-project.org/doc/manuals/r-release/R-admin.html
6.3.3 Customizing package compilation
The R system and package-specific compilation flags can be overridden or added to by setting the appropriate Make variables in the personal file HOME/.R/Makevars-R_PLATFORM (but HOME/.R/Makevars.win or HOME/.R/Makevars.win64 on Windows), or if that does not exist, HOME/.R/Makevars, where ‘R_PLATFORM’ is the platform for which R was built, as available in the platform component of the R variable R.version. An alternative personal file can be specified via the environment variable R_MAKEVARS_USER.
Package developers are encouraged to use this mechanism to enable a reasonable amount of diagnostic messaging (“warnings”) when compiling, such as e.g. -Wall -pedantic for tools from GCC, the Gnu Compiler Collection.
Note that this mechanism can also be used when it necessary to change the optimization level for a particular package. For example
for C code
CFLAGS=-g -O -mtune=native
for C++ code
CXXFLAGS=-g -O -mtune=native
for Fortran code
FFLAGS=-g -O -mtune=native
for Fortran 9x code
FCFLAGS=-g -O -mtune=native
Another use is to override the settings in a binary installation of R. For example, to use a different Fortran compiler on OS X
F77 = /usr/local/gfortran/bin/gfortran FC = /usr/local/gfortran/bin/gfortran FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin14/5.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm (line split for legibility here).
There is also provision for a site-wide Makevars.site file under R_HOME/etc (in a sub-architecture-specific directory if appropriate). This is read immediately after Makeconf, and an alternative file can be specified by environment variable R_MAKEVARS_SITE.
Note that these mechanisms do not work with packages which fail to pass settings down to sub-makes, perhaps reading etc/Makeconf in makefiles in subdirectories. Fortunately such packages are unusual.
Thank-you for updating your Wiki - I'm sure this will help OSX users in the future; and thank-you for your work on mrgsolve.
I don't believe that v4.8 is an R requirement, I suspect that it's just the default version that the CRAN package looks for.
The R
binary is built against 4.8
; this why it is looking for gfortran-4.8
.
https://cran.r-project.org/doc/manuals/R-admin.html#OS-X
Notice in the text that you quoted:
Another use is to override the settings in a binary installation of R. For example, to use a different Fortran compiler on OS X
When you change compilers via Makevars
you are changing what is set in your R
binary; it is not in the package, it's in R
itself.
Any problems compiling a model so far? Thanks for reporting back.
Kyle
If you are using the "Mavericks" R
binary, it was built against gfortran-4.8
and R
will will look for that compiler when installing `mrgsolve or when building a model.
If you want to redirect R
to an alternate gfortran
(probably only required on OSX):
Find where gfortran
is installed:
$ which gfortran
/usr/local/bin/gfortran
If you don't already have a directory called ~/.R
then:
$ mkdir ~/.R
Then edit ~/.R/Makevars
:
F77 = /usr/local/bin/gfortran
More information about compilers here: https://github.com/metrumresearchgroup/mrgsolve/wiki/compilers-and-mrgsolve#mac-osx-users
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0' ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
F77 = /usr/local/bin/gfortran FC = $F77 FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
does mrgsolve specifically require Gfortran 4.8? I have Gfortran 6.1 installed on my mac, but when I try to install mrgsolve it terminates with
gfortran-4.8 -fPIC -g -O2 -c R_FORTRAN_Test.f -o R_FORTRAN_Test.o make: gfortran-4.8: No such file or directory make: *\ [R_FORTRAN_Test.o] Error 1