tailwindlabs / tailwindcss

A utility-first CSS framework for rapid UI development.
https://tailwindcss.com/
MIT License
83.27k stars 4.22k forks source link

[v4] Musl/Alpine is not supported in the V4 alphas #15031

Open flavorjones opened 3 days ago

flavorjones commented 3 days ago

What version of Tailwind CSS are you using?

v4.0.0-alpha.34

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

Binary CLI executable from https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.0-alpha.34

What version of Node.js are you using?

N/A

What browser are you using?

N/A

What operating system are you using?

Alpine Linux (musl libc)

Reproduction URL

You can see the failure in CI here: https://github.com/flavorjones/tailwindcss-ruby/actions/runs/11896261069/job/33147810896?pr=21#step:7:5

Compare with successful build run on a glibc system here: https://github.com/flavorjones/tailwindcss-ruby/actions/runs/11896261069/job/33147810459?pr=21#step:5:5

Describe your issue

When running the binary x86_64-linux executable on an Alpine (musl libc) system, I see:

/bin/sh: ./tailwindcss: not found

Running ldd to see whether shared libraries are resolved properly reveals the problem:

# ldd ./tailwindcss
        /lib64/ld-linux-x86-64.so.2 (0x72662d672000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x72662d672000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by ./tailwindcss)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x72662d672000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x72662d672000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x72662d672000)
Error relocating ./tailwindcss: gnu_get_libc_version: symbol not found
Error relocating ./tailwindcss: backtrace: symbol not found
Error relocating ./tailwindcss: backtrace_symbols: symbol not found
Error relocating ./tailwindcss: __cxa_thread_atexit_impl: symbol not found
Error relocating ./tailwindcss: __cxa_at_quick_exit: symbol not found
Error relocating ./tailwindcss: __register_atfork: symbol not found
Error relocating ./tailwindcss: __strftime_l: symbol not found
Error relocating ./tailwindcss: __cxa_thread_atexit_impl: symbol not found
Error relocating ./tailwindcss: unsupported relocation type 37
Error relocating ./tailwindcss: unsupported relocation type 37
Error relocating ./tailwindcss: unsupported relocation type 37

A previous issue (#14569) reported this, and the outcome was to open an upstream bun bug at https://github.com/oven-sh/bun/issues/14292. The reply there was, essentially:

Unfortunately, gcompat does not help:

# apk add gcompat
(1/3) Installing musl-obstack (1.2.3-r2)
(2/3) Installing libucontext (1.2-r3)
(3/3) Installing gcompat (1.1.0-r4)
OK: 89 MiB in 55 packages

# ./tailwindcss
Error relocating /tailwindcss-ruby-mount/exe/x86_64-linux/tailwindcss: unsupported relocation type 37
Error relocating /tailwindcss-ruby-mount/exe/x86_64-linux/tailwindcss: unsupported relocation type 37
Error relocating /tailwindcss-ruby-mount/exe/x86_64-linux/tailwindcss: unsupported relocation type 37

# ldd ./tailwindcss
        /lib64/ld-linux-x86-64.so.2 (0x7db1dbfca000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7db1dbfca000)
        ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7db1dbfbc000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7db1dbfca000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7db1dbfca000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7db1dbfca000)
Error relocating ./tailwindcss: gnu_get_libc_version: symbol not found
Error relocating ./tailwindcss: backtrace: symbol not found
Error relocating ./tailwindcss: backtrace_symbols: symbol not found
Error relocating ./tailwindcss: __cxa_thread_atexit_impl: symbol not found
Error relocating ./tailwindcss: __cxa_at_quick_exit: symbol not found
Error relocating ./tailwindcss: __register_atfork: symbol not found
Error relocating ./tailwindcss: __strftime_l: symbol not found
Error relocating ./tailwindcss: __cxa_thread_atexit_impl: symbol not found
Error relocating ./tailwindcss: unsupported relocation type 37
Error relocating ./tailwindcss: unsupported relocation type 37
Error relocating ./tailwindcss: unsupported relocation type 37

I suspect this is going to be a blocker to adoption for many people given how widespread Alpine images are, particularly in CI/CD pipelines.

philipp-spiess commented 1 day ago

@flavorjones Thanks for the bug report! I agree that this is something that will cause a lot of frustrations and it's something we should find a solution for. We're currently working with the Bun team to adopt their new musl support that they just landed: https://github.com/oven-sh/bun/issues/918

Will update this PR when we have news, right now we're blocked on https://github.com/oven-sh/bun/issues/15307