[R-SIG-Mac] gfortran: command not found
Spencer Graves
@pencer@gr@ve@ @end|ng |rom prod@y@e@com
Sat Jul 8 15:24:55 CEST 2023
Dear Prof. Ripley et al.:
On 7/8/23 1:16 AM, Prof Brian Ripley wrote:
> On 08/07/2023 00:41, Spencer Graves wrote:
>> Hello, Simon Urbanek and Professor Ripley:
>>
>>
>> On 7/7/23 4:21 AM, Simon Urbanek wrote:
>>>
>>>
>>>> On Jul 7, 2023, at 6:54 PM, Prof Brian Ripley
>>>> <ripley using stats.ox.ac.uk> wrote:
>>>>
>>>> An alternative is not to have gfortran on the path and use a
>>>> personal Makevars file, as documented at
>>>> https://cran.r-project.org/doc/manuals/r-devel/R-admin.html#macOS-packages .
>>>>
>>>> Reasons to do it that way include
>>>>
>>>> a) GCC builds have included other compilers including gcc in the
>>>> same directory as gfortran, and I have been caught in the past by
>>>> badly-written software looking for gcc as a C compiler and finding
>>>> that one rather than Apple's gcc which is a wrapper for clang. (The
>>>> current gfortran distribution only includes
>>>> x86_64-apple-darwin20.0-gcc and similar.)
>>>>
>>>> b) If the gfortran you have installed differs from that used to
>>>> build R, you may need to set FLIBS, and this has happened as
>>>> different CRAN distributions have been built with different versions
>>>> of gfortran.
>>>>
>>>> When I do want gfortran on the path, for example to build other
>>>> software, I do symlink it to somewhere on my path.
>>>>
>>>> I would prefer if Simon continues to give the full path as FC in
>>>> etc/Makeconf: anyone who wants a different compiler can use a
>>>> personal Makevars. (Continues at least for arm64, and I would
>>>> prefer consistency.)
>>>>
>>>
>>>
>>> I agree - it wasn't entirely intentional (it's really historical),
>>> but then there was request for a PATH-less gfortran settings. After
>>> this discussion I agree that it's not a good idea since the
>>> instructions on CRAN should be fully self-sufficient *and* we want to
>>> avoid other incompatible Fortran compilers. (I have trouble reaching
>>> the x86_64 build machine from home right now, so I'll change it on
>>> Monday).
>>
>>
>> Might it be feasible and appropriate for me to try to do this
>> on my 2014 MacBook Pro running macOS 11.7.8?
>>
>>
>> I ask, because I have so far not been able to parse the
>> instructions in the link Prof. Ripley provided above. I found a ".r"
>> subdirectory in my default directory, but its contents seems to be
>> only "crashpad_database". I did not see anything that looked to me
>> like, "HOME/.R/Makevars-R_PLATFORM". ???
>
> You need to create the file (which is called ~/.R/Makevars in the
> section I referred you to). Using a case-insenstive file system does
> not help (I had no idea what created ~/.r/crashpad_database, but
> Googling suggests RStudio).
>
> (If you did not have ~/.r, you would need mkdir ~/.R in a Terminal.)
> Then use your favourite editor to create a file ~/.r/Makevars containing
> the single line
>
> FC=/opt/gfortran/bin/gfortran
>
>
> The only issue is if you ever install a new gfortran you will need to
> edit/remove this file -- it is easily forgotten. As Simon says he is
> changing this soon, I would make a note to remove the file when you
> update R.
For now, I've added a file "~/.r/Makevars" containing this single
line and deleted the corresponding reference from "/etc/paths". I
rebooted and confirmed that it works. Thanks very much. Spencer Graves
>
More information about the R-SIG-Mac
mailing list