Skip to content

[V4] Illegal instruction when using beta inside Docker #15181

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

Closed
npezza93 opened this issue Nov 25, 2024 · 20 comments · Fixed by #16244
Closed

[V4] Illegal instruction when using beta inside Docker #15181

npezza93 opened this issue Nov 25, 2024 · 20 comments · Fixed by #16244

Comments

@npezza93
Copy link

npezza93 commented Nov 25, 2024

What version of Tailwind CSS are you using?

v4 beta 9

What build tool (or framework if it abstracts the build tool) are you using?

docker and ruby

What version of Node.js are you using?

🤷

What browser are you using?

For example: N/A

What operating system are you using?

linux

Reproduction URL

Dockerfile

# syntax=docker/dockerfile:1
# check=error=true

FROM docker.io/library/ruby:3.4.1-slim AS base

RUN apt-get update -qq && \
    apt-get install --no-install-recommends -y curl build-essential git pkg-config && \
    rm -rf /var/lib/apt/lists /var/cache/apt/archives

RUN curl -L -o bin/tailwindcss https://github.com/tailwindlabs/tailwindcss/releases/download/v4.0.0-beta.2/tailwindcss-linux-x64 && \
    chmod a+x ./bin/tailwindcss

RUN ./bin/tailwindcss --help

command: docker buildx build --platform linux/amd64 --file Dockerfile.tw .
Describe your issue

When trying to execute the beta executable in x86 for linux, it errors with '0.054 Illegal instruction'

@Robert344Humphries

This comment was marked as spam.

@npezza93 npezza93 changed the title Illegal instruction when using beta inside Docker [V4] Illegal instruction when using beta inside Docker Jan 16, 2025
@sgerov
Copy link

sgerov commented Jan 24, 2025

not sure if it's your case but I was getting this on Apple Silicon while targeting amd64 platform.

What fixed it for me is changing the Docker Desktop VM settings from Apple Virtualization framework to Docker VMM. (I didn't try with QEMU):

Image

@pzgz
Copy link

pzgz commented Feb 3, 2025

Everyone using tailwindcss within docker should be cautious, till now, v4.0.3, might still have issue in docker env.

Not only for Apple Silicon, I am running into this issue on a X64 server with ubuntu 20 installed. tailwindcss cli is reporting Illegal instruction (core dumped), waste me a whole day for uprading and have to reverted back to tailwindcss

@flavorjones
Copy link

flavorjones commented Feb 3, 2025

I've had several users of the downstream package tailwindcss-ruby complain about issues that seem like they may be caused by this:

@philipp-spiess tagging you because you were involved in the bun Musl support conversation and may have some insight?

If it's helpful, so far the users that have reported the issue are on various hardware:

  • Intel Celeron n5105
  • Intel Xeon Skylake - x86_64 (64-bit)
  • Heroku servers (unknown)

@thecrypticace
Copy link
Contributor

Not sure if it's your case but I was getting this on Apple Silicon while targeting amd64 platform.

Ah, Rosetta does not support virtualizing all x86_64 instructions so I guess this makes sense.

If it's helpful, so far the users that have reported the issue are on various hardware:

CPU release dates:
Intel Celeron n5105: Q1 2021
Intel Xeon Skylake: Q3 2017
Heroku: no idea either

I'm a bit surprised that the Celeron CPU is reporting illegal instruction errors. Maybe it's also a virtualization thing though?

My guess is that we'll have to use (or otherwise provide) "baseline" builds for Linux x64 which is unfortunate (they're slower) but I don't see any other way around this. We had to do the same thing for the Windows x64 build so people could run it through Window's ARM emulation layer.

@pzgz
Copy link

pzgz commented Feb 3, 2025

@flavorjones @thecrypticace

For my case, I ran into this issue with a Dell R410 server, with Intel XEON E5620, for sure it's pretty old.

Since @flavorjones was talking about bun musl support, which I can also provided feedback. I was trying to migrating my project to rails 8, and selected bun. But it failed on the same box with same error Illegal instruction (core dumped). I used to think it's about ubuntu 18, but after I upgraded it to ubuntu 24, the issue persisted, so I realized it might not be issue from OS. So I decided not to go with bun and stick with pnpm, but block by tailwindcss v4 upgrade with same error

@thecrypticace
Copy link
Contributor

thecrypticace commented Feb 3, 2025

@pzgz If you're still seeing issues with an npm-installed build that may mean the compiler is auto-vectorizing to at least AVX instructions for Oxide. I'll have to look and see what it'd take to disable that.

@thecrypticace
Copy link
Contributor

Also I looked into it and the Celeron CPU does not support AVX at all — only SSE 4.2. (even tho it was released 10 years after the first processors with AVX shipped from Intel 😱)

@pzgz
Copy link

pzgz commented Feb 3, 2025

@pzgz If you're still seeing issues with an npm-installed build that may mean the compiler is auto-vectorizing to at least AVX instructions for Oxide. I'll have to look and see what it'd take to disable that.

Thanks and Yes, I did switched to npm install build and still fail.

@npezza93
Copy link
Author

npezza93 commented Feb 3, 2025

Fwiw that repro dockerfile up above was being run using orbstack on an m2 mac

@philipp-spiess
Copy link
Member

philipp-spiess commented Feb 4, 2025

Hey folks! I prepared a PR (#16244) that uses a different bun base that compiles to a reduced instruction set and with that I was able to fix the Dockerfile repro:

[+] Building 13.7s (10/10) FINISHED                                                                                                docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                               0.0s
 => => transferring dockerfile: 495B                                                                                                               0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1                                                                          0.4s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d801e66d25                    0.0s
 => => resolve docker.io/docker/dockerfile:1@sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d801e66d25                               0.0s
 => [internal] load metadata for docker.io/library/ruby:3.4.1-slim                                                                                 0.4s
 => [internal] load .dockerignore                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                    0.0s
 => [1/4] FROM docker.io/library/ruby:3.4.1-slim@sha256:6956f5f6b0661910b7d17933db5a09446baf5bcb56e89e388c0259b4f818c9b2                           0.0s
 => => resolve docker.io/library/ruby:3.4.1-slim@sha256:6956f5f6b0661910b7d17933db5a09446baf5bcb56e89e388c0259b4f818c9b2                           0.0s
 => CACHED [2/4] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y curl build-essential git pkg-config &&     rm -rf /var/  0.0s
 => [3/4] RUN curl -L -o bin/tailwindcss https://assets.tailwindcss.com/tailwindcss-linux-x64 &&     chmod a+x ./bin/tailwindcss                   4.4s
 => [4/4] RUN ./bin/tailwindcss --help                                                                                                             0.9s
 => exporting to image                                                                                                                             7.6s 
 => => exporting layers                                                                                                                            7.6s 
 => => exporting manifest sha256:c61d713094b7abddf40760c8d09e4011689d47650335a8cd9b8335ee120109c7                                                  0.0s
 => => exporting config sha256:3345057f1c03da86dc673878e97c93d22cfc4ad90cf812882595bacc9a4e8e3a                                                    0.0s
 => => exporting attestation manifest sha256:4511f6a91cafd54ace2b81a62b936feb5ccea8a30af06f61beb5d5422dff2461                                      0.0s
 => => exporting manifest list sha256:4c717ac5eaaabad7edb2d42b47287f950d95c8350126c843edb172165a736229                                             0.0s
 => => naming to moby-dangling@sha256:4c717ac5eaaabad7edb2d42b47287f950d95c8350126c843edb172165a736229    

Since it's a bit hard for us to test across different server setups mentioned above I wanted to ask for your help to figure out if this resolves (at least some) of the issues.

Excuse the unconventional way of deploying the binary but I've uploaded preview builds here:

https://assets.tailwindcss.com/tailwindcss-linux-x64
https://assets.tailwindcss.com/tailwindcss-linux-x64-musl
https://assets.tailwindcss.com/tailwindcss-linux-arm64
https://assets.tailwindcss.com/tailwindcss-linux-arm64-musl

@npezza93
Copy link
Author

npezza93 commented Feb 4, 2025

@philipp-spiess That executable works for me!

@pzgz
Copy link

pzgz commented Feb 4, 2025

@philipp-spiess

Thanks a lot, for my case, on Dell R410 with Intel XEON E5620, on docker container with ubuntu 24:

  • tailwindcss-linux-x64 works for my box
  • tailwindcss-linux-x64-musl failed

@flavorjones
Copy link

flavorjones commented Feb 4, 2025

@pzgz I think the intention was to try the -linux-x64 binary if you're on a GNU libc system, and the -linux-x64-musl binary if you're on a Musl libc system (like Alpine).

@Chadh13
Copy link

Chadh13 commented Feb 4, 2025

Happy to test this in our herkou pipeline if someone can point me at how to plop this into the tailwind-ruby gem to then be used by the tailwindcss-rails gem -- or give me a temporary install/deploy path. I took at look at the source for both of the gems and unfortunately I'm not super confident in approaching a change to a wrapper like this.

Also happy to test a fork/PR that's prepared in those gems themselves and report back here for the broader community if that's helpful.

@verachell
Copy link

Thank you for fixing this! I confirm that your new standalone tailwindcss-linux-x64 executable now works on my local Linux Mint machine! (on which the previously released versions did not, as described in discussion #15912 ).

Thank you for this fix.

Additional info that may or may not be helpful: (feel free to ignore this section)
In case it's of any help, your new new tailwindcss-linux-arm64 still works on my local Raspberry pi, although to be fair the old versions worked on the Pi too. I just mean that the changes you made didn't introduce any breakages in the arm64. Wanted to try it because I expect you might not have quite as many people testing arm64 in the wild as for x64.

@pzgz
Copy link

pzgz commented Feb 5, 2025

@pzgz I think the intention was to try the -linux-x64 binary if you're on a GNU libc system, and the -linux-x64-musl binary if you're on a Musl libc system (like Alpine).

Got u, thanks for your info.

@philipp-spiess
Copy link
Member

Thank you for all your testing, really appreciate it. Let us get this out asap now 👍

@philipp-spiess
Copy link
Member

This will be fixed in the next patch release going out today. Thanks again everyone for your help in testing this!

@julik
Copy link

julik commented Mar 17, 2025

@philipp-spiess I believe I am seeing the issue also on an older Xeon machine with native Darwin, sadly:

julik@jet rev.photo (main) $ brake tailwindcss:build
rake aborted!
Command failed with SIGILL (signal 4): /Users/julik/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/tailwindcss-ruby-4.0.14-x86_64-darwin/exe/x86_64-darwin/tailwindcss
/Users/julik/.rbenv/versions/3.2.2/bin/bundle:25:in `load'
/Users/julik/.rbenv/versions/3.2.2/bin/bundle:25:in `<main>'
Tasks: TOP => tailwindcss:build
(See full trace by running task with --trace)

The binary I have downloaded from https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.14 (https://github.com/tailwindlabs/tailwindcss/releases/download/v4.0.14/tailwindcss-macos-x64) - so it is also broken for Intel Macs (at least older ones), not only for Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

11 participants