-
Notifications
You must be signed in to change notification settings - Fork 118
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
for M1 Macs: the qemu-x86_64 emulates an ancient CPU model that doesn't support modern features, breaks Swift compiler / LLVM / ... #5561
Comments
Passing
edit: looking into it more, looks like subprocess doesn't keep the args atm |
Indeed I've created an emulator image that enables
We need to figure out if there are any performance/functionality regressions before we can switch this image as default in desktop. There is also a workaround you can do in your code without switching the system emulator. You just need to define
|
Hey @tonistiigi, thanks for looking into this.
Correct, Qemu does in fact do nothing for subprocesses. It just
Awesome, this shouldn't make any difference as it should only affect software that currently doesn't work I think?
Oh wow, that's awesome, thank you! |
We have implemented this in Docker Desktop 3.3.2. Thank you for the suggestion. |
Awesome, thank you! |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Expected behavior
I can run modern software that uses Intel instructions like
pshufb
in Docker for Mac (on M1 Macs) because the qemu-x86_64 that's installed using thebinfmt_misc
support can emulate it.Actual behavior
I can't run modern software that makes use of newer Intel instructions because the qemu-x86_64 that gets run using
binfmt_misc
doesn't get passed a-cpu core2duo
(or newer such as-cpu Skylake-Client
/-cpu max
) argument.Information
The problem is that the
qemu-x86_64
doesn't get passed a-cpu core2duo
(or even better something like-cpu Skylake-Client
or maybe-cpu max
("Enables all features supported by the accelerator in the current host")) argument. Really, I would recommend to just pass the newest CPU that qemu can emulate (probably-cpu max
).I got the Swift compiler to work just fine by compiling my own qemu with this patch applied:
which just sets the default CPU model to
core2duo
. I then installed as the Docker for Mac defaultbinfmt_misc
handler forx86_64
usingin the actual VM which I entered using
justincormack/nsenter
.Steps to reproduce the behavior
The quickest way to reproduce the problem is:
docker run -it --rm --platform linux/amd64 swift:5.3 bash -c 'echo "print(\"hello world\")" > /tmp/test.swift && cd /tmp && swiftc test.swift && ./test'
Expected: prints "hello world"
Actual: Output something similar to
Please note the
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
which qemu prints when it encounters thepshufb
Intel instruction (which needs the Intel SSE3 feature which qemu (correctly) only emulates if you tell it to emulate a new-enough CPU using-cpu core2duo
or better).The problem here is that the Swift compiler runs a
pshufb
instruction which isn't available in the ancient CPU that qemu emulates if you don't pass-cpu core2duo
or newer. See Swift compiler bug SR-14186 for all the details.For a somewhat more complete test, it'd be probably good to run
which clones SwiftNIO, compiles it and runs its test suite.
The text was updated successfully, but these errors were encountered: