1

OSX 10.12.6 / Xcode 9.2

For some reason the make process is stalling indefinitely when I try to install a new Ruby version or really do anything that involves native extensions in Ruby.

At first I noticed that this was happening when I tried to run bundle install in a Rails app that uses nokogiri. Updating nokogiri and handling the native extensions hung indefinitely.

Then I tried uninstalling-reinstalling Ruby (using rbenv), then re-bundling, and I found that I couldn't even install Ruby with rbenv (same hanging symptom).

So I thought maybe there was a problem with rbenv, but it's also happening when I try to install a new Ruby version from source.

These are the commands I'm running:

$ wget https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.2.tar.bz2
$ tar -xjvf ruby-2.4.2.tar.bz2
$ cd ruby-2.4.2
$ ./configure --prefix=~/.rubies/ruby-2.4.2
$ make

The output from make:

➜  ruby-2.4.2 make 

Makefile:3225: warning: overriding commands for target 'ruby'

Makefile:227: warning: ignoring old commands for target 'ruby'

    CC = clang
    LD = ld
    LDSHARED = clang -dynamic -bundle
    CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens   -pipe
    XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
    CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -I. -I.ext/include/x86_64-darwin16 -I./include -I. -I./enc/unicode/9.0.0
    DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -fstack-protector -Wl,-u,_objc_msgSend -Wl,-pie -framework CoreFoundation
    SOLIBS =
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Then the process just hangs. If I get the process using ps and inspect its process tree using pstree and top I get this:

    ➜  ~ ps aux | grep make
    me         8999   0.0  0.0  2451364   1456 s001  S+    2:01PM   0:00.02 /Applications/Xcode.app/Contents/Developer/usr/bin/make

➜  ~ pstree -p 8999

    -+= 00001 root /sbin/launchd
     \-+= 01078 me /Applications/iTerm.app/Contents/MacOS/iTerm2
       \-+= 01087 me /Applications/iTerm.app/Contents/MacOS/iTerm2 --server login -fp me
         \-+= 01088 root login -fp  me
           \-+= 01090 me -zsh
             \-+= 08999 me /Applications/Xcode.app/Contents/Developer/usr/bin/make
               \--- 09012 me echo translating probes probes.d

➜  ~ top -pid 09012

PID   COMMAND      %CPU TIME     #TH  #WQ  #POR MEM   PURG CMPR PGRP PPID STATE    BOOSTS     %CPU_ME %CPU_OTHRS UID  FAUL COW
9012  echo         0.0  00:00.00 5    0    17   496K  0B   0B   8999 8999 sleeping *0[1]      0.00000 0.00000    503  353  13

As you can see, it says the process is "sleeping" and has no CPU usage.

I found somewhere online that I can use dtruss on OS X as a wrapper to dtrace to get behavior similar to strace, so I tried running make and then tracing it in another window:

➜  ~ pstree -p 15632
-+= 00001 root /sbin/launchd
 \-+= 01078 me /Applications/iTerm.app/Contents/MacOS/iTerm2
   \-+= 01087 me /Applications/iTerm.app/Contents/MacOS/iTerm2 --server login -fp me
     \-+= 01088 root login -fp me
       \-+= 01090 me -zsh
         \-+= 15632 me /Applications/Xcode.app/Contents/Developer/usr/bin/make
           \--- 15645 me echo translating probes probes.d

➜  ~ sudo dtruss -fp 15645
dtrace: system integrity protection is on, some features will not be available

    PID/THRD  SYSCALL(args)          = return
15645/0xe4d2:  madvise(0xC42008C000, 0x74000, 0x5)       = 0 0
15645/0xe4d2:  select(0x0, 0x0, 0x0, 0x0, 0xC420041F18)      = 0 0
15645/0xe4d2:  select(0x0, 0x0, 0x0, 0x0, 0xC420041F18)      = 0 0
15645/0xe4d2:  select(0x0, 0x0, 0x0, 0x0, 0xC420041F18)      = 0 0

Those "select" lines appear once every minute or so, but that's all I'm getting.

I'm totally stumped about what I might be able to try next. Any suggestions??

sixty4bit
  • 7,422
  • 7
  • 33
  • 57
  • Did you update Xcode recently? – 7stud Jan 31 '18 at 20:09
  • I did update it yesterday but only after these issues began - in hopes that it might help somehow. I did the TOS agreement etc. – sixty4bit Jan 31 '18 at 20:10
  • My rule is: never upgrade Xcode unless you are forced to. For the source install, are you following the steps in the README/INSTALL file? What about updating rbenv? When's the last time you used rbenv to install a ruby? Did you update your OS recently? – 7stud Jan 31 '18 at 20:14
  • Can't remember when I last installed a ruby but I had installed 2.5.0 with it so probably December at the latest. Don't think I updated my OS recently - it was 10.12.6 which was released ~6 months ago but I can't remember when I updated to it. As for README/INSTALL, no I am just following the steps I got from the "chruby" README (tried chruby also, after removing rbenv thoroughly, because it's more minimal than rbenv). Where is that exactly? I don't see it in the unarchived ruby-2.4.2 directory – sixty4bit Jan 31 '18 at 21:07
  • Is there a docs directory? Usually the README and INSTALL files are in the top level directory. I've never seen it any other way, and I almost always install from source on OSX. – 7stud Jan 31 '18 at 22:06
  • I will check just to be sure. On the advice of a friend, though, I tried uninstalling XCode and Homebrew, then reinstalling just Homebrew (which includes Xcode command line tools), and that got me moving again – sixty4bit Jan 31 '18 at 22:17
  • I just downloaded `ruby 2.4.3.tar.gz` from the ruby website, and I untared it and the README.md fle is at the top level. I suggest you do `$ ls READ*` and see what the output is. – 7stud Jan 31 '18 at 22:18
  • I've got homebrew installed and I use Xcode 9.2 for iOS programming, and I have had no problems on High Sierra (10.13.2). I would be jettisoning homebrew first. I prefer installing most things from source, but if it requires more than 3 dependency installs, then lately I've been resorting to homebrew. But I've had more problems installing things with homebrew than installing from source. I use `rvm` for managing ruby versions. – 7stud Jan 31 '18 at 22:26
  • Any way to get a stack trace of the `make` process that's hanging on that `select()`? Or look at the open file descriptors? Maybe that would allow you to find out just what the make process is waiting for. – Andrew Henle Feb 02 '18 at 11:39

0 Answers0