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??