sass-contrib / sass-embedded-host-ruby

:gem: A Ruby library that will communicate with Embedded Dart Sass using the Embedded Sass protocol
https://rubygems.org/gems/sass-embedded
MIT License
67 stars 5 forks source link

sass-embedded fails to build on FreeBSD14 #227

Open 0x1eef opened 3 months ago

0x1eef commented 3 months ago

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) ?

ntkme commented 3 months ago

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.

0x1eef commented 3 months ago

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.

smortex commented 3 weeks ago

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
ntkme commented 3 weeks ago

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