[R-SIG-Mac] Xcode 9

peter dalgaard pdalgd at gmail.com
Fri Sep 22 10:47:05 CEST 2017


Just a quick note: Xcode 9 will not presently create a working R on Sierra or earlier.

This is because it ships with an SDK for 10.13 (unreleased) and defines an entry for utimensat(), which is not actually in the system library for earlier versions. 

There is no way we can fix this reliably for the upcoming 3.4.2 release, so if you intend to build R from sources, either 

- just do not upgrade, stay on Xcode 8.3.3 

or 

- manually remove the line from config.h saying

#define HAVE_UTIMENSAT 1


----

The slightly longer story is that Apple decided to have their include files generate a _warning_ that utimensat() is only available in 10.13, like this: 

gcc -I../../../R/src/extra  -I. -I../../src/include -I../../../R/src/include  -I/usr/local/include -I../../../R/src/nmath -DHAVE_CONFIG_H     -g -O2  -c ../../../R/src/main/platform.c -o platform.o
../../../R/src/main/platform.c:2474:5: warning: 'utimensat' is only available on
      macOS 10.13 or newer [-Wunguarded-availability-new]
    utimensat(AT_FDCWD, to, times, 0);
    ^~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/stat.h:374:5: note: 
      'utimensat' has been explicitly marked partial here
int     utimensat(int __fd, const char *__path, const struct timespec __...
        ^
../../../R/src/main/platform.c:2474:5: note: enclose 'utimensat' in a
      __builtin_available check to silence this warning
    utimensat(AT_FDCWD, to, times, 0);
    ^~~~~~~~~
../../../R/src/main/platform.c:2890:11: warning: 'utimensat' is only available
      on macOS 10.13 or newer [-Wunguarded-availability-new]
    res = utimensat(AT_FDCWD, fn, times, 0) == 0;
          ^~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/stat.h:374:5: note: 
      'utimensat' has been explicitly marked partial here
int     utimensat(int __fd, const char *__path, const struct timespec __...
        ^
../../../R/src/main/platform.c:2890:11: note: enclose 'utimensat' in a
      __builtin_available check to silence this warning
    res = utimensat(AT_FDCWD, fn, times, 0) == 0;
          ^~~~~~~~~
2 warnings generated.

Because of dynamic linking, we do not see the effect of this until we actually try running the binary:

begin installing recommended package MASS
dyld: lazy symbol binding failed: Symbol not found: _utimensat
  Referenced from: /Users/pd/r-release-branch/BUILD-dist/bin/exec/x86_64/R
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _utimensat
  Referenced from: /Users/pd/r-release-branch/BUILD-dist/bin/exec/x86_64/R
  Expected in: /usr/lib/libSystem.B.dylib

/Users/pd/r-release-branch/BUILD-dist/bin/INSTALL: line 34: 59149 Done                    echo 'tools:::.install_packages()'
     59150 Abort trap: 6           | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --slave --args ${args}


Same warning also happens during the configure checks, but as it is not an error the test program compiles and links OK (but is never run), and we get

checking whether utimensat exists and is declared... yes

Ugh!...


- Peter D.


-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-SIG-Mac mailing list