You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, trying to help a colleague out here that is not able to install eventmachine on his laptop:
current directory: /Users/colleague/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/eventmachine-1.0.9.1/ext
/Users/colleague/.rbenv/versions/3.3.5/bin/ruby extconf.rb --with-opt-dir\=/opt/homebrew/opt/openssl@1.1
checking for pkg-config for openssl... ["-I/opt/homebrew/Cellar/openssl@1.1/1.1.1w/include ", "-L/opt/homebrew/Cellar/openssl@1.1/1.1.1w/lib", "-lssl -lcrypto"]
-----
Using OpenSSL from pkg-config -I/opt/homebrew/Cellar/openssl@1.1/1.1.1w/include && -L/opt/homebrew/Cellar/openssl@1.1/1.1.1w/lib && -lssl -lcrypto
-----
checking for -lcrypto... yes
checking for -lssl... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for pipe2() in unistd.h... no
checking for accept4() in sys/socket.h... no
checking for SOCK_CLOEXEC in sys/socket.h... no
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for clock_gettime()... yes
checking for CLOCK_MONOTONIC_RAW in time.h... yes
checking for CLOCK_MONOTONIC in time.h... yes
CXXFLAGS=-fdeclspec
creating Makefile
current directory: /Users/colleague/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/eventmachine-1.0.9.1/ext
make DESTDIR\= sitearchdir\=./.gem.20241009-26955-cwtrvv sitelibdir\=./.gem.20241009-26955-cwtrvv clean
current directory: /Users/colleague/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/eventmachine-1.0.9.1/ext
make DESTDIR\= sitearchdir\=./.gem.20241009-26955-cwtrvv sitelibdir\=./.gem.20241009-26955-cwtrvv
compiling binder.cpp
make: *** [binder.o] Error 1
make failed, exit code 2
Openssl is configured correctly, but I cannot figure out what is wrong :\ This happens also with version 1.2.7
I have the same issue on my M1 mac. It says fatal error: 'iostream' file not found. So I guess a dependency is missing?
Full error output:
Resolving dependencies...
Installing eventmachine 1.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/eventmachine-1.2.7/ext
/Users/<user>/.rbenv/versions/3.1.4/bin/ruby -I /Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0 extconf.rb --with-cppflags\=-I/opt/homebrew/opt/openssl@3/include
-----
Using OpenSSL from pkg-config -I/opt/homebrew/Cellar/openssl@3/3.3.2/include && -L/opt/homebrew/Cellar/openssl@3/3.3.2/lib && -lssl -lcrypto
-----
checking for -lcrypto... yes
checking for -lssl... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for pipe2() in unistd.h... no
checking for accept4() in sys/socket.h... no
checking for SOCK_CLOEXEC in sys/socket.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for clock_gettime()... yes
checking for CLOCK_MONOTONIC_RAW in time.h... yes
checking for CLOCK_MONOTONIC in time.h... yes
CXXFLAGS=-fdeclspec
creating Makefile
current directory: /Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/eventmachine-1.2.7/ext
make DESTDIR\= sitearchdir\=./.gem.20241021-50627-5gf1q0 sitelibdir\=./.gem.20241021-50627-5gf1q0 clean
current directory: /Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/eventmachine-1.2.7/ext
make DESTDIR\= sitearchdir\=./.gem.20241021-50627-5gf1q0 sitelibdir\=./.gem.20241021-50627-5gf1q0
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:25:10: fatal error: 'iostream' file not found
25 | #include <iostream>
| ^~~~~~~~~~
1 error generated.
make: *** [binder.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/eventmachine-1.2.7 for inspection.
Results logged to /Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/extensions/arm64-darwin-23/3.1.0/eventmachine-1.2.7/gem_make.out
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0/rubygems/ext/builder.rb:102:in `run'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0/rubygems/ext/builder.rb:51:in `block in make'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0/rubygems/ext/builder.rb:43:in `each'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0/rubygems/ext/builder.rb:43:in `make'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:42:in `build'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0/rubygems/ext/builder.rb:171:in `build_extension'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0/rubygems/ext/builder.rb:205:in `block in build_extensions'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0/rubygems/ext/builder.rb:202:in `each'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0/rubygems/ext/builder.rb:202:in `build_extensions'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/3.1.0/rubygems/installer.rb:843:in `build_extensions'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/rubygems_gem_installer.rb:76:in `build_extensions'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/rubygems_gem_installer.rb:28:in `install'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/source/rubygems.rb:205:in `install'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/installer/gem_installer.rb:54:in `install'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/installer/parallel_installer.rb:132:in `do_install'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/installer/parallel_installer.rb:123:in `block in worker_pool'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/worker.rb:62:in `apply_func'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/worker.rb:57:in `block in process_queue'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/worker.rb:54:in `loop'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/worker.rb:54:in `process_queue'
/Users/<user>/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
In Gemfile:
guard-livereload was resolved to 2.5.2, which depends on
em-websocket was resolved to 0.5.3, which depends on
eventmachine
Reacted by George, yuye-aws and Juan Paulo Pérez-Tejada
I just built both EM master and 1.2.7 using Ruby master. I use OpenSSL 3.3.2, but 1.1.1 should also work.
I don't do much dev work on macOS. When I first tried to build/install EM, I also had failures. Looked at the GHA logs, and they referenced some XCode files. I don't think I've built any c++ gems that I recall, so I installed XCode, and rebuilt Ruby. EM then built/installed.
@MSP-Greg Thank you for your answer. I have just installed and started Xcode so that everything is initialized. Unfortunately still no success installing eventmachine.
After installation completes, reinstall Ruby using your version manager
Reacted by Brian Yang, nicholas a. evans, Geremia Taglialatela, David Acevedo, Samuel Louviot, Emma Sax, Eric Marchese, Emanuel, Nikita Zhevnitskiy, cc and 4 more
Reacted by Micael Paquier, Emma Sax and Anthony Avina
Reacted by Rob Vesse, Beniamin, Pantelis Vratsalis and Lucas Bleme
Perhaps someone could submit a PR that adds a check to the top of ext/extconf.rb. We ought to make sure that CONFIG["CXX"] is something sane, and abort with helpful instructions if we know it isn't. For example, something like this maybe?
caseCONFIG["CXX"]when *known_good_cxxwhen"false",nilabort<<~ERROR ****************************************************************************** **** Ruby is not configured with a working C++ compiler. **** Please install one of #{known_good_cxx.join(", ")}. **** #{os_specific_prerequisite_instructions} **** You may need to rebuild ruby after installing a C++ compiler. ****************************************************************************** ERRORelsewarn<<~WARNING % [CONFIG["CXX"],known_good_cxx.join(", ")] **** Warning: Unknown whether CONFIG["CXX"] (%s) is a compatible C++ compiler. **** If installation fails, you may need to install one of %s. WARNINGend
What do y'all think? I can make the PR. (I'm linux only, so I'll need to steal my spouse's Macbook. 😉) But I'm unsure about reasonable defs for known_good_cxx and os_specific_prerequisite_instructions. (ping: @MSP-Greg) I can just leave those out
I first ran into this issue when upgrading a project to Ruby 3.4.1. Now, after running the process discussed above, using rbenv, then eventmachine compiles again and I can run bundle install.
Activity
jlntrt commentedon Oct 21, 2024
I have the same issue on my M1 mac. It says
fatal error: 'iostream' file not found. So I guess a dependency is missing?Full error output:
MSP-Greg commentedon Oct 21, 2024
Is XCode installed?
I just built both EM master and 1.2.7 using Ruby master. I use OpenSSL 3.3.2, but 1.1.1 should also work.
I don't do much dev work on macOS. When I first tried to build/install EM, I also had failures. Looked at the GHA logs, and they referenced some XCode files. I don't think I've built any c++ gems that I recall, so I installed XCode, and rebuilt Ruby. EM then built/installed.
jlntrt commentedon Oct 22, 2024
@MSP-Greg Thank you for your answer. I have just installed and started Xcode so that everything is initialized. Unfortunately still no success installing eventmachine.
jakehlee commentedon Oct 22, 2024
First confirm that Xcode Command Line Tools are installed:
If that doesn't return a path, you should run:
Also, I see that you're using Homebrew, so make sure that Homebrew was installed with CLT linked:
If not, you may have to install CLT and reinstall Homebrew.
If none of the above is the issue, then take a look at the thread I just responded to in #990.
jlntrt commentedon Oct 22, 2024
Thank you. I switched from
rbenvtoasdf. Now it works fine.hoblin commentedon Oct 29, 2024
Same
fatal error: 'iostream' file not foundproblem on Intel Mac with RVM and asdf❯ gem install eventmachine Building native extensions. This could take a while... ERROR: Error installing eventmachine: ERROR: Failed to build gem native extension. current directory: /Users/hoblin/.rvm/gems/ruby-2.7.8/gems/eventmachine-1.2.7/ext /Users/hoblin/.rvm/rubies/ruby-2.7.8/bin/ruby -I /Users/hoblin/.rvm/rubies/ruby-2.7.8/lib/ruby/2.7.0 -r ./siteconf20241030-74511-1kyqcez.rb extconf.rb checking for -lcrypto... yes checking for -lssl... yes checking for openssl/ssl.h... yes checking for openssl/err.h... yes checking for rb_trap_immediate in ruby.h,rubysig.h... no checking for rb_thread_blocking_region()... no checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_fd_select()... yes checking for rb_fdset_t in ruby/intern.h... yes checking for rb_wait_for_single_fd()... yes checking for rb_enable_interrupt()... no checking for rb_time_new()... yes checking for inotify_init() in sys/inotify.h... no checking for __NR_inotify_init in sys/syscall.h... no checking for writev() in sys/uio.h... yes checking for pipe2() in unistd.h... no checking for accept4() in sys/socket.h... no checking for SOCK_CLOEXEC in sys/socket.h... no checking for sys/event.h... yes checking for sys/queue.h... yes checking for clock_gettime()... yes checking for CLOCK_MONOTONIC_RAW in time.h... yes checking for CLOCK_MONOTONIC in time.h... yes CXXFLAGS=-g -O2 -Wall -Wextra -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-unused-result -Wno-address creating Makefile current directory: /Users/hoblin/.rvm/gems/ruby-2.7.8/gems/eventmachine-1.2.7/ext make "DESTDIR=" clean current directory: /Users/hoblin/.rvm/gems/ruby-2.7.8/gems/eventmachine-1.2.7/ext make "DESTDIR=" compiling binder.cpp In file included from binder.cpp:20: ./project.h:25:10: fatal error: 'iostream' file not found 25 | #include <iostream> | ^~~~~~~~~~ 1 error generated. make: *** [binder.o] Error 1 make failed, exit code 2 Gem files will remain installed in /Users/hoblin/.rvm/gems/ruby-2.7.8/gems/eventmachine-1.2.7 for inspection. Results logged to /Users/hoblin/.rvm/gems/ruby-2.7.8/extensions/x86_64-darwin-24/2.7.0/eventmachine-1.2.7/gem_make.outTried with Ruby 2.7, 3.0, and 3.2.
xinghengwang commentedon Nov 15, 2024
I remememd you guys see this: #1009
hoblin commentedon Nov 16, 2024
I found out what the problem was in my case.
After upgrading to the macOS Sequoia 15.1 newly installed Ruby was getting CXX=false.
If it shows
falseinstead ofclang++, you need to reinstall Command Line Tools:nevans commentedon Nov 22, 2024
Perhaps someone could submit a PR that adds a check to the top of
ext/extconf.rb. We ought to make sure thatCONFIG["CXX"]is something sane, and abort with helpful instructions if we know it isn't. For example, something like this maybe?What do y'all think? I can make the PR. (I'm linux only, so I'll need to steal my spouse's Macbook. 😉) But I'm unsure about reasonable defs for
known_good_cxxandos_specific_prerequisite_instructions. (ping: @MSP-Greg) I can just leave those outtagliala commentedon Dec 11, 2024
Thanks @hoblin, this helped me too on macOS Sequoia 15.1 and M1 Pro
Before
After
And now eventmachine compiles (again)
georgeu2000 commentedon Jan 20, 2025
@hoblin - This worked for me on M1 Max running Sequoia 15.1.1 and using rbenv. Thank you.
Don't forget to reinstall Ruby using your version manager
Then I got
emmahsax commentedon Feb 13, 2025
I first ran into this issue when upgrading a project to Ruby 3.4.1. Now, after running the process discussed above, using
rbenv, then eventmachine compiles again and I can runbundle install.aavina commentedon Feb 19, 2025
Ditto here. I had Ruby 3.4.1 installed and I ran into the compilation issue after a MacOS upgrade. Following instructions did the trick. Thank you!
gwholland3 commentedon Mar 29, 2026
Here to say that in 2026, #1010 (comment) fixed the issue for me!