bear-metal / tunemygc

TuneMyGC - optimal MRI Ruby 2.1+ Garbage Collection
https://www.tunemygc.com
346 stars 25 forks source link

Cannot build native extensions under macOS 10.12/Ruby 2.3.1. #38

Closed phyllisstein closed 7 years ago

phyllisstein commented 7 years ago

Hey there! I'm running into an issue with trying to integrate TuneMyGC into my Rails app. When I try to install the gem, Bundler throws an error building the native extensions:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/rvm/gems/ruby-2.3.1@volmar/gems/tunemygc-1.0.68/ext/tunemygc
/usr/local/rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160923-17327-1eybjzv.rb extconf.rb
checking for RUBY_INTERNAL_EVENT_GC_END_SWEEP... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/usr/local/rvm/gems/ruby-2.3.1@volmar/extensions/x86_64-darwin-16/2.3.0/tunemygc-1.0.68/mkmf.log

current directory: /usr/local/rvm/gems/ruby-2.3.1@volmar/gems/tunemygc-1.0.68/ext/tunemygc
make "DESTDIR=" clean

current directory: /usr/local/rvm/gems/ruby-2.3.1@volmar/gems/tunemygc-1.0.68/ext/tunemygc
make "DESTDIR="
compiling getRSS.c
compiling tunemygc_ext.c
tunemygc_ext.c:21:7: warning: implicit declaration of function 'clock_gettime' is invalid in C99
[-Wimplicit-function-declaration]
  if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
      ^
tunemygc_ext.c:21:21: error: use of undeclared identifier 'CLOCK_REALTIME'
  if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
                    ^
1 warning and 1 error generated.
make: *** [tunemygc_ext.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.1@volmar/gems/tunemygc-1.0.68
for inspection.
Results logged to
/usr/local/rvm/gems/ruby-2.3.1@volmar/extensions/x86_64-darwin-16/2.3.0/tunemygc-1.0.68/gem_make.out

I'm not altogether sure what to make of this myself, but I'd be happy to provide any further debugging information, if it'd be useful, and super-grateful for any advice you have. Thanks in advance for your help!

methodmissing commented 7 years ago

@phyllisstein I'll bump my env. to OS X Sierra this evening and try to repro - thx for flagging :-)

tarmo commented 7 years ago

Hey @phyllisstein are you using the latest (8.0.0) Xcode or could you upgrade to it to confirm this issue still exists? (Sierra + Xcode 8.0.0 seems to work for me)

phyllisstein commented 7 years ago

I was definitely on a beta of Sierra at the time and it's possible that I was using an old Xcode! At any rate, you're right, it's working fine now. Thanks for the tip, and hooray!