Open morphine00 opened 1 year ago
First, Ruby 2.7 is EOL and not (actively) supported by mini_racer, see https://github.com/rubyjs/mini_racer#supported-ruby-versions--troubleshooting. mini_racer
0.6.4 is also not the latest version. Can you try bump one or both?
Also: Please make sure to run with the latest version of Rubygems (gem update --system
) and bundler.
Alpine (musl libc) is unfortunately known for causing quite a few issues over the years 😞
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux-musl]
/usr/gem/gems/mini_racer-0.8.0/lib/mini_racer.rb:14:in `load': Error relocating /usr/gem/extensions/x86_64-linux-musl/3.1.0/mini_racer-0.8.0/mini_racer_extension.so: _ZSt28__throw_bad_array_new_lengthv: symbol not found (LoadError)
from /usr/gem/gems/mini_racer-0.8.0/lib/mini_racer.rb:14:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:60:in `require'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:55:in `each'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:55:in `block in require'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:44:in `each'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:44:in `require'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler.rb:186:in `require'
from /usr/gem/gems/jekyll-4.3.2/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
from /usr/gem/gems/jekyll-4.3.2/exe/jekyll:11:in `<top (required)>'
from /usr/local/bundle/bin/jekyll:27:in `load'
from /usr/local/bundle/bin/jekyll:27:in `<main>'
Hey @niko-zvt 👋
I'm assuming you're using bundler? Providing Gemfile
and Gemfile.lock
might be helpful.
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
indicates that you haven't set linux/arm64 as a platform in your Gemfile (I'm guessing that arm64 is your platform). Please take a look at Supported Ruby Versions & Troubleshooting in the README.
@tisba Yes, I use M2 Pro (arm64). This happens after the docker image has been successfully built, but at the time the container is launched.
Dockerfile
—> Base image ruby:3-alpine (linux/amd64).
FROM jekyll/jekyll
RUN apk add --no-cache --virtual .build-deps \
libxml2-dev \
shadow \
autoconf \
g++ \
make \
&& apk add --no-cache imagemagick-dev imagemagick
WORKDIR /srv/jekyll
ADD Gemfile /srv/jekyll/
RUN bundle lock --add-platform universal-darwin-8
RUN bundle install
I tried both with and without the --add-platform universal-darwin-8
flag.
See Gemfile
source 'https://rubygems.org'
group :jekyll_plugins do
gem 'jekyll'
gem 'jekyll-archives', '~> 2.2', '>= 2.2.1'
gem 'jekyll-diagrams'
gem 'jekyll-email-protect'
gem 'jekyll-feed'
gem 'jekyll-imagemagick'
gem 'jekyll-minifier'
gem 'jekyll-paginate-v2'
gem 'jekyll-scholar'
gem 'jekyll-sitemap'
gem 'jekyll-target-blank'
gem 'jekyll-twitter-plugin'
gem 'jemoji'
gem 'kramdown-parser-gfm'
gem 'mini_racer'
gem 'unicode_utils'
gem 'webrick'
end
group :other_plugins do
gem 'httparty'
gem 'feedjira'
end
Gemfile.lock
—> PLATFORMS: x86_64-linux-musl
GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.1.1)
bibtex-ruby (6.0.0)
latex-decode (~> 0.0)
bigdecimal (3.1.4)
citeproc (1.0.10)
namae (~> 1.0)
citeproc-ruby (1.1.14)
citeproc (~> 1.0, >= 1.0.9)
csl (~> 1.6)
colorator (1.1.0)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
crass (1.0.6)
csl (1.6.0)
namae (~> 1.0)
rexml
csl-styles (1.0.1.11)
csl (~> 1.0)
cssminify2 (2.0.1)
drb (2.1.1)
ruby2_keywords
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
execjs (2.9.1)
feedjira (3.2.2)
loofah (>= 2.3.1)
sax-machine (>= 1.0)
ffi (1.16.3)
forwardable-extended (2.6.0)
gemoji (4.1.0)
google-protobuf (3.25.0-x86_64-linux)
html-pipeline (2.14.3)
activesupport (>= 2)
nokogiri (>= 1.4)
htmlcompressor (0.4.0)
http_parser.rb (0.8.0)
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jekyll (4.3.2)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (>= 2.0, < 4.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3, >= 2.3.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (>= 0.3.6, < 0.5)
pathutil (~> 0.9)
rouge (>= 3.0, < 5.0)
safe_yaml (~> 1.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-archives (2.2.1)
jekyll (>= 3.6, < 5.0)
jekyll-diagrams (0.10.0)
jekyll (>= 3.8, < 5.0)
jekyll-email-protect (1.1.0)
jekyll-feed (0.17.0)
jekyll (>= 3.7, < 5.0)
jekyll-imagemagick (1.4.0)
jekyll (>= 3.4)
jekyll-minifier (0.1.10)
cssminify2 (~> 2.0)
htmlcompressor (~> 0.4)
jekyll (>= 3.5)
json-minify (~> 0.0.3)
uglifier (~> 4.1)
jekyll-paginate-v2 (3.0.0)
jekyll (>= 3.0, < 5.0)
jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54)
jekyll-scholar (7.1.3)
bibtex-ruby (~> 6.0)
citeproc-ruby (~> 1.0)
csl-styles (~> 1.0)
jekyll (~> 4.0)
jekyll-sitemap (1.4.0)
jekyll (>= 3.7, < 5.0)
jekyll-target-blank (2.0.2)
jekyll (>= 3.0, < 5.0)
nokogiri (~> 1.10)
jekyll-twitter-plugin (2.1.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
jemoji (0.13.0)
gemoji (>= 3, < 5)
html-pipeline (~> 2.2)
jekyll (>= 3.0, < 5.0)
json (2.6.3)
json-minify (0.0.3)
json (> 0)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
latex-decode (0.4.0)
libv8-node (18.16.0.0-x86_64-linux-musl)
liquid (4.0.4)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.21.4)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mercenary (0.4.0)
mini_mime (1.1.5)
mini_racer (0.8.0)
libv8-node (~> 18.16.0.0)
minitest (5.20.0)
multi_xml (0.6.0)
mutex_m (0.1.2)
namae (1.1.1)
nokogiri (1.15.4-x86_64-linux)
racc (~> 1.4)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (5.0.3)
racc (1.7.2)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.6)
rouge (4.2.0)
ruby2_keywords (0.0.5)
safe_yaml (1.0.5)
sass-embedded (1.69.5-x86_64-linux-musl)
google-protobuf (~> 3.23)
sax-machine (1.3.2)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.5.0)
unicode_utils (1.4.0)
webrick (1.8.1)
PLATFORMS
x86_64-linux-musl
DEPENDENCIES
feedjira
httparty
jekyll
jekyll-archives (~> 2.2, >= 2.2.1)
jekyll-diagrams
jekyll-email-protect
jekyll-feed
jekyll-imagemagick
jekyll-minifier
jekyll-paginate-v2
jekyll-scholar
jekyll-sitemap
jekyll-target-blank
jekyll-twitter-plugin
jemoji
kramdown-parser-gfm
mini_racer
unicode_utils
webrick
BUNDLED WITH
2.3.25
Are you sure you run docker with --platform linux/amd64
to get Rosetta translation? You're on arm64, but jekyll/jekyll
only provides linux/amd64 images.
Your example works on my M1 Pro (Sonoma 14.1) without any warning or errors.
Where do you get the Gemfile.lock from, @niko-zvt? Is that the lock file generated into the docker image?
When I use your Dockerfile 1:1 and diff it against the lockfile you've provided, I get the following diff. It is not surprising, as in the Dockerfile you added universal-darwin-8
as a platform. I build the image with: docker build --platform linux/amd64 .
.
--- /srv/jekyll/Gemfile.lock.issue-295
+++ /srv/jekyll/Gemfile.lock
@@ -45,6 +45,8 @@
ffi (1.16.3)
forwardable-extended (2.6.0)
gemoji (4.1.0)
+ google-protobuf (3.25.0-arm64-darwin)
+ google-protobuf (3.25.0-x86_64-darwin)
google-protobuf (3.25.0-x86_64-linux)
html-pipeline (2.14.3)
activesupport (>= 2)
@@ -116,6 +118,8 @@
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
latex-decode (0.4.0)
+ libv8-node (18.16.0.0-arm64-darwin)
+ libv8-node (18.16.0.0-x86_64-darwin)
libv8-node (18.16.0.0-x86_64-linux-musl)
liquid (4.0.4)
listen (3.8.0)
@@ -132,6 +136,10 @@
multi_xml (0.6.0)
mutex_m (0.1.2)
namae (1.1.1)
+ nokogiri (1.15.4-arm64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.15.4-x86_64-darwin)
+ racc (~> 1.4)
nokogiri (1.15.4-x86_64-linux)
racc (~> 1.4)
pathutil (0.16.2)
@@ -145,6 +153,10 @@
rouge (4.2.0)
ruby2_keywords (0.0.5)
safe_yaml (1.0.5)
+ sass-embedded (1.69.5-arm64-darwin)
+ google-protobuf (~> 3.23)
+ sass-embedded (1.69.5-x86_64-darwin)
+ google-protobuf (~> 3.23)
sass-embedded (1.69.5-x86_64-linux-musl)
google-protobuf (~> 3.23)
sax-machine (1.3.2)
@@ -159,6 +171,7 @@
webrick (1.8.1)
PLATFORMS
+ universal-darwin-8
x86_64-linux-musl
@tisba, Hello! Yes, I generate Gemfile.lock inside docker container.
FROM --platform=linux/amd64 jekyll/jekyll
--add-platform universal-darwin-8
flag.--add-platform ruby
flag.--add-platform x86_64-linux
flag.Input:
docker build -t test-img --platform linux/amd64 .
docker run --rm -v "$PWD:/srv/jekyll/" -p "4000:4000" -it test-img bundler exec jekyll serve --watch --port=4000 —host=0.0.0.0
Output:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
bundler: failed to load command: jekyll (/usr/gem/bin/jekyll)
/usr/gem/gems/mini_racer-0.8.0/lib/mini_racer.rb:14:in `load': Error relocating /usr/gem/extensions/x86_64-linux-musl/3.1.0/mini_racer-0.8.0/mini_racer_extension.so: _ZSt28__throw_bad_array_new_lengthv: symbol not found (LoadError)
from /usr/gem/gems/mini_racer-0.8.0/lib/mini_racer.rb:14:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:60:in `require'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:55:in `each'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:55:in `block in require'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:44:in `each'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:44:in `require'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler.rb:186:in `require'
from /usr/gem/gems/jekyll-4.3.2/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
from /usr/gem/gems/jekyll-4.3.2/exe/jekyll:11:in `<top (required)>'
from /usr/gem/bin/jekyll:25:in `load'
from /usr/gem/bin/jekyll:25:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/cli/exec.rb:58:in `load'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/cli/exec.rb:23:in `run'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/cli.rb:486:in `exec'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/cli.rb:31:in `dispatch'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/cli.rb:25:in `start'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/exe/bundle:48:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/exe/bundle:36:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/exe/bundler:4:in `load'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/exe/bundler:4:in `<top (required)>'
from /usr/local/bin/bundler:25:in `load'
from /usr/local/bin/bundler:25:in `<main>'
You also need to run the container with the correct platform docker run --platform linux/amd64
if you want to use Rosetta and x86 translation (I could have been more clear in https://github.com/rubyjs/mini_racer/issues/295#issuecomment-1790878294). This will remove the warning you're seeing.
But I'm getting the same error now, not sure why I missed that before, sorry.
It's not a general mini racer / alpine issue though. I used the following minimal example to check:
FROM ruby:3.2.2-alpine
RUN apk add musl-dev make g++
I can install and run mini_racer just fine with it (tested with a simple ruby -rmini_racer -e 'puts MiniRacer::Context.new.eval("41+1")'
). bundle install
from your Gemfile also works.
tl;dr
The jekyll image seems quite dated and is based on a 2 year old alpine 3.15. I'm not entirely sure what's going on, but since it's working with alpine 3.18 (what ruby:3.2.2-alpine
is using), I suspect that this might be the cause.
ARM proc are so much fun ...
Hi folks, I'm trying to use mini_racer in an environment in a Alpine LInux Docker container, with Ruby 2.7.2 and Rails 6.1.1. I understand this issue might be related to #63, but bear with me for a second.
When running
bundle install
, this is what I got:The above messages led me to believe that there are in fact prebuilt libraries for this environment and everything would be okay, but when trying to start Rails afterwards...
_ZSt28__throw_bad_array_new_lengthv: symbol not found (LoadError)
:(I can provide the full stack trace if necessary).
Is this a case of mini_racer and/or libv8-node not working in Alpine, or should this setup be working and it's something else? Thanks.