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 for FreeBSD #49

Open
marschro opened this issue Jul 16, 2022 · 9 comments
Open

Support for FreeBSD #49

marschro opened this issue Jul 16, 2022 · 9 comments

Comments

@marschro
Copy link

marschro commented Jul 16, 2022

Hi all,
I posted this discussion in the tailwind repo: tailwindlabs/tailwindcss#7826

There is currently no binary for freebsd and I relay like to use phoenixframework/tailwind as well as I love my FreeBSD servers.

I tried to compile the source with vercel/pkg but did not succeed. Is there anyone else out there who needs a FreeBSD binary and more knowledge about how to compile that?
kind regards!

@dch
Copy link
Contributor

dch commented Nov 13, 2022

A quick update, after many peoples help we now can
build this for FreeBSD 🎉 which I will import into
FreeBSD ports 🔜

There is no easy way to do github actions with FreeBSD,
I'm not keen on burning cycles to figure out some hacky
work-around abusing virtualbox or qemu.

The FreeBSD ports & package system is going to be the way
most Elixir users will install both Elixir and Erlang,
would Phoenix be OK with teaching the tailwind module,
for FreeBSD, to tell people to fetch this via official
packages, rather than from the tailwind repos?

@chrismccord
Copy link
Member

@dch what would that look like? Downloading from a different source or raising a helpful error for freebsd usage with custom instructions?

@dch
Copy link
Contributor

dch commented Dec 23, 2022

@chrismccord sorry for the delayed reply. I've not had this building inside a no-net container yet, which is a requirement for building inside ports - somewhere in the 70+Mb of downloaded javascripts is an assumption that there must be a reachable network.

In the interim, are we able to download from e.g. https://people.freebsd.org/~dch/pub/tailwind/tailwindcss-v3.2.4-freebsd-x64.xz, with a suitable checksum?

Or, I can set up some sort of build script that generates these artefacts through an inspectable build log, and then use that?

Finally, we can offload this trust choice to users and point them towards that URL with some warnings about strange people on the internet.

I'm not planning to spend my Christmas vacation hacking javascripts packaging tools, when I could be playing with LiveView.

What's an appropriate level of trust?

@marschro
Copy link
Author

Wohooo !!! @chrismccord and @dch
So is it real now ? https://hexdocs.pm/tailwind/changelog.html#v0-1-10-2023-02-09

@SukhikhN
Copy link

SukhikhN commented Nov 8, 2023

Tailwind tasks doesn't work for me:
** (Mix) mix tailwind default --minify exited with 8
on my machine:

> uname -srm
FreeBSD 13.1-RELEASE-p8 amd64

with Erlang 26.0.2.

It downloads tailwind binary for Linux instead of FreeBSD.

This is because this code

[arch | _] = arch_str |> List.to_string() |> String.split("-")
returns "x86_64" on my machine, not "amd64". The cause for this bevahior seems to be here: https://github.com/erlang/otp/blob/14ce71d439bef11fd54a214b0d408bc75dee6ec2/erts/autoconf/config.guess#L877

So the arch string should be fixed here

{{:unix, :freebsd}, "amd64", 64} -> "freebsd-x64"
if someone can confirm that on all supported FreeBSD and Erlang versions it will be "x86_64".

@dch
Copy link
Contributor

dch commented Nov 8, 2023

@SukhikhN the most common case is installing OTP via binary package, which gives us:

$ which erl; uname -p; elixir --eval 'IO.puts(:erlang.system_info(:system_architecture))'
/usr/local/lib/erlang26/bin/erl
amd64
amd64-portbld-freebsd15.0

how did you install Erlang/OTP? what do you get instead?

We may need to PR both cases.

Assuming you used asdf, I tried installing erlang latest, and get an unrelated error atm:

...
 CC     /home/dch/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/erts/emulator/ryu/obj/x86_64-unknown-freebsd15.0/opt/d2s.o
 CXX    obj/x86_64-unknown-freebsd15.0/opt/jit/beam_asm_global.o
<command-line>: sorry, unimplemented: PCH allocation failure
gmake[4]: *** [x86_64-unknown-freebsd15.0/Makefile:936: obj/x86_64-unknown-freebsd15.0/opt/jit/beam_asm_global.o] Error 1
gmake[4]: *** Waiting for unfinished jobs....

Currently built tailwind versions:

I use mix tailwind.install --if-missing https://people.freebsd.org/~dch/pub/tailwind/v3.3.2/tailwindcss-freebsd-x64 to fetch it.

You will also need lang/gcc installed for tailwind to run.

@SukhikhN
Copy link

SukhikhN commented Nov 8, 2023

Yes, I have Erlang 26.0.2 installed using asdf.

Here is the system info:

$ which erl; uname -p; elixir --eval 'IO.puts(:erlang.system_info(:system_architecture))'
/home/freebsd/.asdf/shims/erl
amd64
x86_64-unknown-freebsd13.1

@dch
Copy link
Contributor

dch commented Nov 8, 2023

@SukhikhN perhaps PR for this?

{{:unix,:freebsd}, arch, 64} when arch in ~w(x86_64 amd64) -> "freebsd-x64"

SukhikhN added a commit to SukhikhN/tailwind that referenced this issue Nov 9, 2023
`:erlang.system_info` on FreeBSD x64 may return different processor
architecture strings depending on how it was installed - from ports, via
asdf or using other methods.
@SukhikhN
Copy link

Could this #95 be merged please?

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

No branches or pull requests

4 participants