[R-SIG-Mac] Building R-devel from source (solved)

Göran Broström gor@n@bro@trom @end|ng |rom umu@@e
Mon Aug 19 11:54:40 CEST 2019


Here is the report I promised. I followed the path below:

1. Got source from CRAN.

2. Read instructions under "Download R for (Mac) OS X"
  (shouldn't that read "Download R for macOS" nowadays?). Especially the 
note Important: "If you wish to compile R packages ..., see the tools 
directory."

3. In the tools directory: Download and install clang-7.0.0.pkg (I see 
now that I should have chosen clang-8.0.0 for R 3.7.0, which is 
R-devel?). Also download and install gfortran-6.1.pkg (It says: "To be 
used with El Capitan builds of R.", which worried me a little, since I 
am on High Sierra, but there were no alternatives.)

With this setup I got my first reported error. Thanks to Peter, I went 
on to

https://cran.r-project.org/doc/manuals/r-release/Radmin.html#macOS,

where I read

------
One way to use these builds with a binary distribution of R is to have a 
~/.R/Makevars file similar to (El Capitan)

FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0
   -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm

or (Sierra or High Sierra)

FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0
   -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
------

I naively chose the "Sierra or High Sierra" alternative, but that was 
wrong as you can see: It apparently refers to gfortran 6.3, so I 
switched to the the "El Capitan" alternative.

The final error message was then something about 'unable to compile 
mixed C and Fortran code', and that was fixed by changing

LDFLAGS="-L/usr/local/clang7/lib -L/usr/local/lib"

to

LDFLAGS="-L/usr/local/clang7/lib -L/usr/local/gfortran/lib
-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0"

and voila, ./configure run without complaints!

The later build also went smoothly (but I had to install java).

So, to sum up, there seems to be some discrepancy between the two
instruction sets I tried to follow.

Göran




Den 2019-08-19 kl. 00:06, skrev Göran Broström:
> Den 2019-08-18 kl. 22:16, skrev peter dalgaard:
>> /usr/local/clang7 is likely a better place to look. Check out Appendix 
>> C.3 of the R Inst.&Adm. manual:
>>
>> https://cran.r-project.org/doc/manuals/r-release/R-admin.html#macOS
> 
> That's better! After correcting some obvious(?) errors(?) in that page, 
> ./configure run without errors! (Had only read mac.r-procject.org/tools/ 
> so far).
> 
> After a night's sleep I will 'make'. I'll report back to r-sig-mac.
> 
> Thanks, Göran
> 
>>
>> -pd
>>
>>> On 18 Aug 2019, at 21:35 , Göran Broström <goran.brostrom using umu.se> wrote:
>>>
>>> Update: There is a libgcc_s.1.dylib in /usr/lib, as a symlink to 
>>> /usr/lib/libSystem.B.dylib. Is that one useful?
>>>
>>> Göran
>>>
>>> Den 2019-08-18 kl. 18:54, skrev Göran Broström:
>>>> Thanks Peter,
>>>> The tripping lines are here
>>>> configure:24611: checking size of size_t
>>>> configure:24616: gcc -o conftest -g -O2 -I/usr/local/include 
>>>> -L/usr/local/lib conftest.c -ldl -lm  >\
>>>> &5
>>>> configure:24616: $? = 0
>>>> configure:24616: ./conftest
>>>> dyld: Library not loaded: /usr/local/lib/libgcc_s.1.dylib
>>>>    Referenced from: /Users/gb/R/src/R-devel/./conftest
>>>>    Reason: image not found
>>>> so it seems as if my installation of tools is lacking an essential 
>>>> part (/usr/local/lib/libgcc_s.1.dylib). I'll look around, but any 
>>>> suggestion is welcome!
>>>> Göran
>>>> Den 2019-08-18 kl. 17:56, skrev peter dalgaard:
>>>>> I can't claim to understand this, but on my system of same age, 
>>>>> using system clang, configure does complete. It does get that error 
>>>>> on line 23748, but that, and several similar subsequent tests just 
>>>>> end up returning "yes".
>>>>>
>>>>> configure:23748: checking for size_t
>>>>> configure:23748: gcc -arch x86_64 -c -g -O2 -I/usr/local/include 
>>>>> conftest.c >&5
>>>>> configure:23748: $? = 0
>>>>> configure:23748: gcc -arch x86_64 -c -g -O2 -I/usr/local/include 
>>>>> conftest.c >&5
>>>>> conftest.c:118:21: error: expected expression
>>>>> if (sizeof ((size_t)))
>>>>>                       ^
>>>>> 1 error generated.
>>>>> [..snip..]
>>>>> configure:23748: result: yes
>>>>>
>>>>> (as usual, configure code is nigh on unreadable, but I think the 
>>>>> logic is that the size_t type exists if you can do "sizeof 
>>>>> (size_t)", but not "sizeof ((size_t))", so the error is expected.)
>>>>>
>>>>> The line that trips you up comes later:
>>>>>
>>>>> configure:24611: checking size of size_t
>>>>> configure:24616: gcc -arch x86_64 -o conftest -g -O2 
>>>>> -I/usr/local/include -L/usr/
>>>>> local/lib conftest.c -ldl -lm  >&5
>>>>> configure:24616: $? = 0
>>>>> configure:24616: ./conftest
>>>>> configure:24616: $? = 0
>>>>> configure:24630: result: 8
>>>>>
>>>>> so that is where you should look for clues (or at least tell us 
>>>>> what it says there).
>>>>>
>>>>> -pd
>>>>>
>>>>>> On 18 Aug 2019, at 13:34 , Göran Broström <goran.brostrom using umu.se> 
>>>>>> wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I'm (for the first time) trying to build R-devel from source (to 
>>>>>> be able to check my CRAN packages on a Mac), but it breaks already 
>>>>>> after
>>>>>>
>>>>>> gobr0002 using MBP-2:~/R/src/R-devel$ ./configure
>>>>>>
>>>>>> with
>>>>>>
>>>>>> checking size of size_t... configure: error: in 
>>>>>> `/Users/gb/R/src/R-devel':
>>>>>> configure: error: cannot compute sizeof (size_t)
>>>>>> See `config.log' for more details
>>>>>>
>>>>>> Some 'details' regarding size_t:
>>>>>>
>>>>>> configure:23748: checking for size_t
>>>>>> configure:23748: gcc -c -g -O2 -I/usr/local/include conftest.c >&5
>>>>>> configure:23748: $? = 0
>>>>>> configure:23748: gcc -c -g -O2 -I/usr/local/include conftest.c >&5
>>>>>> conftest.c: In function 'main':
>>>>>> conftest.c:116:21: error: expected expression before ')' token
>>>>>> if (sizeof ((size_t)))
>>>>>>                       ^
>>>>>>
>>>>>> My MacBook Pro is old (2010), so I am stuck with MacOS 10.13.6, 
>>>>>> XCode 10.1. I'm using clang 7.0.0 and fortran 6.1.0.
>>>>>>
>>>>>> Do I need to buy a new Mac?
>>>>>>
>>>>>> Thanks, Göran
>>>>>>
>>>>>> _______________________________________________
>>>>>> R-SIG-Mac mailing list
>>>>>> R-SIG-Mac using r-project.org
>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>>
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac using r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac using r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list