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

unable to install "eventmachine" both from gem and build #186

Closed
suryart opened this issue Apr 20, 2011 · 30 comments
Closed

unable to install "eventmachine" both from gem and build #186

suryart opened this issue Apr 20, 2011 · 30 comments

Comments

@suryart
Copy link

suryart commented Apr 20, 2011

I am trying to install eventmachine by command: gem install eventmachine and it is giving me this error at the end:

make: shared: Command not found
make: [rubyeventmachine.so] Error 127 (ignored)
/usr/bin/install -c -m 0755 rubyeventmachine.so /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib
/usr/bin/install: cannot stat `rubyeventmachine.so': No such file or directory
make: *** [/usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/rubyeventmachine.so] Error 1

you may review whole log here: http://pastie.org/private/ebiehjoa23klhec6hurmg

And when I tried to grab and build like this:

git clone git://github.com/eventmachine/eventmachine.git
cd eventmachine
rake build

at rake build it is prompting following error:

surya@surya-desktop:~/Desktop/Surya/Projects/eventmachine$ rake build
(in /home/surya/Desktop/Surya/Projects/eventmachine)
rake aborted!
Don't know how to build task 'build'

(See full trace by running task with --trace)
surya@surya-desktop:~/Desktop/Surya/Projects/eventmachine$

Can you kindly suggest me any possible way to solve this issue?

Thanks
Surya

@michaelklishin
Copy link
Contributor

After cloning, do

gem install rake-compiler

and then

rake gem

to build a gem. Now on to installation:

rake gem:install

will also install it but it uses sudo. If you are running RVM, for example, and not really installing gems system-wide, install it via

gem install pkg/eventmachine-1.0.0.beta.3.gem

Your pastie suggests that gem failed to build it's C++ extension. Can you post contents of /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/ext/gem_make.out up?

@suryart
Copy link
Author

suryart commented Apr 20, 2011

After cloning I get up to rake gem but when I hit rake gem:install it came up with the same issue, you may check whole log here : http://pastie.org/private/exlwqogpwaxukb1bvp51q

And /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/ext/gem_make.out file content here : http://pastie.org/private/q9sa5dovdxdoajxdotctg

@michaelklishin
Copy link
Contributor

Sorry for stupid question but are you sure you have all the build toolchain installed? g++ (part of gcc) and libstdc++6 package? I see a blog post that demonstrates the same issue (even though that is on OS X) and the solution seems to be editing extconf.rb to force g++ usage.

Try what is in that post but I suspect that something from the C++ build toolchain is missing from your system.

@suryart
Copy link
Author

suryart commented Apr 20, 2011

It's not a problem. Well I have already installed mingw32 and libstd++6 and libconfig8-dev before doing all this. Cause if I hadn't done it then rake-compiler cross-ruby VERSION=1.8.7-p330 wouldn't work. Even I'm not getting any idea that what's going wrong here!

@michaelklishin
Copy link
Contributor

I see. try exporting CXX="g++"?

@suryart
Copy link
Author

suryart commented Apr 20, 2011

still not working :(

@tmm1
Copy link
Contributor

tmm1 commented Apr 20, 2011

You are missing make. Install it via xcode.

@tmm1
Copy link
Contributor

tmm1 commented Apr 20, 2011

Oops, should have looked closer. You're not even on OSX.

Something is screwy with your build chain or ruby installation. What is your ruby -v? Try an rvm ruby instead.

@suryart
Copy link
Author

suryart commented Apr 21, 2011

Well sorry, I must have told you this part of the story too. my ruby -v show ruby 1.8.8p1 (2011-01-19) [i686-linux] I had compiled cross-ruby using rake-compiler of version 1.8.8p1 by copying /home/surya/.rake-compiler/builds/ruby-1.8.7-p330 all file to /home/surya/.rake-compiler/builds/ruby-1.8.8-p1 directory cause when I used this command rake-compiler cross-ruby VERSION=1.8.8-p1 it says Error 404 : can not find source for ruby-1.8.8-p1, and does not create any build for it but it does create a build for rake-compiler cross-ruby VERSION=1.8.7-p330 so I copied and compiled and it worked !
Config.yml of rake-compiler is now looks like this:

/home/surya/.rake-compiler/config.yml

rbconfig-1.8.7: /home/surya/.rake-compiler/ruby/ruby-1.8.7-p330/lib/ruby/1.8/i386-mingw32/rbconfig.rb
rbconfig-1.8.8: /home/surya/.rake-compiler/ruby/ruby-1.8.8-p1/lib/ruby/1.8/i386-mingw32/rbconfig.rb

I know I should not do something like this. But is there any way to get rid off all from this?

@tmm1
Copy link
Contributor

tmm1 commented Apr 21, 2011

How did you install 1.8.8p1? Are you having issues with 1.8.7? This could be an issue with rake-compiler in 1.8.8.

@luislavena: any ideas?

@suryart
Copy link
Author

suryart commented Apr 21, 2011

I had followed this blog : https://help.ubuntu.com/community/RubyOnRails
and had used this command to install ruby: sudo apt-get install ruby-full build-essential now I'm afraid of installing 1.8.7 or any other version only because of gem dependencies! BTW do I have to install everything from scratch now?

@michaelklishin
Copy link
Contributor

If you reinstall Ruby, yes, gems have to be reinstalled, too. You really should take a look at RVM and what gemsets can do. 1.8.8 release plans were abandoned as far as I know, so 1.8.7 is now a synonym for "Ruby 1.8" for most library maintainers.

@tmm1
Copy link
Contributor

tmm1 commented Apr 21, 2011

What distribution are you running that includes a 1.8.8?

@luislavena
Copy link
Contributor

@tmm1 1.8.8 is not even released, how on earth it got installed? See here http://ftp.ruby-lang.org/pub/ruby/1.8/ no releases

And Ruby Core decided not to release 1.8.8 at all

Now, rake-compiler will affect rake compile but will not affect gem install, that is RubyGems alone working.

@SuryaTripathi the cross compilation part is only required when cross compiling to Windows, which I think you don't need it, why you did that in the first place?

None of this makes any sense. Which version of Ubuntu are we talking about? 11.04? Sorry, but I can't believe that.

@michaelklishin
Copy link
Contributor

@luislavena I think there is no cross-compilation going on and @SuryaTripathi understands that. What it comes down is some Linux build chain (or environment setup) deficiency that prevents EM reactor from compiling. I personally think it is not even 1.8.8-specific. Sorry that we bothered you ;)

@SuryaTripathi, try this: in EM git repository on your server, run

ruby ext/extconf.rb

which will generate Makefile in the repository root. Now if you run make from the repository root, C++ extension will compile just like it does upon gem installation. At the very least, post that Makefile to pastie or gist.github.com.

@luislavena
Copy link
Contributor

@michaelklishin seems it was as ~/.rake-compiler/* directory and configuration files were mentioned several times.

Anyhow, can @SuryaTripathi try this?

which g++

Seems to me from the make output that g++ executable is not set properly, perhaps CXX environment variable is set to empty which is affecting extconf from generating a valid makefile.

@suryart
Copy link
Author

suryart commented Apr 21, 2011

All I used to get stuck is on this command: rake build

@luislavena I did compilation at the first place cause it were asking for the same I got this error before installing rake-cmpiler: no such file to load -- rake/extensiontask, and when I installed rake-compiler it again puzzled me with this: rake-compiler must be configured first to enable cross-compilation
After configuring and compiling of rake-compiler cross-ruby VERSION=1.8.8-p1
by copying files of 1.8.7, as I mentioned above it then come up with this issue: rake/extension compiler.rb:28:in mingw host': No MinGW tools or unknown setup platform? After installing mingw32 and other runtime libraries I again compiled it using above command it did worked, but unfortunately in last when I again used this command:rake build` in eventmachine directory after cloning, it says: Don't know how to build task 'build' for eventmachine

you may see the rake build --trace here: http://pastie.org/private/rbo9phabe1xochspnu5g

I don't know but it is(ruby-1.8.8-p1) on my system and running fine before I wasn't trying to install eventmachine, I had installed it on 2011-01-19(yyyy-mm-dd) . I am using Ubuntu 10.10, the Maverick Meerkat - released in October 2010. This is my gem ENV:
surya@surya-desktop:~/Desktop/Surya/Projects/eventmachine$ gem ENV
RubyGems Environment:

  • RUBYGEMS VERSION: 1.5.0
  • RUBY VERSION: 1.8.8 (2011-01-19 patchlevel 1) [i686-linux]
  • INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
  • RUBY EXECUTABLE: /usr/local/bin/ruby
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86-linux
  • GEM PATHS:
    • /usr/local/lib/ruby/gems/1.8
    • /home/surya/.gem/ruby/1.8
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

I don't know what kind of issue I'm facing cause there is no reference out there on internet for this :( If you still don't believe that I have ruby-1.8.8 then you are welcome to share my system and may try out things by yourself!

I think I need to do everything from scratch now, well I'll close this issue if installing from scratch worked, else guys I will let you know the issue came with it.. If you have any suggestion or any idea you think can work then kindly let me know..
Thanks
Surya

@suryart
Copy link
Author

suryart commented Apr 21, 2011

@michaelklishin I got the make file here it is: http://pastie.org/private/ukxw63lghqacyiqpnrfnbg
you may also look at the mkmf.log here at: http://pastie.org/private/qj4bi12lpymgudgcafdiyq

@luislavena which g++ came up with this: /usr/bin/g++

@luislavena
Copy link
Contributor

@SuryaTripathi @michaelklishin @tmm1 line 43 of this pastie is the guilty one: http://pastie.org/private/ukxw63lghqacyiqpnrfnbg

For some reason is not being referenced to g++ as pointed by previous comment (which g++)

@suryart
Copy link
Author

suryart commented Apr 21, 2011

@luislavena should I try make after adding g++ at line 43?

@luislavena
Copy link
Contributor

@SuryaTripathi please do, it should work, however, that does not explain why is failing in the first place.

@suryart
Copy link
Author

suryart commented Apr 21, 2011

@luislavena here is the log of make : http://pastie.org/private/dbov0zjlvrlcb02asv40q
what do I do after this? kindly assist

@luislavena
Copy link
Contributor

@tmm1 see above, it did compile, so the issue is why CXX was added to the Makefile empty.

Leave that to you guys now that I cleared rake-compiler's fame ;-)

@suryart
Copy link
Author

suryart commented Apr 21, 2011

@michaelklishin I think there are some issues with rake gem:install cause when I use this command it updates Makefile which does not have g++ in CXX field and thus fails the compilation. What could be the possible reason?

@michaelklishin
Copy link
Contributor

@SuryaTripathi for whatever reason, on your system CXX Makefile variable is blank. If you fire up irb and run

require 'mkmf'

what are values of CONFIG['CC'] and CONFIG['CXX']?

@michaelklishin
Copy link
Contributor

Also, lets see what RbConfig looks like:

require "rbconfig"
puts RbConfig::CONFIG['CXX']
puts RbConfig::CONFIG['CC']
puts RbConfig::CONFIG['LDSHARED']

@suryart
Copy link
Author

suryart commented Apr 23, 2011

@michaelklishin Here are the irb results: rbconfig isn't loading, any guess?

surya@surya-desktop:~/Desktop/Surya/Projects/eventmachine$ irb
irb(main):001:0> require 'mkmf'
=> true
irb(main):002:0> puts CONFIG['CC'] 
gcc
=> nil
irb(main):003:0> puts CONFIG['CXX']
nil
=> nil
irb(main):004:0> require "rbconfig"
=> false

@michaelklishin
Copy link
Contributor

No reason to worry: it does load, false returned by Kernel#require means that the file was already loaded (presumably by mkmf under the hood).

From my irb:

ruby-1.9.2-p180 :001 > require 'mkmf'
 => true 
ruby-1.9.2-p180 :002 > require 'rbconfig'
 => false 
ruby-1.9.2-p180 :003 > RbConfig
 => RbConfig 
ruby-1.9.2-p180 :004 > CONFIG['CXX']
 => "g++"

and to prove that mkmf loads rbconfig under the hood:

ruby-1.9.2-p180 :001 > require 'mkmf'
 => true 
ruby-1.9.2-p180 :002 > CONFIG['CXX']
 => "g++"

RbConfig contents is a reflection of what environment looked like when Ruby was compiled. CXX variable wasn't set. I guess you are running a binary package and this is something inherited from whoever built the package.

You can edit extconf.rb and set CONFIG['CXX'] to "g++", then run

ruby extconf.rb

again to regenerate Makefile. Then see if make works.

@suryart
Copy link
Author

suryart commented Apr 25, 2011

Great it worked!

I put this:

CONFIG['CXX'] = "g++"
in /eventmachine/ext/extconf.rb and /eventmachine/ext/fastfilereader/extconf.rb files, right below require 'mkmf' line.

then I did: rake gem and then rake gem:install
And it worked perfectly.

@michaelklishin, @tmm1 and @luislavena for your time and great support! This issue is resolved now! Great work :)

@suryart suryart closed this as completed Apr 25, 2011
@ScarletMcLearn
Copy link

Bump

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

5 participants