[R-SIG-Mac] Building backward compatible binary packages with OS X 10.9 and Xcode 5.0?

Reijo Sund reijo.sund at helsinki.fi
Mon Jan 20 00:43:26 CET 2014


Using the latest patched R 3.0.2 on Mac OS X Maverics (10.9.1) with Xcode 5.0.2 command line tools and clang set as a compiler, the following kind of C code somewhere in a package results in a dynamic link to symbol ___sincos_stret:

double sincos(double n) { return(sin(n)+cos(n)); }

It is obvious that ___sincos_stret is an LLVM optimization: if code calls sin(n) and then cos(n) and uses both results, the compiler will make one call to the structure-returning sincos method.

The actual problem is that such symbol is available in system library /usr/lib/system/libsystem_m.dylib only since Mavericks (10.9 SDK) and a package installed from binary (.tgz) compiled on 10.9 but run on 10.8 or older fails: Symbol not found: ___sincos_stret

One ”solution" is to make minor changes to the C code so that compiler won’t detect a need for optimization. A better solution is to use compiler flag -mmacosx-version-min=10.8. However, these solutions to a single concrete problem give only partial answers to the more general question:

How to (maximize the possibility to) create OS X 10.6+ (i.e. R 3.0.0+) compatible .tgz binary packages using a computer with OS X 10.9 and Xcode 5.0 (and without using CRAN or RForge building services)? 

Any tips would be appreciated.

Best wishes,
Reijo Sund



More information about the R-SIG-Mac mailing list