How to get the EventMachine gem to compile on OSX Lion 10.8.2 with Xcode 4.5.1
Asked Answered
O

5

5

I looked everywhere I can find but can't seem to find a solution to this.

I'm using Xcode 4.5.1 on Lion 10.8.2, and am trying to run bundle for a Rails project and it keeps jamming up on this. I'm using the Thin gem for Heroku.

Bolanos@Jeremys-Mac-mini ⦿-1.9.3 fishfarm $ sudo gem install eventmachine
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing eventmachine:
    ERROR: Failed to build gem native extension.

        /Users/Bolanos/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
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_check_ints()... yes
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue.h... yes
creating Makefile

make
compiling binder.cpp
make: g++-4.2: No such file or directory
make: *** [binder.o] Error 1


Gem files will remain installed in /Users/Bolanos/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0 for inspection.
Results logged to /Users/Bolanos/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0/ext/gem_make.out

For now I'm having to do without Thin. Does anyone have a solution?

Orthography answered 16/10, 2012 at 6:5 Comment(3)
Where's your g++? Have you installed the command line tools for Xcode?Hellbox
yes, I installed the tools - it works in all my other apps and I can create a new one and install thin and it works - it just won't work with this specific app.Orthography
I decided to delete my app and start over fresh from git and it works - never figured out that one app wouldn't work.Orthography
E
3

You have to install the Command Line Tools package from developer.apple.com.

Also I was having troubles with the MacOSX10.6.sdk because some headers were missing there, so I installed the MacOSX10.5.sdk and all worked fine.

Efrainefram answered 16/10, 2012 at 7:7 Comment(0)
T
13

Also check for a symlink:

$ sudo ln -s /usr/bin/g++ /usr/bin/g++-4.2
Tambourin answered 20/2, 2013 at 0:51 Comment(1)
This seems like the correct answer to me, given the error is make: g++-4.2: No such file or directoryKilliecrankie
E
3

You have to install the Command Line Tools package from developer.apple.com.

Also I was having troubles with the MacOSX10.6.sdk because some headers were missing there, so I installed the MacOSX10.5.sdk and all worked fine.

Efrainefram answered 16/10, 2012 at 7:7 Comment(0)
R
2

I had the exact error, and creating a new symlink for the missing resource /usr/bin/g++-4.2 worked for me.

In my setup I pointed at the location in Cellar:

/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
Realistic answered 3/3, 2013 at 3:23 Comment(0)
M
1

If none of the above work for you, I did

sudo ln -s /usr/bin/llvm-g++-4.2 /usr/bin/g++-4.2

and it worked like a charm. Running OS X 10.8.2.

Maeve answered 27/2, 2013 at 19:42 Comment(0)
B
1

You should have both:

  1. Xcode command line tool: Detailed instructions for installation are in "How to install Xcode Command Line Tools".

  2. Apple-gcc* compiler: I should mention that compiling with gcc48 and gcc49 fails. Therefore, installing apple-gcc42 (if you don't have) and choosing the compiler via MacPorts will solve the problem. You can see the installed gcc versions using:

    port select --list gcc

You should see something like this where "mp-" stands for MacPorts own port:

Available versions for gcc:
         apple-gcc42 (active)
         current_saved
         mp-gcc48
         mp-gcc49

If you don't have "apple-gcc*" you may install it via:

port install apple-gcc42

after that chose the compiler:

port select --set gcc apple-gcc42

Now you may run:

 gem install eventmachine

This should solve the problem of errors which arise during building gem native extensions on OSX.

Buckner answered 7/9, 2014 at 20:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.