sass-embedded-host-ruby icon indicating copy to clipboard operation
sass-embedded-host-ruby copied to clipboard

sass-embedded fails to build on FreeBSD14

Open 0x1eef opened this issue 1 year ago • 5 comments

Hey :wave:

I am unable to install sass-embedded on FreeBSD14:

$ gem install sass-embedded
Fetching sass-embedded 1.77.8                                                       
Installing sass-embedded 1.77.8 with native extensions  
rake aborted!                                                                                                                                                           
NotImplementedError: dart-sass for x86_64-freebsd14 not available at https://github.com/sass/dart-sass/releases/tag/1.77.8 (NotImplementedError) 

The error makes sense; there's no prebuild available for FreeBSD (Or OpenBSD, or NetBSD). Could we build from source instead (during gem install) ?

0x1eef avatar Jul 23 '24 07:07 0x1eef

Dart VM does not have BSD support: https://github.com/dart-lang/sdk/issues/52374. There was an experimental BSD port by community at some point but was completely abandoned. Porting Dart SDK to BSD would be the most performant and preferred way, but it is not an easy task.

You can try running Dart VM in Linux jail, but I’m not sure if it will work or not. To try this you will have to create a shell script that runs dart-sass command line inside Linux jail. Create a folder named dart-sass, then put the shell script as dart-sass/sass with permission 0755. Create a tarball containing the dart-sass folder, then gem install sass-embedded -- DART_SASS=/path/to/tarball. I don't know much about tcsh syntax, but here is an example of the wrapper script written in bash:

#!/bin/sh
chroot /compat/ubuntu /path/inside/linux/jail/to/dart-sass/sass "$@"

As an alternative, you can try file an issue on dart-sass to support embedded compiler (sass --embedded) in pure JS mode. It will be slow, but at least allow this gem to be working on BSD via node JS.


Without the support from Dart VM or Dart Sass, there isn’t much this repo can do.

ntkme avatar Jul 23 '24 15:07 ntkme

Dart VM does not have BSD support: https://github.com/dart-lang/sdk/issues/52374. There was an experimental BSD port by community at some point but was completely abandoned. Porting Dart SDK to BSD would be the most performant and preferred way, but it is not an easy task.

Alright :disappointed:

As an alternative, you can try file an issue on dart-sass to support embedded compiler (sass --embedded) in pure JS mode. It will be slow, but at least working on BSD via node JS.

I have been using https://www.npmjs.com/package/sass. It works okay. The big downside is I can't use any Ruby packages that depend on sass-embedded, such as the nanoc plugin nanoc-dart-sass.

Without the support from Dart VM or Dart Sass, there isn’t much this repo can do.

No worries. Thanks a lot for the explanation, links and suggestions. Gonna close this one.

0x1eef avatar Jul 23 '24 22:07 0x1eef

A note for future me (and that can help other users) as I did this a few month ago and got hit by this again today: the FreeBSD Linux compatibility can be used to run the Linux dart/sass binary and install the gem.

As described above by @ntkme, one can download the dart-sass-*-linux-x64.tar.gz following the link in the error message, and set the DART_SASS environment variable to the path of this file:

$ DART_SASS=~/Downloads/dart-sass-1.80.4-linux-x64.tar.gz bundle install

smortex avatar Oct 27 '24 23:10 smortex

Real BSD support will be coming soon: https://github.com/sass/dart-sass/pull/2413

ntkme avatar Oct 28 '24 15:10 ntkme

Although the nodejs based BSD support is still pending review, I've added Linuxulator support on FreeBSD in 1.85.0. If you are running FreeBSD with a properly configured Linuxulator setup, installing this gem will automatically select the linux version of dart-sass binary and everything should work.

ntkme avatar Feb 14 '25 02:02 ntkme

Thanks @ntkme <3

0x1eef avatar Oct 15 '25 00:10 0x1eef