Skip to content
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

Building linux/amd64 Docker Image on Mac M1 #48420

Closed
cthurston opened this issue Feb 17, 2022 · 25 comments
Closed

Building linux/amd64 Docker Image on Mac M1 #48420

cthurston opened this issue Feb 17, 2022 · 25 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. os-osx

Comments

@cthurston
Copy link

I'm getting this same error with dart 2.16.0 when trying to docker buildx linux/amd64 on a Mac M1.

pubspec.yaml

environment:
  sdk: ">=2.15.0 <3.0.0"

dependencies:
  shelf: ^1.2.0
  shelf_router: ^1.0.0
  shelf_static: ^1.0.0

Dockerfile

FROM dart:stable AS build

WORKDIR /app
COPY pubspec.* ./
RUN dart pub get

Run command (tried from terminal and terminal running with rosetta):
docker buildx build --platform linux/amd64 -t dart_server:v1 .

Error:

#8 1.992 ===== CRASH =====
#8 1.992 si_signo=Segmentation fault(11), si_code=1, si_addr=0x48
#8 1.993 version=2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on "linux_x64"
#8 1.993 pid=9, thread=17, isolate_group=dartdev(0x4002f9d000), isolate=dartdev(0x4002f9d800)
#8 1.993 isolate_instructions=ffffaf233000, vm_instructions=4001e1b540
#8 1.993   pc 0x0000ffffaf014320 fp 0x0000004009a7ccc0 Unknown symbol
#8 1.996   pc 0x0000004001f97fbd fp 0x0000004009a7daa0 dart::DartEntry::InvokeCode(dart::Code const&, unsigned long, dart::Array const&, dart::Array const&, dart::Thread*)+0x14d
#8 1.996   pc 0x0000004001f97dfc fp 0x0000004009a7db00 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)+0x14c
#8 1.997   pc 0x0000004001f9a20f fp 0x0000004009a7db50 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&)+0x16f
#8 1.997   pc 0x0000004001fc1085 fp 0x0000004009a7dc30 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >)+0x375
#8 1.998   pc 0x0000004001fe914c fp 0x0000004009a7dca0 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)+0x14c
#8 1.998   pc 0x0000004001fe984f fp 0x0000004009a7dcf0 dart::MessageHandler::TaskCallback()+0x1df
#8 1.998   pc 0x0000004002103678 fp 0x0000004009a7dd80 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*)+0x138
#8 1.999   pc 0x0000004002103b0c fp 0x0000004009a7ddb0 dart::ThreadPool::Worker::Main(unsigned long)+0x5c
#8 1.999   pc 0x000000400207c9e8 fp 0x0000004009a7de70 /usr/lib/dart/bin/dart+0x207c9e8
#8 1.999 -- End of DumpStackTrace
#8 2.000 qemu: uncaught target signal 6 (Aborted) - core dumped
#8 2.013 Aborted

Note: It does successfully build as arm using docker build.

@lrhn lrhn added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. os-ios labels Feb 18, 2022
@tale
Copy link

tale commented Apr 3, 2022

Any new information on this?

@brunosemfio
Copy link

same error

@a-siva a-siva added os-osx and removed os-ios labels May 12, 2022
@khoa-io
Copy link

khoa-io commented May 25, 2022

I got a similar error when trying to build a linux/arm/v7 container using GitHub Actions:

#53 [linux/arm/v7 11/21] RUN dart pub get
2022-05-25T20:10:37.2717185Z #0 0.191 ../../runtime/vm/cpu_arm.cc: 163: error: Unrecognized ARM CPU architecture.
2022-05-25T20:10:37.2717530Z #0 0.193 version=2.17.0 (stable) (Mon May 9 10:36:47 2022 +0200) on "linux_arm"
2022-05-25T20:10:37.2717852Z #0 0.193 pid=7, thread=7, isolate_group=(nil)((nil)), isolate=(nil)((nil))
2022-05-25T20:10:37.2718356Z #0 0.193 isolate_instructions=0, vm_instructions=0
2022-05-25T20:10:37.2733883Z #0 0.197   pc 0x41dd4929 fp 0x3ffffac0 dart::Profiler::DumpStackTrace(void*)+0x4c
2022-05-25T20:10:37.2734311Z #0 0.199   pc 0x41c6176f fp 0x3ffffad0 dart::Assert::Fail(char const*, ...) const+0x1e
2022-05-25T20:10:37.2734657Z #0 0.200   pc 0x41d27df1 fp 0x3ffffaf8 dart::HostCPUFeatures::Init()+0x140
2022-05-25T20:10:37.2735032Z #0 0.201   pc 0x41d2826f fp 0x3ffffbe0 dart::Dart::DartInit(Dart_InitializeParams const*)+0x1d6
2022-05-25T20:10:37.2735412Z #0 0.201   pc 0x41d28707 fp 0x3ffffbf8 dart::Dart::Init(Dart_InitializeParams const*)+0x3e
2022-05-25T20:10:37.2735753Z #0 0.202   pc 0x41c49815 fp 0x3ffffca8 dart::bin::main(int, char**)+0x2e4
2022-05-25T20:10:37.2736267Z #0 0.204   pc 0x41c4a4cd fp 0x3ffffcb0 dart+0x1c4a4cd
2022-05-25T20:10:37.2736770Z #0 0.204 -- End of DumpStackTrace
2022-05-25T20:10:37.5721032Z #53 0.514 Aborted (core dumped)
2022-05-25T20:10:37.6087289Z #53 ERROR: process "/bin/sh -c dart pub get" did not complete successfully: exit code: 134
2022-05-25T20:10:37.6087803Z 
2022-05-25T20:10:37.6088008Z #47 [linux/arm64 11/21] RUN dart pub get
2022-05-25T20:10:37.6088328Z #47 CANCELED
2022-05-25T20:10:37.6088554Z ------
2022-05-25T20:10:37.6088752Z  > [linux/arm/v7 11/21] RUN dart pub get:
2022-05-25T20:10:37.6089121Z #0 0.193 isolate_instructions=0, vm_instructions=0
2022-05-25T20:10:37.6089479Z #0 0.197   pc 0x41dd4929 fp 0x3ffffac0 dart::Profiler::DumpStackTrace(void*)+0x4c
2022-05-25T20:10:37.6089838Z #0 0.199   pc 0x41c6176f fp 0x3ffffad0 dart::Assert::Fail(char const*, ...) const+0x1e
2022-05-25T20:10:37.6090182Z #0 0.200   pc 0x41d27df1 fp 0x3ffffaf8 dart::HostCPUFeatures::Init()+0x140
2022-05-25T20:10:37.6090658Z #0 0.201   pc 0x41d2826f fp 0x3ffffbe0 dart::Dart::DartInit(Dart_InitializeParams const*)+0x1d6
2022-05-25T20:10:37.6091164Z #0 0.201   pc 0x41d28707 fp 0x3ffffbf8 dart::Dart::Init(Dart_InitializeParams const*)+0x3e
2022-05-25T20:10:37.6091502Z #0 0.202   pc 0x41c49815 fp 0x3ffffca8 dart::bin::main(int, char**)+0x2e4
2022-05-25T20:10:37.6091806Z #0 0.204   pc 0x41c4a4cd fp 0x3ffffcb0 dart+0x1c4a4cd
2022-05-25T20:10:37.6092128Z #0 0.204 -- End of DumpStackTrace
2022-05-25T20:10:37.6092354Z #53 0.514 Aborted (core dumped)
2022-05-25T20:10:37.6092586Z ------
2022-05-25T20:10:37.6106434Z Dockerfile:23
2022-05-25T20:10:37.6173364Z --------------------
2022-05-25T20:10:37.6173630Z   21 |     COPY . /source
2022-05-25T20:10:37.6177086Z   22 |     WORKDIR /source
2022-05-25T20:10:37.6177945Z   23 | >>> RUN dart pub get
2022-05-25T20:10:37.6178870Z   24 |     RUN dart compile exe bin/git_lfs_server.dart --output /usr/local/bin/git-lfs-server
2022-05-25T20:10:37.6180610Z   25 |     RUN dart compile exe bin/git_lfs_authenticate.dart --output /usr/local/bin/git-lfs-authenticate
2022-05-25T20:10:37.6181187Z --------------------
2022-05-25T20:10:37.6181755Z error: failed to solve: process "/bin/sh -c dart pub get" did not complete successfully: exit code: 134

Full logs here.

@FireJuun
Copy link

Same issue, this time on dart version 2.17.5. As with above, the RUN dart pub get command in my Dockerfile is the proximate cause of this failure.

#0 1.089 Resolving dependencies...
#0 1.119
#0 1.119 ===== CRASH =====
#0 1.119 si_signo=Segmentation fault(11), si_code=1, si_addr=0x808080808080809f
#0 1.119 version=2.17.5 (stable) (Tue Jun 21 11:05:10 2022 +0200) on "linux_x64"
#0 1.119 pid=9, thread=17, isolate_group=dartdev(0x400306d000), isolate=dartdev(0x400306d800)
#0 1.119 isolate_instructions=ffffa9981000, vm_instructions=4001ee5460
#0 1.120   pc 0x0000ffffa9b04739 fp 0x0000004009c889b8 Unknown symbol
#0 1.120   pc 0x0000ffffa977e866 fp 0x0000004009c88a10 Unknown symbol
#0 1.120   pc 0x0000ffffa977e705 fp 0x0000004009c88a50 Unknown symbol
#0 1.120   pc 0x0000ffffa977cc2b fp 0x0000004009c88ac0 Unknown symbol
#0 1.120   pc 0x0000ffffa977c485 fp 0x0000004009c88b18 Unknown symbol
#0 1.120   pc 0x0000ffffa977c300 fp 0x0000004009c88b50 Unknown symbol
#0 1.120   pc 0x0000ffffa977b9e4 fp 0x0000004009c88bb0 Unknown symbol
#0 1.120   pc 0x0000ffffa977b63c fp 0x0000004009c88c20 Unknown symbol
#0 1.120   pc 0x0000ffffa977b4d1 fp 0x0000004009c88c80 Unknown symbol
#0 1.120   pc 0x0000ffffa976e9d8 fp 0x0000004009c88cd0 Unknown symbol
#0 1.120   pc 0x0000ffffa97690ea fp 0x0000004009c88d48 Unknown symbol
#0 1.120   pc 0x0000ffffa97689ff fp 0x0000004009c88e10 Unknown symbol
#0 1.120   pc 0x0000ffffa9730a35 fp 0x0000004009c88e98 Unknown symbol
#0 1.120   pc 0x0000ffffa9730641 fp 0x0000004009c88ee8 Unknown symbol
#0 1.120   pc 0x0000ffffa9730180 fp 0x0000004009c88f48 Unknown symbol
#0 1.120   pc 0x0000ffffa972ff1d fp 0x0000004009c88fa0 Unknown symbol
#0 1.120   pc 0x0000ffffa9a1c045 fp 0x0000004009c89010 Unknown symbol
#0 1.120   pc 0x0000ffffa972fb88 fp 0x0000004009c89060 Unknown symbol
#0 1.120   pc 0x0000ffffa972f961 fp 0x0000004009c890d0 Unknown symbol
#0 1.120   pc 0x0000ffffa972f6c9 fp 0x0000004009c89130 Unknown symbol
#0 1.120   pc 0x0000ffffa972efd3 fp 0x0000004009c891c0 Unknown symbol
#0 1.120   pc 0x0000ffffa9729e2d fp 0x0000004009c89210 Unknown symbol
#0 1.120   pc 0x0000ffffa9728716 fp 0x0000004009c892c8 Unknown symbol
#0 1.120   pc 0x0000ffffa97281e7 fp 0x0000004009c89340 Unknown symbol
#0 1.120   pc 0x0000ffffa971cf04 fp 0x0000004009c893d0 Unknown symbol
#0 1.120   pc 0x0000ffffa9717a95 fp 0x0000004009c89420 Unknown symbol
#0 1.120   pc 0x0000ffffa9a20cbb fp 0x0000004009c89488 Unknown symbol
#0 1.120   pc 0x0000ffffa9a1cf5e fp 0x0000004009c894d8 Unknown symbol
#0 1.120   pc 0x0000ffffa9a233b3 fp 0x0000004009c89568 Unknown symbol
#0 1.120   pc 0x0000ffffa9a1c958 fp 0x0000004009c895b8 Unknown symbol
#0 1.120   pc 0x0000ffffa9a24e2b fp 0x0000004009c895f8 Unknown symbol
#0 1.120   pc 0x0000ffffa9a1c045 fp 0x0000004009c89668 Unknown symbol
#0 1.120   pc 0x0000ffffa9a1c46b fp 0x0000004009c896a8 Unknown symbol
#0 1.120   pc 0x0000ffffa9a26fee fp 0x0000004009c89710 Unknown symbol
#0 1.120   pc 0x0000ffffa9a1bf04 fp 0x0000004009c89758 Unknown symbol
#0 1.120   pc 0x0000ffffa9a30eb7 fp 0x0000004009c897b8 Unknown symbol
#0 1.120   pc 0x0000ffffa9a313ec fp 0x0000004009c897f8 Unknown symbol
#0 1.120   pc 0x0000ffffa9a314cf fp 0x0000004009c89830 Unknown symbol
#0 1.120   pc 0x0000ffffa9a302ff fp 0x0000004009c898a0 Unknown symbol
#0 1.120   pc 0x0000ffffa9a304b3 fp 0x0000004009c898e0 Unknown symbol
#0 1.120   pc 0x0000ffffa9a31cdc fp 0x0000004009c89948 Unknown symbol
#0 1.120   pc 0x0000ffffa9a31ea3 fp 0x0000004009c89998 Unknown symbol
#0 1.120   pc 0x0000ffffa9b02a0c fp 0x0000004009c89a10 Unknown symbol
#0 1.122   pc 0x000000400205db5d fp 0x0000004009c89ab0 dart::DartEntry::InvokeCode(dart::Code const&, unsigned long, dart::Array const&, dart::Array const&, dart::Thread*)+0x14d
#0 1.122   pc 0x000000400205d99c fp 0x0000004009c89b10 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)+0x14c
#0 1.122   pc 0x000000400205fd6c fp 0x0000004009c89b60 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&)+0x14c
#0 1.123   pc 0x00000040020866ac fp 0x0000004009c89c40 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >)+0x33c
#0 1.123   pc 0x00000040020af54d fp 0x0000004009c89cb0 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)+0x14d
#0 1.124   pc 0x00000040020afc2f fp 0x0000004009c89d00 dart::MessageHandler::TaskCallback()+0x1df
#0 1.124   pc 0x00000040021d10b8 fp 0x0000004009c89d80 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*)+0x148
#0 1.124   pc 0x00000040021d150d fp 0x0000004009c89db0 dart::ThreadPool::Worker::Main(unsigned long)+0x6d
#0 1.125   pc 0x0000004002146368 fp 0x0000004009c89e70 dart+0x2146368
#0 1.125 -- End of DumpStackTrace
#0 1.125 qemu: uncaught target signal 6 (Aborted) - core dumped
#0 1.135 Aborted
------
Dockerfile:9
--------------------
   7 |     WORKDIR /app
   8 |     COPY pubspec.* ./
   9 | >>> RUN dart pub get
  10 |
  11 |     # Copy app source code and AOT compile it.
--------------------
error: failed to solve: process "/bin/sh -c dart pub get" did not complete successfully: exit code: 134

@rebaz94
Copy link

rebaz94 commented Aug 11, 2022

@mraleph Is there is any solution to this?

getting same error

#12 1.270 ===== CRASH =====
#12 1.270 si_signo=Segmentation fault(11), si_code=1, si_addr=0x808080808080809f
#12 1.270 version=2.17.6 (stable) (Tue Jul 12 12:54:37 2022 +0200) on "linux_x64"
#12 1.270 pid=9, thread=17, isolate_group=dartdev(0x400306d000), isolate=dartdev(0x400306d800)
#12 1.270 isolate_instructions=ffff95221000, vm_instructions=4001ee5460
#12 1.271   pc 0x0000ffff95384739 fp 0x0000004009c8b9b8 Unknown symbol
#12 1.271   pc 0x0000ffff9507e866 fp 0x0000004009c8ba10 Unknown symbol
#12 1.271   pc 0x0000ffff9507e705 fp 0x0000004009c8ba50 Unknown symbol
#12 1.271   pc 0x0000ffff9507cc2b fp 0x0000004009c8bac0 Unknown symbol
#12 1.271   pc 0x0000ffff9507c485 fp 0x0000004009c8bb18 Unknown symbol
#12 1.271   pc 0x0000ffff9507c300 fp 0x0000004009c8bb50 Unknown symbol
#12 1.271   pc 0x0000ffff9507b9e4 fp 0x0000004009c8bbb0 Unknown symbol
#12 1.271   pc 0x0000ffff9507b63c fp 0x0000004009c8bc20 Unknown symbol
#12 1.271   pc 0x0000ffff9507b4d1 fp 0x0000004009c8bc80 Unknown symbol
#12 1.271   pc 0x0000ffff9506e9d8 fp 0x0000004009c8bcd0 Unknown symbol
#12 1.271   pc 0x0000ffff950690ea fp 0x0000004009c8bd48 Unknown symbol
#12 1.271   pc 0x0000ffff950689ff fp 0x0000004009c8be10 Unknown symbol
#12 1.271   pc 0x0000ffff95030a35 fp 0x0000004009c8be98 Unknown symbol
#12 1.271   pc 0x0000ffff95030641 fp 0x0000004009c8bee8 Unknown symbol
#12 1.271   pc 0x0000ffff95030180 fp 0x0000004009c8bf48 Unknown symbol
#12 1.271   pc 0x0000ffff9502ff1d fp 0x0000004009c8bfa0 Unknown symbol
#12 1.271   pc 0x0000ffff952bc045 fp 0x0000004009c8c010 Unknown symbol
#12 1.271   pc 0x0000ffff9502fb88 fp 0x0000004009c8c060 Unknown symbol
#12 1.271   pc 0x0000ffff9502f961 fp 0x0000004009c8c0d0 Unknown symbol
#12 1.271   pc 0x0000ffff9502f6c9 fp 0x0000004009c8c130 Unknown symbol
#12 1.271   pc 0x0000ffff9502efd3 fp 0x0000004009c8c1c0 Unknown symbol
#12 1.271   pc 0x0000ffff95029e2d fp 0x0000004009c8c210 Unknown symbol
#12 1.271   pc 0x0000ffff95028716 fp 0x0000004009c8c2c8 Unknown symbol
#12 1.271   pc 0x0000ffff950281e7 fp 0x0000004009c8c340 Unknown symbol
#12 1.271   pc 0x0000ffff9501cf04 fp 0x0000004009c8c3d0 Unknown symbol
#12 1.271   pc 0x0000ffff95017a95 fp 0x0000004009c8c420 Unknown symbol
#12 1.271   pc 0x0000ffff952c0cbb fp 0x0000004009c8c488 Unknown symbol
#12 1.271   pc 0x0000ffff952bcf5e fp 0x0000004009c8c4d8 Unknown symbol
#12 1.271   pc 0x0000ffff952c33b3 fp 0x0000004009c8c568 Unknown symbol
#12 1.271   pc 0x0000ffff952bc958 fp 0x0000004009c8c5b8 Unknown symbol
#12 1.271   pc 0x0000ffff952c4e2b fp 0x0000004009c8c5f8 Unknown symbol
#12 1.271   pc 0x0000ffff952bc045 fp 0x0000004009c8c668 Unknown symbol
#12 1.271   pc 0x0000ffff952bc46b fp 0x0000004009c8c6a8 Unknown symbol
#12 1.271   pc 0x0000ffff952c6fee fp 0x0000004009c8c710 Unknown symbol
#12 1.271   pc 0x0000ffff952bbf04 fp 0x0000004009c8c758 Unknown symbol
#12 1.271   pc 0x0000ffff952d0eb7 fp 0x0000004009c8c7b8 Unknown symbol
#12 1.271   pc 0x0000ffff952d13ec fp 0x0000004009c8c7f8 Unknown symbol
#12 1.271   pc 0x0000ffff952d14cf fp 0x0000004009c8c830 Unknown symbol
#12 1.271   pc 0x0000ffff952d02ff fp 0x0000004009c8c8a0 Unknown symbol
#12 1.271   pc 0x0000ffff952d04b3 fp 0x0000004009c8c8e0 Unknown symbol
#12 1.271   pc 0x0000ffff952d1cdc fp 0x0000004009c8c948 Unknown symbol
#12 1.271   pc 0x0000ffff952d1ea3 fp 0x0000004009c8c998 Unknown symbol
#12 1.271   pc 0x0000ffff95382a0c fp 0x0000004009c8ca10 Unknown symbol
#12 1.273   pc 0x000000400205db5d fp 0x0000004009c8cab0 dart::DartEntry::InvokeCode(dart::Code const&, unsigned long, dart::Array const&, dart::Array const&, dart::Thread*)+0x14d
#12 1.273   pc 0x000000400205d99c fp 0x0000004009c8cb10 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)+0x14c
#12 1.274   pc 0x000000400205fd6c fp 0x0000004009c8cb60 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&)+0x14c
#12 1.274   pc 0x00000040020866ac fp 0x0000004009c8cc40 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >)+0x33c
#12 1.274   pc 0x00000040020af54d fp 0x0000004009c8ccb0 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)+0x14d
#12 1.275   pc 0x00000040020afc2f fp 0x0000004009c8cd00 dart::MessageHandler::TaskCallback()+0x1df
#12 1.275   pc 0x00000040021d10b8 fp 0x0000004009c8cd80 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*)+0x148
#12 1.275   pc 0x00000040021d150d fp 0x0000004009c8cdb0 dart::ThreadPool::Worker::Main(unsigned long)+0x6d
#12 1.276   pc 0x0000004002146368 fp 0x0000004009c8ce70 dart+0x2146368
#12 1.276 -- End of DumpStackTrace
#12 1.276 qemu: uncaught target signal 6 (Aborted) - core dumped
#12 1.287 Aborted
------
executor failed running [/bin/sh -c dart pub get]: exit code: 134

@mraleph
Copy link
Member

mraleph commented Aug 12, 2022

My best guess would be that something is wrong when Dart is running under QEMU (e.g. qemu contains some bug which causes incorrect interpretation). I have experimented a bit with latest QEMU (built from their HEAD) as well as QEMU 7.0.0 and in both cases Dart SDK seems to work okay.

I could not figure out which QEMU version Docker uses - it might be outdated. In general they have the following to say:

However, attempts to run Intel-based containers on Apple silicon machines under emulation can crash as qemu sometimes fails to run the container. In addition, filesystem change notification APIs (inotify) do not work under qemu emulation. Even when the containers do run correctly under emulation, they will be slower and use more memory than the native equivalent.

In summary, running Intel-based containers on Arm-based machines should be regarded as “best effort” only

In summary I think your best bet is either to debug the crash yourself if you can reproduce it or report this issue to Docker and see if they can provide some explanation.

I don't think there is much we can do here.

@rebaz94
Copy link

rebaz94 commented Aug 12, 2022

In my case the official dart works without any problem FROM dart:stable AS build

but when I change to something like debian:11.4 it crash

@sasascekic
Copy link

same error when trying to build image on MacBook M1 by running the command: docker buildx build --platform linux/amd64

It would be great if someone fixed this issue :)

 > [build 4/6] RUN dart pub get:
#0 1.105 
#0 1.105 ===== CRASH =====
#0 1.105 si_signo=Segmentation fault(11), si_code=1, si_addr=0x808080808080809f
#0 1.105 version=2.18.6 (stable) (Tue Dec 13 21:15:14 2022 +0000) on "linux_x64"
#0 1.105 pid=8, thread=17, isolate_group=dartdev(0x4003063000), isolate=dartdev(0x40030ca000)
#0 1.105 isolate_instructions=ffffb1676000, vm_instructions=4001ed1580
#0 1.106   pc 0x0000ffffb1804789 fp 0x0000004009dac9c8 Unknown symbol
#0 1.106   pc 0x0000ffffb1471ec5 fp 0x0000004009daca08 Unknown symbol
#0 1.106   pc 0x0000ffffb146cd46 fp 0x0000004009dacaf8 Unknown symbol
#0 1.106   pc 0x0000ffffb14351ce fp 0x0000004009dacb78 Unknown symbol
#0 1.106   pc 0x0000ffffb1434eb3 fp 0x0000004009dacbc0 Unknown symbol
#0 1.106   pc 0x0000ffffb1708af5 fp 0x0000004009dacc30 Unknown symbol
#0 1.106   pc 0x0000ffffb1434d18 fp 0x0000004009dacc80 Unknown symbol
#0 1.106   pc 0x0000ffffb1434af1 fp 0x0000004009daccf0 Unknown symbol
#0 1.106   pc 0x0000ffffb1434859 fp 0x0000004009dacd50 Unknown symbol
#0 1.106   pc 0x0000ffffb1434163 fp 0x0000004009dacde0 Unknown symbol
#0 1.106   pc 0x0000ffffb142eead fp 0x0000004009dace30 Unknown symbol
#0 1.106   pc 0x0000ffffb142d936 fp 0x0000004009dacee8 Unknown symbol
#0 1.106   pc 0x0000ffffb142d407 fp 0x0000004009dacf60 Unknown symbol
#0 1.106   pc 0x0000ffffb14210ca fp 0x0000004009dad020 Unknown symbol
#0 1.106   pc 0x0000ffffb170d099 fp 0x0000004009dad0a8 Unknown symbol
#0 1.106   pc 0x0000ffffb170f366 fp 0x0000004009dad178 Unknown symbol
#0 1.106   pc 0x0000ffffb171073b fp 0x0000004009dad1b8 Unknown symbol
#0 1.106   pc 0x0000ffffb1708af5 fp 0x0000004009dad228 Unknown symbol
#0 1.106   pc 0x0000ffffb1708f1b fp 0x0000004009dad268 Unknown symbol
#0 1.106   pc 0x0000ffffb17126a3 fp 0x0000004009dad2f8 Unknown symbol
#0 1.106   pc 0x0000ffffb171e2ab fp 0x0000004009dad348 Unknown symbol
#0 1.106   pc 0x0000ffffb171e37f fp 0x0000004009dad380 Unknown symbol
#0 1.106   pc 0x0000ffffb171cf72 fp 0x0000004009dad3f0 Unknown symbol
#0 1.106   pc 0x0000ffffb171d123 fp 0x0000004009dad430 Unknown symbol
#0 1.106   pc 0x0000ffffb171eb8f fp 0x0000004009dad498 Unknown symbol
#0 1.106   pc 0x0000ffffb171ed53 fp 0x0000004009dad4e8 Unknown symbol
#0 1.106   pc 0x0000ffffb1802a0c fp 0x0000004009dad560 Unknown symbol
#0 1.108   pc 0x000000400204973d fp 0x0000004009dad600 dart::DartEntry::InvokeCode(dart::Code const&, unsigned long, dart::Array const&, dart::Array const&, dart::Thread*)+0x14d
#0 1.108   pc 0x000000400204957c fp 0x0000004009dad660 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)+0x14c
#0 1.108   pc 0x000000400204b9ac fp 0x0000004009dad6b0 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&)+0x14c
#0 1.109   pc 0x0000004002073070 fp 0x0000004009dadc40 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >)+0x350
#0 1.109   pc 0x000000400209c59d fp 0x0000004009dadcb0 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)+0x14d
#0 1.109   pc 0x000000400209cc7f fp 0x0000004009dadd00 dart::MessageHandler::TaskCallback()+0x1df
#0 1.110   pc 0x00000040021bf6b8 fp 0x0000004009dadd80 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*)+0x148
#0 1.110   pc 0x00000040021bfb0d fp 0x0000004009daddb0 dart::ThreadPool::Worker::Main(unsigned long)+0x6d
#0 1.111   pc 0x0000004002132758 fp 0x0000004009dade70 dart+0x2132758
#0 1.111 -- End of DumpStackTrace
#0 1.111 qemu: uncaught target signal 6 (Aborted) - core dumped
#0 1.124 Aborted
------
ERROR: failed to solve: executor failed running [/bin/sh -c dart pub get]: exit code: 134

@MohammadSharafi
Copy link

this worked for me :
RUN dpkg --print-architecture
RUN dpkg --print-foreign-architectures
RUN dpkg --remove --force-depends libstdc++6-arm64-cross
RUN apt-get install --reinstall libstdc++6
RUN apt-get -f install
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6-arm64-cross libglu1-mesa fonts-droid-fallback libstdc++6-arm64-cross python3 sed
RUN apt-get clean

@jamiegau
Copy link

jamiegau commented Feb 9, 2023

Any movement here...
MacbookPro died go purchased a new one, and now I am stuffed as I can no longer build...
It works fine if a build is done on a native linux/amd64 computer, but on my Mac M2,

Following are three attempts to build an image, each time it dies randomly.

.
#43 396.2 libtool: compile:  g++ "-DPACKAGE_NAME=\"asdcplib\"" "-DPACKAGE_TARNAME=\"asdcplib\"" "-DPACKAGE_VERSION=\"2.12.4\"" "-DPACKAGE_STRING=\"asdcplib 2.12.4\"" "-DPACKAGE_BUGREPORT=\"asdcplib@cinecert.com\"" "-DPACKAGE_URL=\"\"" "-DPACKAGE=\"asdcplib\"" "-DVERSION=\"2.12.4\"" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 "-DLT_OBJDIR=\".libs/\"" -DHAVE_LIBPTHREAD=1 -I. "-DASDCP_PLATFORM=\"x86_64-pc-linux-musl\"" -I/usr/include -DHAVE_OPENSSL=1 -g -O2 -MT libasdcp_la-AtmosSyncChannel_Mixer.lo -MD -MP -MF .deps/libasdcp_la-AtmosSyncChannel_Mixer.Tpo -c AtmosSyncChannel_Mixer.cpp  -fPIC -DPIC -o .libs/libasdcp_la-AtmosSyncChannel_Mixer.o
#43 396.3 g++: internal compiler error: Segmentation fault signal terminated program cc1plus
#43 396.3 Please submit a full bug report, with preprocessed source (by using -freport-bug).
#43 396.3 See <https://gitlab.alpinelinux.org/alpine/aports/-/issues> for instructions.
#43 396.3 make[1]: *** [Makefile:1751: libasdcp_la-AtmosSyncChannel_Mixer.lo] Error 1
#43 396.3 make[1]: Leaving directory '/asdcplib/asdcplib/src'
#43 396.3 make: *** [Makefile:429: all-recursive] Error 1
------
failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c make" did not complete successfully: exit code: 2

.

#43 244.1 libtool: compile:  g++ "-DPACKAGE_NAME=\"asdcplib\"" "-DPACKAGE_TARNAME=\"asdcplib\"" "-DPACKAGE_VERSION=\"2.12.4\"" "-DPACKAGE_STRING=\"asdcplib 2.12.4\"" "-DPACKAGE_BUGREPORT=\"asdcplib@cinecert.com\"" "-DPACKAGE_URL=\"\"" "-DPACKAGE=\"asdcplib\"" "-DVERSION=\"2.12.4\"" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 "-DLT_OBJDIR=\".libs/\"" -DHAVE_LIBPTHREAD=1 -I. "-DASDCP_PLATFORM=\"x86_64-pc-linux-musl\"" -I/usr/include -DHAVE_OPENSSL=1 -g -O2 -MT libasdcp_la-h__Reader.lo -MD -MP -MF .deps/libasdcp_la-h__Reader.Tpo -c h__Reader.cpp -o libasdcp_la-h__Reader.o >/dev/null 2>&1
#43 244.1 make[1]: *** [Makefile:1660: libasdcp_la-h__Reader.lo] Error 1
#43 244.1 make[1]: Leaving directory '/asdcplib/asdcplib/src'
#43 244.1 make: *** [Makefile:429: all-recursive] Error 1
------
failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c make" did not complete successfully: exit code: 2

.

#43 416.4 libtool: compile:  g++ "-DPACKAGE_NAME=\"asdcplib\"" "-DPACKAGE_TARNAME=\"asdcplib\"" "-DPACKAGE_VERSION=\"2.12.4\"" "-DPACKAGE_STRING=\"asdcplib 2.12.4\"" "-DPACKAGE_BUGREPORT=\"asdcplib@cinecert.com\"" "-DPACKAGE_URL=\"\"" "-DPACKAGE=\"asdcplib\"" "-DVERSION=\"2.12.4\"" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 "-DLT_OBJDIR=\".libs/\"" -DHAVE_LIBPTHREAD=1 -I. "-DASDCP_PLATFORM=\"x86_64-pc-linux-musl\"" -I/usr/include -DHAVE_OPENSSL=1 -g -O2 -MT libasdcp_la-CRC16.lo -MD -MP -MF .deps/libasdcp_la-CRC16.Tpo -c CRC16.cpp  -fPIC -DPIC -o .libs/libasdcp_la-CRC16.o
#43 416.4 Segmentation fault
#43 416.4 make[1]: *** [Makefile:1772: libasdcp_la-CRC16.lo] Error 1
#43 416.4 make[1]: Leaving directory '/asdcplib/asdcplib/src'
#43 416.4 make: *** [Makefile:429: all-recursive] Error 1
------
failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c make" did not complete successfully: exit code: 2


It also happens in Random locations... And ONCE it made it all the way through. I did it once in quite a few attempts, but I have not been able to do it again.

I am surprised this isn't getting more attention. It makes docker utterly useless on an ARM for building images for common target linux/adm64 targets..

@mraleph
Copy link
Member

mraleph commented Feb 9, 2023

@jamiegau You are asking in the wrong place. You have things like g++ crashing. Why do you expect to get support for this here?

Reality is that this is a Docker bug most likely connected to qemu.

@jamiegau
Copy link

jamiegau commented Feb 9, 2023

@mraleph sorry, it was 2am. As it looked like a similar, random compiler crash, dart, g++. Seems all to revolve around the same problem. Still, same point. ARM/M1/M2 and building containers with dart would be broken for Dart developers too. Until this is fixed. Otherwise, I'll look for insight elsewhere.

@sasascekic
Copy link

@mraleph sorry, it was 2am. As it looked like a similar, random compiler crash, dart, g++. Seems all to revolve around the same problem. Still, same point. ARM/M1/M2 and building containers with dart would be broken for Dart developers too. Until this is fixed. Otherwise, I'll look for insight elsewhere.

It's a pity that this is not solved yet - need to lug around my amd64 computer together with macbook - just to be able to build docker image based on dart shelf and deploy it to my server...

@mraleph
Copy link
Member

mraleph commented Feb 9, 2023

@sasascekic did you report it to Docker? Did they investigate? Because it's a Docker's problem - not Dart's.

@jamiegau
Copy link

jamiegau commented Feb 9, 2023

Its morning, I am looking at the problem in a new light. I completely deleted all docker images etc. Just in case there was a conflict with the combining of how I initially compiled it (unknowing it defaults to ARM) and then switchng over to targeting amd64, and cache files may have been an issue. It got further after I did this but I need to do a number of builds from scratch test runs. May have been lucky. Do some more googling to see if others have a similar issue that may lead to an already existing open issue etc.

For example, it got past a tool I compile into the image, but now its getting reliably stuck on installing the requirements file. Its now getting stuck on a pip requirements.. this error seems reliable, but again, does not exist if I build under amd64 computers. Its all so random etc. I'll have to do more investigation I feel.

@sasascekic
Copy link

@sasascekic did you report it to Docker? Did they investigate? Because it's a Docker's problem - not Dart's.
Nope. Googled the issue once I've faced it for the first time and that brought me to this discussion (it was most prominent one).

Don't know did they investigate - but I'm quite sure that they are aware of the problem. I mean, we are not taking about building Fortran here 😀

Btw how are you so sure that this is not a combination of dart-docker issue?

@mraleph
Copy link
Member

mraleph commented Feb 10, 2023

Btw how are you so sure that this is not a combination of dart-docker issue?

I can't be 100% sure, but here are the data points:

  • we are not seeing this sort of crashes on real hardware (be it native X64 or M1 Macs) or on Docker natively running on X64 natively
  • other projects / binaries see random crashes on X64 Docker emulated on M1 Arm (node crashing, erlang crashing, gcc crashing)

This strongly indicates that something is wrong in the way that Docker+QEMU are working - rather than that all of these completely unrelated projects are somehow wrong.

I don't have an access to Docker on Mac - so even if I were tempted to get to the bottom of this out of morbid curiosity, I can't really investigate it. I have tried reproducing things by running Linux in QEMU but that did not get me anywhere. Things run just fine on the newest QEMU builds.

@sasascekic
Copy link

I don't have an access to Docker on Mac - so even if I were tempted to get to the bottom of this out of morbid curiosity, I can't really investigate it. I have tried reproducing things by running Linux in QEMU but that did not get me anywhere. Things run just fine on the newest QEMU builds.

Ok, thanks - it sounds like a reasonable approach.

I tried building in Ubuntu running on Parallels - but the same issue there. Probably because the same underlying issue is there...

@kareem399
Copy link

i'm getting the same issue on pub get
any updates?

@jamiegau
Copy link

jamiegau commented Mar 3, 2023

Just a note on this.
To get around this issue, I decided to implement CI/CD on GitHub and GitLab systems I use. I created a running to compile the projects for creating my docker images in my registry. Triggers deployment etc.
Works quite well really, and works great if you are on a slow link as you not pushing images up. Just the code.

@UliPrantz
Copy link

With the available Docker images for ubuntu arm64 it seems like it's at least possible to compile flutter web apps. That would probably also mean with that container it could be possible to compile/run dart apps too. I just found this https://stackoverflow.com/a/75668217/8736883 when I faced the same problem. Maybe it helps.

@ZeroHans4
Copy link

Same proble. Any resolution for this?

@UliPrantz
Copy link

UliPrantz commented Aug 24, 2023

@ZeroHans4 did you try this: https://stackoverflow.com/questions/75661539/building-a-docker-container-for-flutter-build-environment-fails-with-connectivit - it's meant for flutter but the solution should work for dart as well I guess. The Key point is to use ubuntu:latest as it supports ARM architecture as mentioned on the docker website. Then try to install dart from scratch as it was done with flutter in the stackoverflow article.

@pattobrien
Copy link

I've filed a new issue with Dart-Docker after finding a way to reproduce this issue, which seems related to the use of carat syntax for the Dart SDK version in pubspec.yaml. See: dart-lang/dart-docker#172

@passsy
Copy link

passsy commented Jan 4, 2024

Potential fix incoming #54446 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. os-osx
Projects
None yet
Development

No branches or pull requests