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

Build fails on Ubuntu x86_64 due to permission problem #236

Closed
dnrce opened this issue Jan 22, 2013 · 7 comments
Closed

Build fails on Ubuntu x86_64 due to permission problem #236

dnrce opened this issue Jan 22, 2013 · 7 comments

Comments

@dnrce
Copy link
Contributor

dnrce commented Jan 22, 2013

When trying to run bundle update therubyracer I get a compilation error. I'm using Ubuntu 12.10 x86_64. I have purged all old versions of therubyracer and libv8.

My Gemfile includes the line

gem 'therubyracer'

and I do not explicitly require libv8.

Here is the full error sent to stdout:

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

        /usr/bin/ruby1.9.1 extconf.rb 
checking for main() in -lpthread... yes
*** 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=/usr/bin/ruby1.9.1
    --with-pthreadlib
    --without-pthreadlib
    --enable-debug
    --disable-debug
/var/lib/gems/1.9.1/gems/libv8-3.11.8.13-x86_64-linux/ext/libv8/location.rb:15:in `initialize': Permission denied - /var/lib/gems/1.9.1/gems/libv8-3.11.8.13-x86_64-linux/ext/libv8/.location.yml (Errno::EACCES)
    from /var/lib/gems/1.9.1/gems/libv8-3.11.8.13-x86_64-linux/ext/libv8/location.rb:15:in `open'
    from /var/lib/gems/1.9.1/gems/libv8-3.11.8.13-x86_64-linux/ext/libv8/location.rb:15:in `load!'
    from /var/lib/gems/1.9.1/gems/libv8-3.11.8.13-x86_64-linux/lib/libv8.rb:6:in `configure_makefile'
    from extconf.rb:32:in `<main>'


Gem files will remain installed in ~/.bundler/tmp/20654/gems/therubyracer-0.11.3 for inspection.
Results logged to ~/.bundler/tmp/20654/gems/therubyracer-0.11.3/ext/v8/gem_make.out
An error occurred while installing therubyracer (0.11.3), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.11.3'` succeeds before bundling.

The file .location.yml has permissions set to 600. Running sudo gem install therubyracer -v '0.11.3' succeeds, and then bundle update therubyracer can complete.

@ignisf
Copy link
Collaborator

ignisf commented Jan 22, 2013

@cowboyd, I cannot replicate this with rake binary on my system, however the permissions of .location.yml are indeed 0600 (only?) in the currently published x86_64-linux binary of libv8.

@ignisf
Copy link
Collaborator

ignisf commented Jan 22, 2013

I suspect that a simple chmod in ext/libv8/location.rb would ensure consistency, however I cannot test this as I haven't been able to replicate generating .location.yml with 0600 permissions.

diff --git a/ext/libv8/location.rb b/ext/libv8/location.rb
index 5532a73..0c74270 100644
--- a/ext/libv8/location.rb
+++ b/ext/libv8/location.rb
@@ -7,6 +7,7 @@ module Libv8
     def install!
       File.open(Pathname(__FILE__).dirname.join('.location.yml'), "w") do |f|
         f.write self.to_yaml
+        f.chmod 0644
       end
       return 0
     end

@panmari
Copy link

panmari commented Jan 30, 2013

I tried to manually set the permission by executing

 chmod 0644

On .location.yml, but the issue remained. The workaround suggested by @zoombody works, though.

@dnrce
Copy link
Contributor Author

dnrce commented Jan 30, 2013

@panmari I'm surprised by that. Did you use sudo to perform the chmod?

@panmari
Copy link

panmari commented Jan 30, 2013

@zoombody yes I did
On Jan 30, 2013 6:22 PM, "Dan Rice" notifications@github.com wrote:

@panmari https://github.com/panmari I'm surprised by that. Did you use
sudo to perform the chmod?


Reply to this email directly or view it on GitHubhttps://github.com//issues/236#issuecomment-12901140.

@dnrce
Copy link
Contributor Author

dnrce commented Feb 1, 2013

It turns out there are other files with permissions set to 0600. When I repeated @panmari's test, the error pointed to files other than .location.yml.

The following files all need to be hit with sudo chmod +r:

/var/lib/gems/1.9.1/gems/libv8-3.11.8.13-x86_64-linux/ext/libv8/.location.yml
/var/lib/gems/1.9.1/gems/libv8-3.11.8.13-x86_64-linux/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a
/var/lib/gems/1.9.1/gems/libv8-3.11.8.13-x86_64-linux/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_snapshot.a

After doing so, bundle install succeeds.

Incidentally two other files are not world-readable but they don't affect the build of therubyracer:

/var/lib/gems/1.9.1/gems/libv8-3.11.8.13-x86_64-linux/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_nosnapshot.a
/var/lib/gems/1.9.1/gems/libv8-3.11.8.13-x86_64-linux/vendor/v8/out/x64.release/obj.target/tools/gyp/libpreparser_lib.a

@ignisf
Copy link
Collaborator

ignisf commented Mar 8, 2013

@zoombody your PR was merged and this issue will be fixed by the next release of libv8.

@dnrce dnrce closed this as completed Mar 8, 2013
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