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 1.0.3 doesnt compile under OSX 10.10.1 with Ruby 2.2.0 #553

Closed
skunkworker opened this issue Dec 25, 2014 · 25 comments
Closed

Comments

@skunkworker
Copy link

When installing on OSX Yosemite 10.10.1 with Ruby 2.2.0p0 I get the following error.

gem install eventmachine -v '1.0.3'
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.

/Users/john/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20141225-63739-12ofcmn.rb extconf.rb

checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... 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_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
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling binder.cpp
compiling cmain.cpp
compiling ed.cpp
compiling em.cpp
em.cpp:827: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:25:20: note: expanded from macro 'EmSelect'
#define EmSelect rb_thread_select
^
/Users/john/.rvm/rubies/ruby-2.2.0/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:827:32: error: cannot initialize a parameter of type 'rb_fdset_t *' with an rvalue of type 'fd_set *'
return EmSelect (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv);
^~~~~~~~
/Users/john/.rvm/rubies/ruby-2.2.0/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:946: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:25:20: note: expanded from macro 'EmSelect'
#define EmSelect rb_thread_select
^
/Users/john/.rvm/rubies/ruby-2.2.0/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 *);
^
3 errors generated.
make: *
* [em.o] Error 1

make failed, exit code 2

@mosic
Copy link

mosic commented Dec 26, 2014

You need to update eventmachine to 1.0.4 in order to make it work with Ruby 2.2.0 (#509).

@davidbegin
Copy link

+1 upgrading to 1.0.4 got rid of this bug for me.

@jaredcwhite
Copy link

Yay! Works. Glad this update was ready to go for the official Ruby 2.2 release.

@tmm1
Copy link
Contributor

tmm1 commented Jan 2, 2015

eventmachine 1.0.4 was released with ruby 2.2 compatibility

@wagnerads
Copy link

+1 upgrading to 1.0.4

tskogberg added a commit to henrik/remit that referenced this issue Jan 27, 2015
Had an issue with eventmachine 1.0.3. It does not compile
under os x 10.10.1 with ruby 2.2.0.

See issue:
eventmachine/eventmachine#553
@jayperryworks
Copy link

I'm actually still running into this exact issue with 1.0.7, running OS X 10.10.2, and LLVM v6.1.0. I'm using ruby 2.2.1 via RVM (tried it on 2.2.0 and had same issue).

I'm completely stumped -- any suggestions hugely appreciated. A friend running LLVM 6.0 under the same setup had no issues, so my only guess is the command line tools update?

@zeroed
Copy link

zeroed commented Apr 9, 2015

@jayperryworks if I may suggest... I've solved installing Xcode 6.3 (you can find it here) ... not only the Command Line Tools, though.

@jayperryworks
Copy link

Thanks @zeroed! I wonder if the full Xcode ships with newer stuff that trickles down to command line tools later. I only need event machine for Livereload, so I'll hold off a little while and see if an update comes out for GCC.

@skunkworker
Copy link
Author

You might try installing the 10.10.2 / Xcode 6.2 command line developer tools. The 6.3 ones don't include the right headers in the right location.

@michaelbarton
Copy link

The suggestion by @skunkworker worked for me. I was having a similar problem, where event machine installed fine last week but not today. The current release date on CL tools 6.3 is April 9 so I assume that 6.3 was installed in a software update at the end of last week. I installed 6.2 and eventmachine successfully installs on OS 10.10.

@skunkworker
Copy link
Author

@michaelbarton It seems as though a certain header file was not being installed on a fresh 10.10.3 install if you had never installed 10.10.2. If you install the 10.10.2 then the 10.10.3 tools it still seems to work.

@ssenge
Copy link

ssenge commented Apr 17, 2015

Yes, this works for me as well. Installing 6.2. from developer.apple.com/downloads (although 6.3. was installed via automatic update) solved the issue.

@jayperryworks
Copy link

Worked for me too! Brilliant. Cheers, all, much appreciated.

@plicjo
Copy link

plicjo commented Apr 27, 2015

Nice! Thanks!

@garettarrowood
Copy link

+1 as well!

@1ak31sha
Copy link

I am having trouble installing eventmachine 1.0.3,1.0.4, or 1.0.7. Cant bundle install because of this. i have ruby 2.2.2 and OSX 10.11.4. Does anyone know how to solve this? Much appreciated!

@sodabrew
Copy link
Contributor

sodabrew commented May 11, 2016 via email

@1ak31sha
Copy link

Thank you! but actually i figure it out. needed to install eventmachine which required 'brew install openssl' and then 'brew link openssl --force', then uploaded the new gemfile.lock

dbenamydd added a commit to dbenamydd/slackbot that referenced this issue May 24, 2016
Eventmachine 1.0.3 doesn't build on some combinations of ruby and os x- eventmachine/eventmachine#553
cheshire137 added a commit to cheshire137/blicblock-js that referenced this issue Oct 23, 2016
Error with eventmachine dependency version, see eventmachine/eventmachine#553
@vassilevsky
Copy link

I had to bundle an old project today on macOS Sierra. It has eventmachine v1.0.3 in the Gemfile.lock. There is no reason to upgrade it at this point.

A basic bundle failed:

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

    /Users/vassilevsky/.rbenv/versions/2.1.5/bin/ruby extconf.rb --with-cppflags=-I/usr/local/opt/openssl/include
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/vassilevsky/.rbenv/versions/2.1.5/bin/ruby
	--with-openssl-config
	--without-openssl-config
	--with-pkg-config
	--without-pkg-config
/Users/vassilevsky/.rbenv/versions/2.1.5/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /Users/vassilevsky/.rbenv/versions/2.1.5/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
	from /Users/vassilevsky/.rbenv/versions/2.1.5/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
	from /Users/vassilevsky/.rbenv/versions/2.1.5/lib/ruby/2.1.0/mkmf.rb:642:in `block in try_ldflags'
	from /Users/vassilevsky/.rbenv/versions/2.1.5/lib/ruby/2.1.0/mkmf.rb:635:in `with_ldflags'
	from /Users/vassilevsky/.rbenv/versions/2.1.5/lib/ruby/2.1.0/mkmf.rb:641:in `try_ldflags'
	from /Users/vassilevsky/.rbenv/versions/2.1.5/lib/ruby/2.1.0/mkmf.rb:1762:in `pkg_config'
	from extconf.rb:61:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/vassilevsky/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3 for inspection.
Results logged to /Users/vassilevsky/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-16/2.1.0-static/eventmachine-1.0.3/gem_make.out

An error occurred while installing eventmachine (1.0.3), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.3'` succeeds before bundling.

I had configured Bundler before to use OpenSSL installed with Homebrew:

  bundle config
Settings are listed in order of priority. The top value will be used.
build.eventmachine
Set for the current user (/Users/vassilevsky/.bundle/config): "--with-cppflags=-I/usr/local/opt/openssl/include"

Apparently this did not help.

I decided to see what OpenSSL formula has to say about all this:

  brew info openssl
openssl: stable 1.0.2l (bottled) [keg-only]
SSL/TLS cryptography library
https://openssl.org/
/usr/local/Cellar/openssl/1.0.2l (1,709 files, 12.2MB)
  Poured from bottle on 2017-06-01 at 16:10:01
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl.rb
==> Dependencies
Build: makedepend ✘
==> Options
--without-test
	Skip build-time tests (not recommended)
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig

I decided to set these environment variables and see if it makes a difference:

  LDFLAGS='-L/usr/local/opt/openssl/lib' CPPFLAGS='-I/usr/local/opt/openssl/include' PKG_CONFIG_PATH='/usr/local/opt/openssl/lib/pkgconfig' bundle

This totally helped! The bundle has been installed without errors.

Hope this helps the next googler ❤️

@kuangda
Copy link

kuangda commented Sep 5, 2017

Thank you! It fails to work well

Notice
An error occurred while installing eventmachine (1.0.3), and Bundler cannot continue.
Make sure that gem install eventmachine -v '1.0.3' succeeds before bundling.

@googya
Copy link

googya commented Sep 15, 2018

em.cpp:1124:40: error: invalid operands to binary expression ('__bind<int &, sockaddr *&, int &>' and 'int')
                if (bind (sd, bind_to, bind_to_size) < 0) {

em.cpp:1543:6: error: value of type '__bind<int &, sockaddr *&, int &>' is not contextually convertible to 'bool'
        if (bind (sd_accept, bind_here, bind_size)) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
em.cpp:1603:53: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
        if (bind (sd, (struct sockaddr*)&sin, sizeof(sin)) != 0)


em.cpp:1871:6: error: value of type '__bind<int &, sockaddr *, unsigned long>' is not contextually convertible to 'bool'
        if (bind (sd_accept, (struct sockaddr*)&s_sun, sizeof(s_sun))) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 4 errors generated.
make: *** [em.o] Error 1

make failed, exit code 2

ruby 2.2.7
llvm 6.0.1
Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 21 20:07:39 PDT 2018; root:xnu-3789.73.14~1/RELEASE_X86_64 x86_64

gem i eventmachine -v 1.0.4

@sodabrew
Copy link
Contributor

sodabrew commented Sep 15, 2018

@googya this is already fixed please update to EM 1.2.6 or newer.

@googya
Copy link

googya commented Sep 15, 2018

@googya this is already fixed please update to EM 1.2.6 or newer.

yes, I know, there is no problem when installing 1.2.6 or newer. But my old project needs 1.0.4, how to deal it ? @sodabrew

@sodabrew
Copy link
Contributor

The issue is resolved in a newer version of EM. There may be some workarounds in the relevant tickets in the issue tracker. But I strongly advise that you work through updating.

@googya
Copy link

googya commented Sep 16, 2018

ok, I will try, thanks for your advice, @sodabrew

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

No branches or pull requests