Skip to content

Fix compatibility with musl (and thus Alpine linux) alongside latest rubygems v3.3.21 #192

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
wants to merge 1 commit into from

Conversation

benjaminwood
Copy link

A recent change (7 days ago) in ruby gems broke tailwindcss-rails compatibility with musl (and thus Alpine Linux). The change was shipped in rubygems v3.3.21.

Specifically, this change: https://github.com/rubygems/rubygems/pull/5852/files#diff-b2eac061756123f15f8d8e41075e4b8466a60945cad4e594b4eadf241d1a4089R28

Given the file modified in this PR is an executable, I think it's safe to mutate the local platform version without side effects. However, this probably deserves some further consideration.

The readme already mentions that gcompat is required if you're using tailwindcss-rails with musl. I did consider displaying a warning if Gem::Platform.local.version is musl. But, short of looking to see if gcompat is installed, I'm not sure how we would prevent the warning from displaying needlessly (already installed). In any case, a warning along those lines could be added in another PR.

A recent change in ruby gems broke tailwindcss-rails compatibility with musl (and thus alpine linxu). The change was shiped in ruby gems v3.3.21. Specifically, this change:

https://github.com/rubygems/rubygems/pull/5852/files#diff-b2eac061756123f15f8d8e41075e4b8466a60945cad4e594b4eadf241d1a4089R28

Given the file modified in this commit is an executable, I *think* its safe to mutate the local platform version without side effects. However, this probably deserves some further consideration.
@benjaminwood
Copy link
Author

To clarify a bit further, without this change, building assets will fail like this:

23fcf4d98225# bin/rails assets:precompile
ERROR: tailwindcss-rails does not support the x86_64-linux platform
Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
rails aborted!

This is because technically the platform is x86_64-linux-musl.

The change in ruby gems swapped the comparison of local_platform =~ platform to platform =~ local_platform

It worked before because x86_64-linux is in x86_64-linux-musl. It is broken now because x86_64-linux-musl is not in x86_64-linux

@flavorjones
Copy link
Member

Thanks for reporting this, I'll take a look shortly.

@flavorjones
Copy link
Member

I've reached out to a rubygems/bundler maintainer to ask when the fix for this issue (see rubygems/rubygems#5875) will be released in a new version of bundler or rubygems.

I'm not sure this is the correct fix -- I'd rather ship a musl flavor of the gem.

But I'm also not sure we should be trying to fix this, since we're essentially working around a specific version of the upstream dependency manager.

I'm going to wait a few hours to see what the plan is upstream, and if it seems like it won't be fixed soon I'll work on shipping an x86_64-linux-musl platform gem, and maybe I'll even try to address installation of gcompat.

flavorjones added a commit that referenced this pull request Sep 1, 2022
This was not strictly necessary before now because musl platforms have
always used the generic platform gem, but recent changes in rubygems
and bundler introduced new behaviors around libc flavors, and so we're
going the extra mile here to be explicit.

See #192 for context, also see
rubygems/rubygems#5875
@flavorjones
Copy link
Member

See #194 for the work being teed up

@benjaminwood
Copy link
Author

Great! Thanks for following up.

Copy link

@Oamwarit098 Oamwarit098 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

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 this pull request may close these issues.

3 participants