jhawthorn / vernier

📏 next generation CRuby profiler
https://vernier.prof/
MIT License
798 stars 17 forks source link

Compilation failure in ruby 3.3.5 #96

Open CKolkey opened 1 day ago

CKolkey commented 1 day ago

Hi! My team updated to ruby 3.3.5 recently and I encountered this issue when adding vernier to the Gemfile:

Installing vernier 1.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vernier-1.2.1/ext/vernier
/Users/cameron/.local/share/mise/installs/ruby/3.3.5/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_internal_thread_event_data_t.thread in ruby/thread.h... yes
checking for rb_profile_thread_frames() in ruby/debug.h... yes
checking for pthread_setname_np()... yes
creating Makefile

current directory: /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vernier-1.2.1/ext/vernier
make DESTDIR\= sitearchdir\=./.gem.20240919-62961-eun7f3 sitelibdir\=./.gem.20240919-62961-eun7f3 clean

current directory: /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vernier-1.2.1/ext/vernier
make DESTDIR\= sitearchdir\=./.gem.20240919-62961-eun7f3 sitelibdir\=./.gem.20240919-62961-eun7f3
compiling vernier.cc
vernier.cc:3:10: fatal error: 'iostream' file not found
    3 | #include <iostream>
      |          ^~~~~~~~~~
1 error generated.
make: *** [vernier.o] Error 1

make failed, exit code 2

I uninstalled the ruby and reinstalled it, which produces a slightly different failure:

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

    current directory: /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vernier-1.2.1/ext/vernier
/Users/cameron/.local/share/mise/installs/ruby/3.3.5/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_internal_thread_event_data_t.thread in ruby/thread.h... yes
checking for rb_profile_thread_frames() in ruby/debug.h... yes
checking for pthread_setname_np()... yes
creating Makefile

current directory: /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vernier-1.2.1/ext/vernier
make DESTDIR\= sitearchdir\=./.gem.20240919-38586-5ia38x sitelibdir\=./.gem.20240919-38586-5ia38x clean

current directory: /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vernier-1.2.1/ext/vernier
make DESTDIR\= sitearchdir\=./.gem.20240919-38586-5ia38x sitelibdir\=./.gem.20240919-38586-5ia38x
compiling vernier.cc
make: *** [vernier.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vernier-1.2.1 for inspection.
Results logged to /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/extensions/arm64-darwin-24/3.3.0/vernier-1.2.1/gem_make.out

  /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/rubygems/ext/builder.rb:125:in `run'
  /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/rubygems/ext/builder.rb:51:in `block in make'
  /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/rubygems/ext/builder.rb:43:in `each'
  /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/rubygems/ext/builder.rb:43:in `make'
  /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/rubygems/ext/ext_conf_builder.rb:42:in `build'
  /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/rubygems/ext/builder.rb:193:in `build_extension'
  /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/rubygems/ext/builder.rb:227:in `block in build_extensions'
  /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `each'
  /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `build_extensions'
  /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/rubygems/installer.rb:853:in `build_extensions'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/rubygems_gem_installer.rb:109:in `build_extensions'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/source/rubygems.rb:205:in `install'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/installer/gem_installer.rb:54:in `install'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/installer/parallel_installer.rb:132:in `do_install'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/installer/parallel_installer.rb:123:in `block in worker_pool'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/worker.rb:62:in `apply_func'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/worker.rb:57:in `block in process_queue'
  <internal:kernel>:187:in `loop'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/worker.rb:54:in `process_queue'
  /Users/cameron/.gem/ruby/3.3.0/gems/bundler-2.5.18/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing vernier (1.2.1), and Bundler cannot continue.

Platform is Macos 15.0, on an ARM processor (m2). Ruby is installed via mise. Ruby version is 3.3.5 Vernier version is 1.2.1 (latest at the time of this post).

Let me know if I can provide any other details to help figure out whats going on :)

Thanks!

casperisfine commented 1 day ago

Could you share the content of gem_make.out? That's where the actual error might be located.

CKolkey commented 1 day ago

Sadly not - I didn't include that originally because it's the same as whats printed above:

> cat /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/extensions/arm64-darwin-24/3.3.0/vernier-1.2.1/gem_make.out      

current directory: /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vernier-1.2.1/ext/vernier
/Users/cameron/.local/share/mise/installs/ruby/3.3.5/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_internal_thread_event_data_t.thread in ruby/thread.h... yes
checking for rb_profile_thread_frames() in ruby/debug.h... yes
checking for pthread_setname_np()... yes
creating Makefile

current directory: /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vernier-1.2.1/ext/vernier
make DESTDIR\= sitearchdir\=./.gem.20240919-66968-unlaz9 sitelibdir\=./.gem.20240919-66968-unlaz9 clean

current directory: /Users/cameron/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vernier-1.2.1/ext/vernier
make DESTDIR\= sitearchdir\=./.gem.20240919-66968-unlaz9 sitelibdir\=./.gem.20240919-66968-unlaz9
compiling vernier.cc
make: *** [vernier.o] Error 1

make failed, exit code 2
casperisfine commented 1 day ago

Uh, weird.

And if you clone the repo and try to compile from there? Still no explicit error?

CKolkey commented 1 day ago

Cloning vernier locally, on main branch, ruby 3.3.5

> rake compile                                                                                                                                                                                                                                                                                                                 
mkdir -p tmp/arm64-darwin24/vernier/3.3.5
cd tmp/arm64-darwin24/vernier/3.3.5
/Users/cameron/.local/share/mise/installs/ruby/3.3.5/bin/ruby -I. ../../../../ext/vernier/extconf.rb
checking for ruby/thread.h... yes
checking for rb_internal_thread_event_data_t.thread in ruby/thread.h... yes
checking for rb_profile_thread_frames() in ruby/debug.h... yes
checking for pthread_setname_np()... yes
creating Makefile
cd -
cd tmp/arm64-darwin24/vernier/3.3.5
/opt/homebrew/bin/gmake
compiling ../../../../ext/vernier/vernier.cc
gmake: *** [Makefile:216: vernier.o] Error 1
rake aborted!
Command failed with status (2): [/opt/homebrew/bin/gmake]

Tasks: TOP => compile => compile:arm64-darwin24 => compile:vernier:arm64-darwin24 => copy:vernier:arm64-darwin24:3.3.5 => tmp/arm64-darwin24/vernier/3.3.5/vernier.bundle
(See full trace by running task with --trace)

and

> rake compile:vernier                                                                                                                                                                                                                                                                                                         
cd tmp/arm64-darwin24/vernier/3.3.5
/opt/homebrew/bin/gmake
compiling ../../../../ext/vernier/vernier.cc
gmake: *** [Makefile:216: vernier.o] Error 1
rake aborted!
Command failed with status (2): [/opt/homebrew/bin/gmake]

Tasks: TOP => compile:vernier => compile:vernier:arm64-darwin24 => copy:vernier:arm64-darwin24:3.3.5 => tmp/arm64-darwin24/vernier/3.3.5/vernier.bundle
(See full trace by running task with --trace)
CKolkey commented 1 day ago

Interestingly, when trying that with ruby 3.3.4, it produces the iostream error:

> rake compile:vernier                                                                                                                                                                                                                                                                                                                                              v3.3.4
mkdir -p tmp/arm64-darwin23/vernier/3.3.4
cd tmp/arm64-darwin23/vernier/3.3.4
/Users/cameron/.local/share/mise/installs/ruby/3.3.4/bin/ruby -I. ../../../../ext/vernier/extconf.rb
checking for ruby/thread.h... yes
checking for rb_internal_thread_event_data_t.thread in ruby/thread.h... yes
checking for rb_profile_thread_frames() in ruby/debug.h... yes
checking for pthread_setname_np()... yes
creating Makefile
cd -
cd tmp/arm64-darwin23/vernier/3.3.4
/opt/homebrew/bin/gmake
compiling ../../../../ext/vernier/vernier.cc
../../../../ext/vernier/vernier.cc:3:10: fatal error: 'iostream' file not found
    3 | #include <iostream>
      |          ^~~~~~~~~~
1 error generated.
gmake: *** [Makefile:216: vernier.o] Error 1
rake aborted!
Command failed with status (2): [/opt/homebrew/bin/gmake]

Tasks: TOP => compile:vernier => compile:vernier:arm64-darwin23 => copy:vernier:arm64-darwin23:3.3.4 => tmp/arm64-darwin23/vernier/3.3.4/vernier.bundle
(See full trace by running task with --trace)

However, I was using vernier just fine on this computer a few days ago with 3.3.4. That was with the previous macos, but vernier failed to compile for 3.3.5 with that OS as well.

jhawthorn commented 8 minutes ago

I don't think this is related to Ruby 3.3.5, seems more likely this is related to either Sequoia or the xcode command line tools.