Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eventmachine v1.0.7 build fails on Mac OS/X with IRB Ruby 2.2.1: rb_thread_select undeclared #588

Closed
jez-w opened this issue Mar 25, 2015 · 21 comments

Comments

@jez-w
Copy link

jez-w commented Mar 25, 2015

'gem install eventmachine' produces the following errors on Mac OS/X Yosemite 10.10.2, Ruby 2.2.1. This appears to be a similar issue as that for the move to Ruby 2.2 corrected by eventmachine v1.0.4

$: uname -v
Darwin Kernel Version 14.1.0: Thu Feb 26 19:26:47 PST 2015; root:xnu-2782.10.73~1/RELEASE_X86_64
$: ruby --version
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]

$: bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Installing daemons 1.2.2

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

    /usr/local/bin/ruby -r ./siteconf20150325-2708-t5u8ua.rb extconf.rb 
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... no
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()... no
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... no
checking for rb_enable_interrupt()... no
checking for rb_time_new()... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for clock_gettime()... no
checking for gethrtime()... no
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling binder.cpp
compiling cmain.cpp
compiling ed.cpp
compiling em.cpp
em.cpp:686: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
/usr/local/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
    ^
em.cpp:686:40: error: cannot initialize a parameter of type 'rb_fdset_t *' with an rvalue of type 'fd_set *'
        if ((ret = rb_thread_select(kqfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
                                              ^~~~~~~~
/usr/local/include/ruby-2.2.0/ruby/intern.h:454:42: note: passing argument to parameter here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
                                         ^
em.cpp:915:9: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'?
        return EmSelect (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv);
               ^~~~~~~~
               rb_thread_fd_select
./em.h:29:22: note: expanded from macro 'EmSelect'
    #define EmSelect rb_thread_select
                     ^
/usr/local/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
    ^
em.cpp:1039:6: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'?
                                        EmSelect (0, NULL, NULL, NULL, &tv);
                                        ^~~~~~~~
                                        rb_thread_fd_select
./em.h:29:22: note: expanded from macro 'EmSelect'
    #define EmSelect rb_thread_select
                     ^
/usr/local/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
    ^
4 errors generated.
Makefile:229: recipe for target 'em.o' failed
make: *** [em.o] Error 1

@jez-w
Copy link
Author

jez-w commented Mar 27, 2015

I notice that ext/extconf.rb doesn't find rb_wait_for_single_fd(), but this is declared in ruby/io.h

$ grep wait_for_single /usr/local/include/ruby-2.2.0/ruby/io.h
int rb_wait_for_single_fd(int fd, int events, struct timeval *tv);
$

@jez-w jez-w closed this as completed Mar 27, 2015
@jez-w jez-w reopened this Mar 27, 2015
@jez-w
Copy link
Author

jez-w commented Mar 27, 2015

Sorry - clicked on the wrong button

@tmm1
Copy link
Contributor

tmm1 commented Mar 27, 2015

Weird, I wonder if the function header moved in 2.2.1?

Can you try this?

diff --git a/ext/extconf.rb b/ext/extconf.rb
index c21cdf1..953cb6e 100644
--- a/ext/extconf.rb
+++ b/ext/extconf.rb
@@ -77,7 +77,7 @@ add_define 'HAVE_WRITEV' if have_func('writev', 'sys/uio.h')
 add_define 'HAVE_RB_THREAD_FD_SELECT' if have_func('rb_thread_fd_select')
 add_define 'HAVE_RB_FDSET_T' if have_type('rb_fdset_t', 'ruby/intern.h')

-have_func('rb_wait_for_single_fd')
+have_func('rb_wait_for_single_fd', 'ruby/io.h')
 have_func('rb_enable_interrupt')
 have_func('rb_time_new')

@b264
Copy link

b264 commented Apr 7, 2015

Does anyone know of a fix for this? Same issue here.
Linux 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux eventmachine (1.0.3) ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]

@skunkworker
Copy link

I was able to fix this by downloading the xcode command line tools for xcode 6.2 on apple's developer server. The ones for 6.3 don't include the right header for some reason.

@WillSewell
Copy link

@skunkworker do you know what libraries are included with the xcode command line tools that got this working? I don't really want to have to download xcode when I don't actually use it.

@skunkworker
Copy link

@WillSewell you don't have to download xcode per se, just the command line utilities for 10.10.2/xcode 6.2. its only about 110mb.

@WillSewell
Copy link

I see. Thanks.

@maksimf
Copy link

maksimf commented Apr 21, 2015

Same issue with ruby 2.2.2

@sodabrew
Copy link
Member

Please update to Xcode 6.3.1 and/or Command Line Tools 6.3 with release date of Apr 21, 2015. The original buggy CLT 6.3 was released on Apr 9, 2015.

@ghost6p
Copy link

ghost6p commented Oct 21, 2015

Ruby 2.2.2, this did it for me.

brew link openssl --force

@jayfajardo
Copy link

brew link openssl --force did it for me too

@jjuarez
Copy link

jjuarez commented Oct 22, 2015

Unfortunately the homebrew workaround did not work for me :/ I'm trying to install eventmachine version 1.0.8 over ruby 2.2.3 on OSx 10.11.1 with command line tools Command_Line_Tools_OS_X_10.11_for_Xcode_7.1

@samhains
Copy link

brew link openssl --force , did the trick for me too

@Focinfi
Copy link

Focinfi commented Oct 31, 2015

brew link openssl --force works for me (Mac OS 10.11.1 Ruby 2.2.1)

@san983
Copy link

san983 commented Oct 31, 2015

brew link openssl --force also worked for me 👍

@sebabouche
Copy link

brew link openssl --force worked !

@chamnap
Copy link

chamnap commented Dec 3, 2015

worked for me 👍

@simleap
Copy link

simleap commented Dec 8, 2015

it worked! thanks

@sodabrew
Copy link
Member

sodabrew commented Dec 8, 2015

I am locking this issue. The original issue was resolved regarding XCode versions. The ongoing posts about solving the OpenSSL issue in OS X El Capitan by way of replacing the system OpenSSL with the HomeBrew OpenSSL libraries is probably not a good idea. Further discussion in #661 to find a better alternative for a forthcoming release that will work automatically on El Capitan.

@eventmachine eventmachine locked and limited conversation to collaborators Dec 8, 2015
@sodabrew
Copy link
Member

Regarding the El Capitan / OpenSSL issues, please try eventmachine-1.0.9, it should compile and install without error now. Discuss issues on #668.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests