ruby-build: 2.4.x fails to build in macOS 10.12.6 with Xcode 9

I just upgraded to Xcode 9 and also upgraded ruby-build on macOS 10.12.6. I’m trying to install ruby 2.4.2.

Unlike #1119, there is nothing referencing tar in the log lines, and I do not have homebrew tar installed:

compiling ancdata.c
compiling raddrinfo.c
compiling ifaddr.c
linking shared-object socket.bundle
installing default socket libraries
compiling stringio.c
linking shared-object stringio.bundle
compiling strscan.c
linking shared-object strscan.bundle
compiling syslog.c
linking shared-object syslog.bundle
installing default syslog libraries
compiling zlib.c
linking shared-object zlib.bundle
linking ruby
Generating RDoc documentation
dyld: lazy symbol binding failed: Symbol not found: _utimensat
  Referenced from: /private/var/folders/kh/2szdbjbd5239z59zflvcqbf40000gn/T/ruby-build.20170920140005.43977/ruby-2.4.2/./ruby
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _utimensat
  Referenced from: /private/var/folders/kh/2szdbjbd5239z59zflvcqbf40000gn/T/ruby-build.20170920140005.43977/ruby-2.4.2/./ruby
  Expected in: /usr/lib/libSystem.B.dylib

make: *** [rdoc] Abort trap: 6

I get the same error for 2.4.0.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 15 (3 by maintainers)

Most upvoted comments

I was able to install after running the following:

$ xcode-select --install

Just ran into this problem myself. Solved with $ xcode-select --install

Thanks!

Does this patch work?

diff --git a/file.c b/file.c
index f42d4f408c..9d7487c649 100644
--- a/file.c
+++ b/file.c
@@ -81,6 +81,10 @@ int flock(int, int);
 # endif
 #endif
 
+#if defined(__builtin_available) && !__builtin_available(utimensat)
+# undef HAVE_UTIMENSAT
+#endif
+
 #ifdef HAVE_SYS_MKDEV_H
 #include <sys/mkdev.h>
 #endif

It’s a common issue affecting many others with Xcode 9: https://www.google.com/search?q=“_utimensat”+xcode9

No specific to Ruby, so perhaps we can wait on an upstream fix.