[R-SIG-Mac] compilation with newer compilers on macos sierra

Kostas Savvidis kotika98 at yahoo.com
Mon Jan 9 14:01:22 CET 2017

Good morning,

Compiling R-3.3.2 on macOS sierra produced a series of difficulties. Some of them are surely self-inflicted but
in my estimation all will have to be dealt with sooner or later. I used gcc6 from macports to compile it.

1) In R-3.3.2/src/modules/lapack need the flag:

2) libz.h version checking in configure is broken, i.e. version 1.2.10 that i have from macports is flagged as too old.
  Culprit is in line 35513 of configure:
   strncmp(ZLIB_VERSION, "1.2.5", 5) 
  workaround: in libz.h replace the 1.2.10 string with 1.2.910 

3) Flags for libintl are not picked up at configure stage: needed to manually add it later
 LDFLAGS="-L/opt/local/lib" ./configure ...
	Note: somewhere along the compilation I spot "/opt/local/lib/libintl.dylib" on the command line compiling tools.so
       - who or what put it there?

4) --with-lapack option resulted eventually in:

byte-compiling package 'grDevices'
Warning in solve.default(rgb) :
 unable to load shared object '/Users/kosta/Downloads/R-3.3.2/modules//lapack.so':
 dlopen(/Users/kosta/Downloads/R-3.3.2/modules//lapack.so, 6): image not found
Error in solve.default(rgb) : LAPACK routines cannot be loaded
Error: unable to load R code in package 'grDevices'

5) The compilation with native clang compiler did not work for some reason so i confifured with gcc-mp-6 as obtained from macports. This compiler cannot compile the code in grdevices, the files devQuartz.c, qdBitmap.c and qdPDF.c
had to be compiled manually with apple's gcc.

Many thanks,

More information about the R-SIG-Mac mailing list