Unable to load the EventMachine C extension, ruby 2.7.4, Mac OS 12.0.1 x86 · Issue #960 · eventmachine/eventmachine · GitHub
Skip to content

Unable to load the EventMachine C extension, ruby 2.7.4, Mac OS 12.0.1 x86 #960

Open

Description

@zololucky

Hello, This is what I get when I run the rails s command:

Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
Traceback (most recent call last):
	35: from bin/rails:3:in `<main>'
	34: from bin/rails:3:in `load'
	33: from /Users/zolo.y/GitHub/Microsites/site_generator/bin/spring:15:in `<top (required)>'
	32: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	31: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	30: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
	29: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
	28: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
	27: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
	26: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
	25: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
	24: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
	23: from /Users/zolo.y/GitHub/Microsites/site_generator/bin/rails:9:in `<top (required)>'
	22: from /Users/zolo.y/GitHub/Microsites/site_generator/bin/rails:9:in `require'
	21: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/commands.rb:16:in `<top (required)>'
	20: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/command.rb:44:in `invoke'
	19: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/command/base.rb:63:in `perform'
	18: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
	17: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
	16: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
	15: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `perform'
	14: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `tap'
	13: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:133:in `block in perform'
	12: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:133:in `require'
	11: from /Users/zolo.y/GitHub/Microsites/site_generator/config/application.rb:7:in `<top (required)>'
	10: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler.rb:174:in `require'
	 9: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:58:in `require'
	 8: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:58:in `each'
	 7: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:69:in `block in require'
	 6: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:69:in `each'
	 5: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:74:in `block (2 levels) in require'
	 4: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:74:in `require'
	 3: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/thin-1.8.1/lib/thin.rb:7:in `<top (required)>'
	 2: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/thin-1.8.1/lib/thin.rb:7:in `require'
	 1: from /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:8:in `<top (required)>'
/Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:8:in `require': dlopen(/Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/rubyeventmachine.bundle, 0x0009): symbol not found in flat namespace '_ERR_load_crypto_strings' - /Users/zolo.y/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/rubyeventmachine.bundle (LoadError)
  • ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-darwin21]
  • Rails 5.1.7
  • eventmachine-1.2.7

Thank you.

Activity

  1. sheuer commented on Dec 30, 2021

    @sheuer

    I'm also running into this issue on an M1 Mac running Mac OS 12.1 trying to run a sinatra app /w rainbows.

    • ruby 2.5.1p57 (2018-03-29 revision 63029) [-darwin21]
    • eventmachine-1.2.7
    Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
    Traceback (most recent call last):
    	22: from /Users/<>/.rvm/gems/ruby-2.5.1@push/bin/ruby_executable_hooks:22:in `<main>'
    	21: from /Users/<>/.rvm/gems/ruby-2.5.1@push/bin/ruby_executable_hooks:22:in `eval'
    	20: from /Users/<>/.rvm/gems/ruby-2.5.1@push/bin/rainbows:23:in `<main>'
    	19: from /Users/<>/.rvm/gems/ruby-2.5.1@push/bin/rainbows:23:in `load'
    	18: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/rainbows-5.2.1/bin/rainbows:127:in `<top (required)>'
    	17: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/rainbows-5.2.1/bin/rainbows:127:in `new'
    	16: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/rainbows-5.2.1/lib/rainbows/http_server.rb:20:in `initialize'
    	15: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/unicorn-5.8.0/lib/unicorn/http_server.rb:79:in `initialize'
    	14: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/unicorn-5.8.0/lib/unicorn/http_server.rb:79:in `new'
    	13: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/unicorn-5.8.0/lib/unicorn/configurator.rb:78:in `initialize'
    	12: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/unicorn-5.8.0/lib/unicorn/configurator.rb:85:in `reload'
    	11: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/unicorn-5.8.0/lib/unicorn/configurator.rb:85:in `instance_eval'
    	10: from rainbows.rb:1:in `reload'
    	9: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/rainbows-5.2.1/lib/rainbows/configurator.rb:48:in `Rainbows!'
    	8: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/rainbows-5.2.1/lib/rainbows/configurator.rb:48:in `instance_eval'
    	7: from rainbows.rb:2:in `block in reload'
    	6: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/rainbows-5.2.1/lib/rainbows/configurator.rb:85:in `use'
    	5: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/rainbows-5.2.1/lib/rainbows/configurator.rb:85:in `const_get'
    	4: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/rainbows-5.2.1/lib/rainbows/configurator.rb:85:in `require'
    	3: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/rainbows-5.2.1/lib/rainbows/event_machine.rb:2:in `<top (required)>'
    	2: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/rainbows-5.2.1/lib/rainbows/event_machine.rb:2:in `require'
    	1: from /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/eventmachine-1.2.7/lib/eventmachine.rb:8:in `<top (required)>'
    /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/eventmachine-1.2.7/lib/eventmachine.rb:8:in `require': dlopen(/Users/<>/.rvm/gems/ruby-2.5.1@push/gems/eventmachine-1.2.7/lib/rubyeventmachine.bundle, 0x0009): symbol not found in flat namespace '_ERR_load_crypto_strings' - /Users/<>/.rvm/gems/ruby-2.5.1@push/gems/eventmachine-1.2.7/lib/rubyeventmachine.bundle (LoadError)
    
  2. themudassarhassan commented on Jan 1, 2022

    @themudassarhassan

    facing the same issue on mac m1. Any solution?

  3. Dovizu commented on Jan 9, 2022

    @Dovizu

    Likewise

    Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
                        ------------------------------------------------
          Jekyll 4.2.1   Please append `--trace` to the `serve` command 
                         for any additional information or backtrace. 
                        ------------------------------------------------
    /Users/Donny/.rvm/gems/ruby-3.1.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:8:in `require': dlopen(/Users/Donny/.rvm/gems/ruby-3.1.0/gems/eventmachine-1.2.7/lib/rubyeventmachine.bundle, 0x0009): symbol not found in flat namespace '_SSL_get1_peer_certificate' - /Users/Donny/.rvm/gems/ruby-3.1.0/gems/eventmachine-1.2.7/lib/rubyeventmachine.bundle (LoadError)
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:8:in `<top (required)>'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/em-websocket-0.5.3/lib/em-websocket.rb:3:in `require'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/em-websocket-0.5.3/lib/em-websocket.rb:3:in `<top (required)>'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve/live_reload_reactor.rb:3:in `require'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve/live_reload_reactor.rb:3:in `<top (required)>'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:143:in `require_relative'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:143:in `register_reload_hooks'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:98:in `process'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `each'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/gems/jekyll-4.2.1/exe/jekyll:15:in `<top (required)>'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `load'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `<main>'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `eval'
    	from /Users/Donny/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `<main>'
    
  4. adampal commented on Jan 14, 2022

    @adampal

    I was able to get it working by doing:

    gem uninstall eventmachine
    

    Then adding this to my gem file:

    gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git', :branch => 'master'
    

    I'm guessing there's some updates currently in the master branch that have not been released as an update to the gem.

  5. sshock commented on Mar 3, 2022

    @sshock

    If there have been important fixes, why has there been no new releases in almost 4 years?

  6. sshock commented on Mar 4, 2022

    @sshock

    In my case I ended up here because I built eventmachine using the openssl at $(brew --prefix openssl), which happens to be /opt/homebrew/opt/openssl@3.

    I redid it using openssl@1.1 and now I'm not running into this error anymore:

    gem uninstall eventmachine
    bundle config build.eventmachine --with-openssl-dir=$(brew --prefix openssl@1.1)
    bundle
    
  7. adampal commented on Mar 8, 2022

    @adampal

    If there have been important fixes, why has there been no new releases in almost 4 years?

    @sshock good question.

    Are @sodabrew @olleolleolle or any of the other recent contributors able to shed any light on the situation here? There have been a lot of commits to the main branch but no gem release since 2018.

  8. RoskiDeluge commented on May 13, 2022

    @RoskiDeluge

    I'm having this issue and uninstalling/installing has not worked, neither did sshock solution above. I'm on a 2021 Mac M1 machine:
    Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'

    dlopen(/Users/katana/MIJE/sandbox-mije-jekyll/vendor/bundle/ruby/3.1.0/bundler/gems/eventmachine-9cb13a8a6236/lib/rubyeventmachine.bundle, 0x0009): symbol not found in flat namespace '_SSL_get1_peer_certificate'

    Ruby: ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [arm64-darwin21]


    UPDATE: I was able to fix this by simply getting everything up-to-date:
    gem update --system

    Then ensured that I have openssl@3 and ruby-3.1.1 on the Mac and, finally, eventmachine 1.2.7 in my project's Gemfile.
    Then bundle update and bundle exec jekyll serve

  9. TorvaldsDB commented on Nov 30, 2022

    @TorvaldsDB

    In my case I ended up here because I built eventmachine using the openssl at $(brew --prefix openssl), which happens to be /opt/homebrew/opt/openssl@3.

    I redid it using openssl@1.1 and now I'm not running into this error anymore:

    gem uninstall eventmachine
    bundle config build.eventmachine --with-openssl-dir=$(brew --prefix openssl@1.1)
    bundle
    

    this does not work for me.

    I fix it by

    gem install eventmachine -v '1.2.7' -- --with-ldflags="-Wl,-undefined,dynamic_lookup"
  10. cesarcoatl commented on Dec 20, 2022

    @cesarcoatl

    @TorvaldsDB's suggestion worked for me.

    I fix it by

    gem install eventmachine -v '1.2.7' -- --with-ldflags="-Wl,-undefined,dynamic_lookup"

    Cheers!

  11. nywton commented on Dec 30, 2022

    @nywton

    In my case I ended up here because I built eventmachine using the openssl at $(brew --prefix openssl), which happens to be /opt/homebrew/opt/openssl@3.
    I redid it using openssl@1.1 and now I'm not running into this error anymore:

    gem uninstall eventmachine
    bundle config build.eventmachine --with-openssl-dir=$(brew --prefix openssl@1.1)
    bundle
    

    this does not work for me.

    I fix it by

    gem install eventmachine -v '1.2.7' -- --with-ldflags="-Wl,-undefined,dynamic_lookup"

    Thanks! It worked for me

  12. added a commit that references this issue on Jan 16, 2023
  13. shushugah commented on Mar 20, 2023

    @shushugah

    This worked for me, thank you!

  14. roryabraham commented on Aug 19, 2023

    @roryabraham

    For me I had to do:

    bundle config build.eventmachine --with-ldflags="-Wl,-undefined,dynamic_lookup"
    bundle install
  15. dimitrovv commented on Aug 25, 2023

    @dimitrovv

    Then adding this to my gem file:

    gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git', :branch => 'master'

    This is the only fix that worked for me, tried everything else above with no luck. So, the below is fine but a new version has to be released here of the 💎 , the last one is 1.2.7 since 2018:

    gem 'eventmachine', '= 1.3.0.dev.1', github: 'eventmachine', branch: 'master'
    
    ...
    
    git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
  16. faizantroon commented on Sep 1, 2023

    @faizantroon

    Thanks, Thats work for me as well despite all other options

  17. hoangtaiki commented on Nov 2, 2023

    @hoangtaiki

    I was able to get it working by doing:

    bundle config build.eventmachine --with-pkg-config=$(brew --prefix openssl@1.1)/lib/pkgconfig
    bundle install --redownload
    
  18. MSP-Greg commented on Nov 2, 2023

    @MSP-Greg
    Contributor

    I'm not that familiar with either EventMachine or macOS.

    But, for those who've needed to set either --with-openssl-dir or --with-pkg-config, does the output of the following contain an OpenSSL directory? If so, EM might be able to be patched to fix the need for either of the arguments.

    ruby -e "puts RbConfig::CONFIG['configure_args']"
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions