Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Installing on ubuntu 12.04 fails? #47

Closed
nathanvda opened this issue Aug 16, 2012 · 7 comments
Closed

Installing on ubuntu 12.04 fails? #47

nathanvda opened this issue Aug 16, 2012 · 7 comments

Comments

@nathanvda
Copy link

I have the following in my Gemfile:

gem 'therubyracer', '~> 0.11.0beta8'
gem 'libv8'

I get the following error when compiling:

Installing therubyracer (0.11.0beta8) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/nva/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb 
checking for main() in -lpthread... yes
creating Makefile

make
compiling trycatch.cc
compiling invocation.cc
compiling exception.cc
compiling script.cc
compiling accessor.cc
compiling template.cc
compiling locker.cc
compiling constraints.cc
compiling external.cc
compiling v8.cc
compiling object.cc
compiling message.cc
compiling stack.cc
compiling value.cc
compiling rr.cc
compiling array.cc
compiling backref.cc
compiling signature.cc
compiling string.cc
compiling context.cc
compiling heap.cc
compiling function.cc
compiling init.cc
compiling primitive.cc
compiling gc.cc
compiling date.cc
compiling handles.cc
compiling constants.cc
linking shared-object v8/init.so
/home/nva/.rvm/gems/ruby-1.9.3-p125@dpplus/gems/libv8-3.11.8.3-x86_64-linux/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: could not read symbols: Malformed archive
collect2: ld returned 1 exit status
make: *** [init.so] Error 1


Gem files will remain installed in /home/nva/.rvm/gems/ruby-1.9.3-p125@dpplus/gems/therubyracer-0.11.0beta8 for inspection.
Results logged to /home/nva/.rvm/gems/ruby-1.9.3-p125@dpplus/gems/therubyracer-0.11.0beta8/ext/v8/gem_make.out
An error occured while installing therubyracer (0.11.0beta8), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.11.0beta8'` succeeds before bundling.

I can see the last commit should fix a corrupt binary for x64, so when I try the following in my Gemfile

gem 'libv8', :git => 'https://github.com/cowboyd/libv8.git'

I get the following error:


Using libv8 (3.11.8.3) from https://github.com/cowboyd/libv8.git (at master) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/nva/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb 
creating Makefile
Using compiler: /usr/bin/g++
make: *** No rule to make target `x64.release'.  Stop.



Gem files will remain installed in /home/nva/.rvm/gems/ruby-1.9.3-p125@dpplus/bundler/gems/libv8-4e9639aa2811 for inspection.
Results logged to /home/nva/.rvm/gems/ruby-1.9.3-p125@dpplus/bundler/gems/libv8-4e9639aa2811/ext/libv8/gem_make.out
An error occured while installing libv8 (3.11.8.3), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.11.8.3'` succeeds before bundling.

Any ideas??

@nathanvda
Copy link
Author

Hi, I was able to compile locally, not sure how to proceed to include the binary or where to find the binary at all (see also #48).

@averell23
Copy link

We're having a similiar issue on centos 6.3. I was able to build the binary gem manually, but:

  • It seems that libv8_base.a depends on files that are outside of the gem

  • Here's the first few lines from nm libv8_base.a on my system

    /root/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o:
    0000000000000000 r .LC0
    0000000000000015 r .LC1
    U GLOBAL_OFFSET_TABLE
    U _ZN2v88internal10JSFunction11CompileLazyENS0_6HandleIS1_EENS0_18ClearExceptionFlagE
    U _ZN2v88internal10JSFunction12SetPrototypeEPNS0_6ObjectE
    U _ZN2v88internal10JSReceiver12SetPrototypeEPNS0_6ObjectEb
    U _ZN2v88internal11HandleScope16DeleteExtensionsEPNS0_7IsolateE
    U _ZN2v88internal11HandleScope6ExtendEv
    U _ZN2v88internal11StoreBuffer7CompactEv

As you can see, it still knows about the accessors.o file in the build directory. As soon as I remove that, everything comes crashing down. The same seems to be the case with the 3.8.11 version I got from rubygems.

I didn't figure out how to make a completely self-contained binary build, so I'm now always compiling the thing on installation...

@nathanvda
Copy link
Author

Ok, I was able to do a rake binary, which gave me a binary gem (libv8-3.11.8.3-x86_64-linux.gem). I then referred to this gem in my Gemfile as follows:

gem 'libv8', '3.11.8.3', :path => '../github/libv8/pkg'

And then building therubyracer gives me the following errors:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/nva/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb 
checking for main() in -lpthread... yes
checking for v8.h... yes
creating Makefile

make
compiling trycatch.cc
compiling invocation.cc
compiling exception.cc
compiling script.cc
compiling accessor.cc
compiling template.cc
compiling locker.cc
compiling constraints.cc
compiling external.cc
compiling v8.cc
v8.cc: In static member function ‘static VALUE rr::V8::IdleNotification(int, VALUE*, VALUE)’:
v8.cc:29:55: error: no matching function for call to ‘v8::V8::IdleNotification(int)’
v8.cc:29:55: note: candidate is:
/usr/include/v8.h:3198:15: note: static bool v8::V8::IdleNotification()
/usr/include/v8.h:3198:15: note:   candidate expects 0 arguments, 1 provided
v8.cc:33:1: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [v8.o] Error 1


Gem files will remain installed in /home/nva/.rvm/gems/ruby-1.9.3-p125@dpplus/gems/therubyracer-0.11.0beta8 for inspection.
Results logged to /home/nva/.rvm/gems/ruby-1.9.3-p125@dpplus/gems/therubyracer-0.11.0beta8/ext/v8/gem_make.out
An error occured while installing therubyracer (0.11.0beta8), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.11.0beta8'` succeeds before bundling.

Any ideas?

@nathanvda
Copy link
Author

@averell23 I can see the same as you, but I am not entirely sure if that explains the error I am receiving. Frankly, while I have done loads of C/C++ development ages ago, I can't read or interpret the nm output :) Is it just defining the contained methods, with the original source object file, or is it declaring the interface to external methods?

@cowboyd
Copy link
Collaborator

cowboyd commented Aug 28, 2012

It looks as though it is finding and using an old version of v8 which did not take a parameter to IdleNotification()

/usr/include/v8.h should not be used. Instead it should find the version of v8.h contained in the libv8 gem.

@cowboyd
Copy link
Collaborator

cowboyd commented Aug 28, 2012

Note that this may very well be a bug in libv8 itself

@nathanvda
Copy link
Author

Ok. I had two weeks holiday, and now my bundle installs perfectly fine. Not sure if that means therubyracer was fixed, or libv8 or something in ubuntu. Anyway: this issue is no longer relevant for me.

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

3 participants