-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Dockerfile: arm64 support #4858
Conversation
Per https://www.terraform.io/cli/install/apt , there is no support for `arm64`. Switching to downloading a .zip for both architectures is preferable to having multiple installation paths.
Flutter includes an amd64 dart-sdk, and doesn't provide an arm64 package. I naively swapped the system dart-sdk into flutter: if it works it will also save some space :crossed-fingers:.
This avoids dealing with the exception: ``` Traceback (most recent call last): 3: from bin/dry-run.rb:76:in `<main>' 2: from bin/dry-run.rb:76:in `require' 1: from /home/dependabot/dependabot-core/omnibus/.bundle/ruby/2.7.0/gems/stackprof-0.2.19/lib/stackprof.rb:1:in `<top (required)>' /home/dependabot/dependabot-core/omnibus/.bundle/ruby/2.7.0/gems/stackprof-0.2.19/lib/stackprof.rb:1:in `require': /home/dependabot/dependabot-core/omnibus/.bundle/ruby/2.7.0/gems/stackprof-0.2.19/lib/stackprof/stackprof.so: undefined symbol: pthread_atfork - /home/dependabot/dependabot-core/omnibus/.bundle/ruby/2.7.0/gems/stackprof-0.2.19/lib/stackprof/stackprof.so (LoadError) ```
This is an easy fix with big implications. It's intending to workaround this error: ``` Traceback (most recent call last): 11: from bin/dry-run.rb:96:in `<main>' 10: from bin/dry-run.rb:96:in `require' 9: from /home/dependabot/dependabot-core/go_modules/lib/dependabot/go_modules.rb:6:in `<top (required)>' 8: from /home/dependabot/dependabot-core/go_modules/lib/dependabot/go_modules.rb:6:in `require' 7: from /home/dependabot/dependabot-core/go_modules/lib/dependabot/go_modules/file_parser.rb:6:in `<top (required)>' 6: from /home/dependabot/dependabot-core/go_modules/lib/dependabot/go_modules/file_parser.rb:6:in `require' 5: from /home/dependabot/dependabot-core/go_modules/lib/dependabot/go_modules/path_converter.rb:4:in `<top (required)>' 4: from /home/dependabot/dependabot-core/go_modules/lib/dependabot/go_modules/path_converter.rb:4:in `require' 3: from /home/dependabot/dependabot-core/omnibus/.bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri.rb:10:in `<top (required)>' 2: from /home/dependabot/dependabot-core/omnibus/.bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri.rb:10:in `require_relative' 1: from /home/dependabot/dependabot-core/omnibus/.bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/extension.rb:7:in `<top (required)>' /home/dependabot/dependabot-core/omnibus/.bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/extension.rb:7:in `require_relative': /lib/aarch64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /home/dependabot/dependabot-core/omnibus/.bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /home/dependabot/dependabot-core/omnibus/.bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so (LoadError) ```
I opened a PR a while back for the Although at this point |
Thanks @thepwagner! Bumping ubuntu seems reasonable to me, although I'd like to roll that out separately, which I might as well do now, and so will. @jeffwidman yeah it's not a bad call, although I kind of don't want to wait even longer, and we should just prioritize rolling that out when it's released. We have a little bit more slack on the team now so we should be able to prioritize this type of work quicker |
Dockerfile
Outdated
@@ -250,6 +260,8 @@ RUN curl --connect-timeout 15 --retry 5 "https://storage.googleapis.com/flutter_ | |||
&& tar xf "/tmp/flutter.xz" -C /opt/dart \ | |||
&& rm "/tmp/flutter.xz" \ | |||
&& chmod -R o+rx "/opt/dart/flutter" \ | |||
&& rm -Rf /opt/dart/flutter/bin/cache/dart-sdk \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about these changes since they seem unrelated to arm support? I think this ends up getting deleted anyway below in the find ... -delete
command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an expert, but it appears flutter ships with a dart-sdk, these 2 lines replace the x86 dart sdk with the arm sdk downloaded in the previous step. I say this because without these 2 lines I get the following error during docker build:
#26 47.08 qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
We could maybe try to conditionally do this substitution only for arm64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everyone is correct 🎉 :
The flutter SDK (even after https://github.com/dependabot/dependabot-core/pull/4904/files), embeds an x86_64
dart sdk:
$ file /opt/flutter/new/flutter/bin/cache/dart-sdk/bin/dart
/opt/flutter/new/flutter/bin/cache/dart-sdk/bin/dart: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, stripped
And the files are deleted by the find, so they aren't part of the final image.
$ docker run --rm dependabot/dependabot-core:latest bash -c "find /opt/dart/flutter/bin/cache/dart-sdk"
find: ‘/opt/dart/flutter/bin/cache/dart-sdk’: No such file or directory
IIUC the issue is L266 where flutter --version
is called before the delete happens - that uses the bundled dart-sdk
and fails, so I ninja-patched the architecture-appropriate dart-sdk
in.
If flutter --version
is just meant to "hello world"/verify the installation, removing that step is an alternative to this hack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If flutter --version is just meant to "hello world"/verify the installation, removing that step is an alternative to this hack.
I think so! When you clone flutter from github the first invocation will create the version
file (that pub relies on) - that is why we did this step, but the packaged flutter contains it already - so I think it can just be removed!
This also allows us to remove the symlink to the arch appropriate dart sdk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Just running it on my old, old non-arm64 laptop to make sure that still works, but assume it will after which I'll merge this in. Thanks @thepwagner! |
Hmm, running into a little snag:
I can dig into that later Edit: @pavera noticed this might be a google thing, getting a similar message on arm |
@jurre I think the issue is with how From In CI, the I'm confident that
I chose 💡 I thought maybe Edit: confirmed and pushed a patch for normalizing Because I broke down and ran the build on two machines, let's go racing! With a clean cache, I clocked:
Bundler still did not work on arm64, with a trace similar to the issue description. |
Yes @thepwagner I also have confirmed that the same error occurs with bundler on amd64 and arm64. The dry run script for bundler expects/requires a lock file in the repo used for testing. I've also confirmed that bundler works on both amd64 and arm64 as long as the repo has a lock file. |
This PR amends the
Dockerfile
andbin/docker-dev-shell
commands to support native builds on arm64, as provided by an M1 Mac.arm64
in CI, or publisharm64
releases.The resulting build stands up OK to light testing: I could dry-run a golang, node and gradle repository.
I hit an error in the bundler that I didn't try to debug: