Chromium's depot_tools are not able to fetch V8's source on Alpine Linux
niko opened this issue · 8 comments
I'm getting an error when trying to install libv8
. I'm using Ruby 2.5.0 on Alpine Linux. It seems to be a problem with downloading the sources.
gem install libv8 Building native extensions. This could take a while...
ERROR: Error installing libv8:
ERROR: Failed to build gem native extension.
current directory: /usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/ext/libv8
/usr/bin/ruby -r ./siteconf20180625-7743-1i7w51g.rb extconf.rb
creating Makefile
Running: gclient root
Error: Command 'download_from_google_storage --no_resume --platform=linux* --no_auth --bucket chromium-clang-format -s v8/buildtools/linux64/clang-format.sha1' returned non-zero exit status 1 in /usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/vendor
Running: gclient config --spec 'solutions = [
{
"url": "https://chromium.googlesource.com/v8/v8.git",
"managed": False,
"name": "v8",
"deps_file": "DEPS",
"custom_deps": {},
},
]
'
Running: gclient sync --with_branch_heads
Traceback (most recent call last):
File "/usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/vendor/depot_tools/fetch.py", line 301, in <module>
sys.exit(main())
File "/usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/vendor/depot_tools/fetch.py", line 296, in main
return run(options, spec, root)
File "/usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/vendor/depot_tools/fetch.py", line 290, in run
return checkout.init()
File "/usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/vendor/depot_tools/fetch.py", line 133, in init
self.run_gclient(*sync_cmd)
File "/usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/vendor/depot_tools/fetch.py", line 78, in run_gclient
return self.run(cmd_prefix + cmd, **kwargs)
File "/usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/vendor/depot_tools/fetch.py", line 68, in run
return subprocess.check_output(cmd, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '('gclient', 'sync', '--with_branch_heads')' returned non-zero exit status 2
/usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/ext/libv8/builder.rb:117:in `block in setup_build_deps!': unable to fetch v8 source (RuntimeError)
from /usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/ext/libv8/builder.rb:115:in `chdir'
from /usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/ext/libv8/builder.rb:115:in `setup_build_deps!'
from /usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/ext/libv8/builder.rb:71:in `build_libv8!'
from /usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1/ext/libv8/location.rb:24:in `install!'
from extconf.rb:7:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/lib/ruby/gems/2.5.0/gems/libv8-6.3.292.48.1 for inspection.
Results logged to /usr/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0/libv8-6.3.292.48.1/gem_make.out
Strange enough install in the docker ruby:2.5-alpine container just works:
$ docker run -it ruby:2.5-alpine gem install libv8
Fetching: libv8-6.3.292.48.1-x86_64-linux.gem (100%)
Successfully installed libv8-6.3.292.48.1-x86_64-linux
1 gem installed
Notable similarities: It's the exact same version.
Notable difference: It's not building native extensions. And that's where my local install fails.
gem
version is 2.7.7 in docker and 2.7.6 native.
There seems to be lack of upstream support of the SDK with Alpine at this point:
Reference issues:
- https://bugs.chromium.org/p/v8/issues/detail?id=5701
- https://bugs.chromium.org/p/chromium/issues/detail?id=786617
Star those issues to help get them resolved or even better -- suggest patches.
Any idea why this just works within a docker container?
Hey, it does not.
If you take a closer look, gem
downloads the Linux binary version Fetching: libv8-6.3.292.48.1-*x86_64-linux*.gem (100%)
This has been linked against glibc, which makes it unusable on Alpine afaik. :(
Huh... Actually it might work -- the Dockerfile you're using downloads and compiles Ruby from source which I think is linked against glibc... https://github.com/docker-library/ruby/blob/699a04311386ecc98ca242fc9bdee17fb4008863/2.5/alpine3.7/Dockerfile
The Ruby in Alpine's repos is not and in fact is patched to not use binary versions of gems because of the reason I outlined in the comment above.
Oh. Right. That makes sense.
Made a comment here regarding musl support and a possible partially upstream solution: #270 (comment)
Closing as this issue is completely sidestepped in libv8-node, and has musl builds.