[R-SIG-Mac] Cannot compile Fortran on macOS

Adelchi Azzalini @zz@||n| @end|ng |rom @t@t@un|pd@|t
Tue May 19 15:45:50 CEST 2020

In essence, my problem is that I cannot install a package which requires Fortran-77 compilation on my Mac.

More in detail, this is my own package 'mnormt' which exists on CRAN since 2006; it is currently at version 1.5-7. It has been developed in successive versions on a Linux machine, where it compiles with no problems. The macOS and MS-windows versions are created on CRAN, where it passes all pertaining checks.

Now, in the new pandemic world, I need create a new version of the package, but working from home, hence using my Mac laptop instead of the Linux desktop as in the past. Unfortunately, compilation or loading does not work. If I run 

 R CMD check mnormt_1.5-7.tar.gz

first I get a bunch of warning messages such as

Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) ....  [-Wconversion]
Warning: ‘lxchng’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Warning: Label 10 at (1) defined but not used [-Wunused-label]

and finally it crashes with

Error: package or namespace load failed for ‘mnormt’:
 .onLoad failed in loadNamespace() for 'mnormt', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Users/aa/SW-aa/Pkg-mnormt/mnormt.Rcheck/00LOCK-mnormt/00new/mnormt/libs/mnormt.so':
  dlopen(/Users/aa/SW-aa/Pkg-mnormt/mnormt.Rcheck/00LOCK-mnormt/00new/mnormt/libs/mnormt.so, 6): Symbol not found: ___addtf3
  Referenced from: /usr/local/lib/libquadmath.0.dylib
  Expected in: /usr/local/lib/libgcc_s_x86_64.1.dylib
 in /usr/local/lib/libquadmath.0.dylib
Error: loading failed

Needless to say, I have no idea what this "addtf3" is or it should be. There is no such a symbol in the Fortran code.

I believe to have installed all ingredients indicated at https://mac.r-project.org/tools/
See the list below with details about my system and other installed tools.

Any suggestions for sorting this out?

Adelchi Azzalini

Installation info:

R> R.version
platform       x86_64-apple-darwin17.0     
arch           x86_64                      
os             darwin17.0                  
system         x86_64, darwin17.0          
major          4                           
minor          0.0                         
year           2020                        
month          04                          
day            24                          
svn rev        78286                       
language       R                           
version.string R version 4.0.0 (2020-04-24)
nickname       Arbor Day                   

--- macOS Mojave 10.14.6

--- Xcode version 11.3.1

--- Fortran

[aa using mac-2013:~] gfortran -v
Using built-in specs.
Target: x86_64-apple-darwin18
Configured with: ../gcc-8.2.0/configure --prefix=/usr/local/gfortran --with-gmp=/Users/fx/devel/gcc/build_package/deps --enable-languages=c,c++,fortran,objc,obj-c++ --build=x86_64-apple-darwin18 --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Thread model: posix
gcc version 8.2.0 (GCC) 

[aa using mac-2013:~] echo $PATH

-- other tools indicated at https://mac.r-project.org/tools/
   xz-5.2.5/  is installed 
   PCRE2 10.34 built with --disable-jit 
   bzip2 Version 1.0.6 is installed

More information about the R-SIG-Mac mailing list