v4 not building in x86_64 container built on arm64 mac #499
-
I'm not sure where to post this because I cannot tell if it's kamal, tailwindcss-ruby, or tailwindcss-rails that's the underlying issue. When running
Inspecting the image I can confirm the file is present but I've not been able to make progress to understand what's failing or find anyone with a similar issue. Interestingly the build is completing when I run Finally, I'd like to thank y'all for the time you've spent integrating Tailwind into Rails. I've been using Tailwind since v2 and these latest gems and install have been the best to work with yet. Thank you and keep up the great work. |
Beta Was this translation helpful? Give feedback.
Replies: 27 comments
-
@BaylorRae most likely your application's tailwind configuration is referencing a tailwind plugin that requires installation via npm (or another javascript package manager). I can't be sure or help more without additional information.
|
Beta Was this translation helpful? Give feedback.
-
Thank you, here's my @import "tailwindcss";
@utility table {
@apply w-full;
thead {
@apply text-left;
}
tbody {
@apply divide-y divide-stone-200 border-t-2 border-stone-200;
}
thead th,
tbody td {
@apply p-4;
&:first-child {
@apply pl-0;
}
&:last-child {
@apply pr-0;
}
}
} |
Beta Was this translation helpful? Give feedback.
-
The application is a new rails app that was created with the following command.
# $ cat Gemfile
source "https://rubygems.org"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 8.0.1"
gem "net-pop", github: "ruby/net-pop"
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
gem "propshaft"
# Use sqlite3 as the database for Active Record
gem "sqlite3", ">= 2.1"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"
# Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]
gem "tailwindcss-rails", "~> 4.0"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
gem "bcrypt", "~> 3.1.7"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ windows jruby ]
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
gem "solid_cache"
gem "solid_queue"
gem "solid_cable"
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
gem "kamal", require: false
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
gem "thruster", require: false
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
gem "image_processing", "~> 1.13"
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
gem "brakeman", require: false
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
gem "rubocop-rails-omakase", require: false
end
group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
end |
Beta Was this translation helpful? Give feedback.
-
Hello, I have the same error run locally
Any suggestions? |
Beta Was this translation helpful? Give feedback.
-
@dmarczal Try running
Grab the executable path and run it with Reassemble the command from those arguments, does it run or does it emit a more verbose error than you're getting above? |
Beta Was this translation helpful? Give feedback.
-
Hi, same problem on github actions building on arm64:
File is there, local image build successful. |
Beta Was this translation helpful? Give feedback.
-
@stage-rl @dmarczal @BaylorRae If someone can help me reproduce what you're seeing, I would be happy to investigate further. To date I have not been able to guess at the combination of factors causing this. Please provide more information (or a project repository) to help me reproduce it! 🙏 |
Beta Was this translation helpful? Give feedback.
-
Here's what I've done in an attempt to reproduce this:
When I say "runs fine" I mean the container build completes, including
I'm on
What are y'all doing differently? |
Beta Was this translation helpful? Give feedback.
-
@flavorjones granted you my repo. See the dedicated tailwind v4 branch |
Beta Was this translation helpful? Give feedback.
-
@stage-rl I cannot reproduce in your repo.
Output included:
I notice that my docker build step is 17 while yours is 19. Help me reproduce what you're seeing. |
Beta Was this translation helpful? Give feedback.
-
As I said, locally it's also OK on my computer. But see the failed workflow: https://github.com/stage-rl/efectfit/actions/runs/13248836256/job/36981687456 |
Beta Was this translation helpful? Give feedback.
-
I see the failed workflow. Unfortunately, that doesn't help me reproduce it so I can debug it, though. I'd like to ask the folks who've posted on this issue to help me reproduce it locally so I don't have to guess at the preconditions that trigger whatever is going on. |
Beta Was this translation helpful? Give feedback.
-
Hm, I don't know how to help. OK, thanks a lot for the effort. Hopefully someone else will be more knowledgeable than myself |
Beta Was this translation helpful? Give feedback.
-
Are you running apple sillicon chip? My project is working in development, but can't deploy it to my Ubunut, but if I use my ubunto PC then It is working normally. |
Beta Was this translation helpful? Give feedback.
-
This is my setup as well. I'll go back through the thread more closely when I'm back at my computer, but skimming through the comments we are seeing the same things. I'm on a M1 chip I believe and can run To fix my issue I ended up uninstalling the tailwindcss-rails gem, adding node to my dockerfile, and manually compiling the css into my I can't remember for certain, but I think when started a vanilla ruby-slim container that I was able to install the tailwindcss gem and have it work when I ran it by hand. It seems like it was at the asset pipeline level in rails that was causing issues. I wish I could be certain but I tried several different combinations of node/no-node etc.. It might be propshaft but I didn't take the time to try everything against sprockets. |
Beta Was this translation helpful? Give feedback.
-
I was able to recreate it on a Mac M-series machine with the following instructions. rails new --minimal -c tailwind Testing
cd Testing/
docker buildx build --platform linux/amd64 . The output:
I tried adding the command to the RUN RAILS_MASTER_KEY="asdf" SECRET_KEY_BASE_DUMMY=1 ./bin/rails tailwindcss:build[verbose]
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile With the output that failed with:
|
Beta Was this translation helpful? Give feedback.
-
I don't have a mac, so I can't reproduce this. I need someone's further help to determine if the problem is with this gem, or with the upstream binary running in docker (and I'm quite sure it's the latter, but before opening a bug report upstream we need to positively determine this). As I asked a few days ago in #497 (comment) ... Try running
Grab the executable path and run it with Reassemble the command from those arguments, does it run? Does it emit a more verbose error than you're getting above? |
Beta Was this translation helpful? Give feedback.
-
Like, just as a reminder, this gem (tailwindcss-rails) mostly provides view templates and rails-compatible config files. The tailwindcss-ruby gem just packages up the upstream binary executable. Problems like what's reported here are not likely to be caused by or under the control of either of the Ruby gems, which is why I keep asking people on this thread and other reports to run the binary executable directly to determine if it works and validate my hypothesis that this is a problem with the upstream binary. |
Beta Was this translation helpful? Give feedback.
-
The previous comment does have your request output. I didn't highlight it well enough. Here is the output from
|
Beta Was this translation helpful? Give feedback.
-
@jtarchie now run that command without invoking the gem's rake task, please |
Beta Was this translation helpful? Give feedback.
-
I am trying to get someone to provide a repro that can be reported upstream. To do that we need to run the binary executable directly on a directory/file structure that is reproducible by upstream tailwind maintainers who likely know nothing about ruby or rails. |
Beta Was this translation helpful? Give feedback.
-
Adding the line I cheated an added a
|
Beta Was this translation helpful? Give feedback.
-
@jtarchie I'm asking you to run the build command implied by the verbose output |
Beta Was this translation helpful? Give feedback.
-
this command:
|
Beta Was this translation helpful? Give feedback.
-
Ok, here we go, thanks for clarifying. I took some extra liberty to get information about the The commands added: RUN ls -asl /rails/app/assets/tailwind/
RUN /usr/local/bundle/ruby/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss -i /rails/app/assets/tailwind/application.css -o /rails/app/assets/builds/tailwind.css --minify Output:
I wanted to show the information on the files in the |
Beta Was this translation helpful? Give feedback.
-
This is great, thank you for following this through to the end, @jtarchie. This demonstrates to me that the binary executable is behaving strangely in an x86_64 docker container that is built on an arm64 darwin host. Do you agree, does that fully describe the preconditions? If so am willing to attempt to report this upstream, though I would prefer if a Mac user reported it instead in order to help debug/diagnose with upstream maintainers. |
Beta Was this translation helpful? Give feedback.
-
Side note, anyone kamal-deploying to x86_64 production platforms but developing on an arm64 platform should consider setting up a remote builder: https://kamal-deploy.org/docs/configuration/builder-examples/ |
Beta Was this translation helpful? Give feedback.
This is great, thank you for following this through to the end, @jtarchie.
This demonstrates to me that the binary executable is behaving strangely in an x86_64 docker container that is built on an arm64 darwin host. Do you agree, does that fully describe the preconditions?
If so am willing to attempt to report this upstream, though I would prefer if a Mac user reported it instead in order to help debug/diagnose with upstream maintainers.