9

I got a new m1 mac and I can't install eventmachine gem, full log below.

I tried these solutions:

same error.

some info:

   $ sw_vers
ProductName:    macOS
ProductVersion: 12.2
BuildVersion:   21D49

   $ bundle --version
Bundler version 2.1.4

and the error:

   $ gem install eventmachine -v '1.2.7'                                                    
em.cpp:706:13: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'?
        if ((ret = rb_thread_select(kqfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
                   ^~~~~~~~~~~~~~~~
                   rb_thread_fd_select

Full output: https://gist.github.com/goldylucks/8369ea09af4f3f70d707809f4bb700df

any ideas how to solve this?

vgoff
  • 10,980
  • 3
  • 38
  • 56
Shining Love Star
  • 5,734
  • 5
  • 39
  • 49
  • FWIW, I was just able to install it just fine on my M1. Have you tried running the same command on a different version of Ruby? 2.5 should be supported, but I wonder if there is some other conflict such as your OpenSSL version (see: https://github.com/eventmachine/eventmachine/issues/951) – Trinculo Feb 04 '22 at 20:24
  • See https://github.com/eventmachine/eventmachine/issues/588, which relates to the `rb_thread_select` error. – Jared Beck Feb 04 '22 at 21:04

2 Answers2

31

I solved this (thanks to this tweet) with the following:

gem install eventmachine -v '1.2.7' -- --with-ldflags="-Wl,-undefined,dynamic_lookup"
coderberry
  • 3,040
  • 3
  • 26
  • 28
  • This appeared to fix my install (finally) but running a `bundle exec middleman build` caused `Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby' /Users/me/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/prettyprint.rb:182:in 'text': can't convert Middleman::CoreExtensions::Collections::LazyCollectorStep to String (Middleman::CoreExtensions::Collections::LazyCollectorStep#to_str gives Middleman::CoreExtensions::Collections::LazyCollectorStep) (TypeError) ` – volvox Mar 13 '23 at 16:08
0

what solved it for me was installing ruby like this:

$ arch -x86_64 rbenv install 2.5.5 # or using rvm
Shining Love Star
  • 5,734
  • 5
  • 39
  • 49