Skip to content
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

Support FreeBSD with bespoke upstream build #71

Merged

Conversation

dch
Copy link
Contributor

@dch dch commented Dec 23, 2022

We can't use upstream tailwind FreeBSD packages, because the vercel/pkg tool that
tailwind relies on builds in github actions, which don't support FreeBSD. Thus
we build these externally, and need to make a few modifications to accommodate this.

This is in "Works on my machine" mode presently; we could make further changes from here
if interested:

I will generate the build artifacts separately with verifiable checksum shortly, which
should improve the trust factor a bit.

Using https://builds.sr.ht/ and this manifest:

This is now the artefact at https://people.freebsd.org/~dch/pub/tailwind/v3.2.4/tailwindcss-freebsd-x64 at least for the moment.

$ curl -#LO https://patchouli.sr.ht/builds.sr.ht/artifacts/~dch/910662/0223ad33fd6373fe/tailwindcss-freebsd-x64
############################################################################## 100.0%
$ l
total 4192
-rw-r--r--  1 dch  devel    44M Dec 23 21:15 tailwindcss-freebsd-x64
$ sha256 *
SHA256 (tailwindcss-freebsd-x64) = d71d4b4c8bf0e4d4bb590e286c892d3d7209640bac3c8c3cfb11aadc7b897694
$ sha512 *
SHA512 (tailwindcss-freebsd-x64) = a5a38f13cf405776f06164af4dbcf8bef9a3d8c256b8d3f90ae6a80ee9a2f0a13931138e86db083e7900664239c844124fc811f2f30ed98e69123905b6136693

Alternative approaches welcomed.

@dch dch force-pushed the feature/add-freebsd-amd64 branch from 21b659e to 6071aac Compare December 25, 2022 02:52
@josevalim
Copy link
Member

Hi @dch! Can you please send a PR that adds only the target? Then with #60, you can do: mix tailwind.install custom-url, which should make it easier for people to get it running on other platforms.

@dch dch force-pushed the feature/add-freebsd-amd64 branch from 6071aac to 197e6be Compare January 16, 2023 14:26
@dch
Copy link
Contributor Author

dch commented Jan 16, 2023

@josevalim done. It's great to see how #60 turned out, this is the way!

@josevalim josevalim merged commit 506d35c into phoenixframework:master Jan 16, 2023
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@dch
Copy link
Contributor Author

dch commented Jan 16, 2023

🚀 🤩 🏓 🌍 🌊

dch@wintermute /p/i/indie> mix tailwind.install https://people.freebsd.org/~dch/pub/tailwind/v3.2.4/tailwindcss-freebsd-x64
dch@wintermute /p/i/indie> l _build/tailwind-freebsd-x64
-rwxr-xr-x  1 dch  wheel    45M Jan 16 14:32 _build/tailwind-freebsd-x64*
dch@wintermute /p/i/indie>

@dch dch deleted the feature/add-freebsd-amd64 branch January 16, 2023 14:47
@leonardorame
Copy link

Hi!, it seems that my FreeBSD version (13.1) isn´t compatible:

ld-elf.so.1: /usr/local/lib/gcc10/libstdc++.so.6: version GLIBCXX_3.4.30 required by /usr/home/leonardo/desarrollo/phoenix1.7/hello_world/_build/tailwind-freebsd-x64 not found
[info] Running HelloWorldWeb.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)
ld-elf.so.1: /usr/local/lib/gcc10/libstdc++.so.6: version GLIBCXX_3.4.30 required by /usr/home/leonardo/desarrollo/phoenix1.7/hello_world/_build/tailwind-freebsd-x64 not found

@leonardorame
Copy link

leonardorame commented Feb 26, 2023

Hi again, after spending many hours trying to compile tailwind without success I downloaded the Linux version: https://github.com/tailwindlabs/tailwindcss/releases/download/v3.2.4/tailwindcss-linux-x64, as I have installed linuxulator I can run it from command line without issues, then I copied it as tailwindcss-freebsd-x64 into my webserver (a local Apache24) and did mix tailwind.install http://127.0.0.1/tailwindcss-freebsd-x64, it automatically downloaded and copied into my project's _build directory, but when I run mix phx.server it hangs forever without showing any error.

@dch
Copy link
Contributor Author

dch commented Feb 26, 2023

hey @leonardorame I think this will be one of 2 issues:

  • you're using FreeBSD quarterly ports, not latest (read /etc/pkg/FreeBSD.conf ), update your gcc version

  • you have multiple gcc installed and it's selecting the wrong one

Using https://people.freebsd.org/~dch/pub/tailwind/v3.2.6/tailwindcss-freebsd-x64

$ chmod +x ./tailwindcss-freebsd-x64
$ ldd ./tailwindcss-freebsd-x64
        libutil.so.9 => /lib/libutil.so.9 (0x1c3cb1d0d000)
        libkvm.so.7 => /lib/libkvm.so.7 (0x1c3cb0e2a000)
        libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x1c3cb247a000)
        libstdc++.so.6 => /usr/local/lib/gcc12/libstdc++.so.6 (0x1c3cb2a00000) <---
        libm.so.5 => /lib/libm.so.5 (0x1c3cb3277000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x1c3cb34ef000)
        libthr.so.3 => /lib/libthr.so.3 (0x1c3cb4aa0000)
        libc.so.7 => /lib/libc.so.7 (0x1c3cb3fb1000)
        libelf.so.2 => /lib/libelf.so.2 (0x1c3cb5593000)
        [vdso] (0x1c3cafa985d0)

For the latter, I need to ask a few people to figure out how this can be accommodated.

@leonardorame
Copy link

Hi @dch, yes I'm using quarterly ports and yes, I have gcc9, gcc10, gcc11 and gcc12.

When I run ldd on that file I get this:

tailwindcss-freebsd-x64:
	libutil.so.9 => /lib/libutil.so.9 (0x80303f000)
	libkvm.so.7 => /lib/libkvm.so.7 (0x803057000)
	libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x80306c000)
	libstdc++.so.6 => /usr/local/lib/gcc10/libstdc++.so.6 (0x803072000) <--- gcc10 !
	libm.so.5 => /lib/libm.so.5 (0x803459000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x803494000)
	libthr.so.3 => /lib/libthr.so.3 (0x8034ae000)
	libc.so.7 => /lib/libc.so.7 (0x8034dc000)
	libelf.so.2 => /lib/libelf.so.2 (0x8038e6000)

@leonardorame
Copy link

Hi @dch, I created a Jail with latest ports and it worked!.

Now, it should be great if we can find a way to build it with quarterly ports. I think most users use RELEASE, which by default have quarterly ports.

@dch
Copy link
Contributor Author

dch commented Mar 1, 2023

@leonardorame try this one, https://builds.sr.ht/~dch/job/950069 via

curl -#L https://patchouli.sr.ht/builds.sr.ht/artifacts/~dch/950069/b55f38667af56331/tailwindcss-freebsd-x64 -o tailwind-freebsd-x64 && chmod +x tailwind-freebsd-x64

which should bind to gcc12 (lang/gcc atm) you'll need to have it installed but it
shouldn't conflict. If this still doesn't work, let's take this privately as
its not really a phx-tailwind issue.

@marschro
Copy link

marschro commented Apr 23, 2023

Hi @dch - I used not your tailwind artifact on FreeBSD 13.1 (amd) with
https://people.freebsd.org/~dch/pub/tailwind/v3.2.6/tailwindcss-freebsd-x64
and have now this issue.

ld-elf.so.1: /usr/local/lib/gcc11/libstdc++.so.6: version GLIBCXX_3.4.30 required by /var/tmp/gitlab_runner/builds/brxwgu9M/0/devpunx/jail_portal/_build/tailwind-freebsd-x64 not found
ld-elf.so.1: /usr/local/lib/gcc11/libstdc++.so.6: version GLIBCXX_3.4.30 required by /var/tmp/gitlab_runner/builds/brxwgu9M/0/devpunx/jail_portal/_build/tailwind-freebsd-x64 not found
** (Mix) `mix tailwind default --minify` exited with 1

I have gcc an gcc11 both available...
any ideas?

@leonardorame can totally understand. One can build Elixir apps in hours and then has to spend hours or days to try to get this javascript tailwind crossover thingy running...

UPDATE:
... okay, used accidentally this one:

That's now way way way better to handle. I now just have a special mix step in my mix.exs that installs the freebsd bin and done!.

So good !!!!

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.

4 participants