I can't install eventmachine gem on mac m1
Asked Answered
K

2

10

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?

Kerenkeresan answered 4/2, 2022 at 18:50 Comment(2)
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: github.com/eventmachine/eventmachine/issues/951)Colander
See github.com/eventmachine/eventmachine/issues/588, which relates to the rb_thread_select error.Demosthenes
F
35

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

gem install eventmachine -v '1.2.7' -- --with-ldflags="-Wl,-undefined,dynamic_lookup"
Ferrer answered 30/9, 2022 at 19:27 Comment(2)
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) Pubis
This worked for me on Monterey (12.4) trying to install under Ruby 2.7.1. I mostly run a local jekyll installation, so I haven't really tested in beyond that.Wages
K
0

what solved it for me was installing ruby like this:

$ arch -x86_64 rbenv install 2.5.5 # or using rvm
Kerenkeresan answered 5/2, 2022 at 9:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.