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

libsass.so: cannot open shared object file with dartsass-rails and Rails 7.1 #2451

Closed
januszm opened this issue Oct 30, 2023 · 3 comments
Closed
Labels
bug breakages in functionality that is implemented

Comments

@januszm
Copy link
Contributor

januszm commented Oct 30, 2023

I'm trying to upgrade a Rails 7.0 app using administrate and sassc-embedded to Rails 7.1 running with Ruby 3.2 and I can't get it to work, boot, launch the Rails console or precompile assets. The only thing that helps is to completely remove administrate from the app. Here's the error log:

Could not open library 'vendor/bundle/ruby/3.2.0/gems/sassc-2.4.0/ext/libsass.so':
  vendor/bundle/ruby/3.2.0/gems/sassc-2.4.0/ext/libsass.so:
    cannot open shared object file: No such file or directory.

Searched in <system library path>, /usr/lib, /usr/local/lib, /opt/local/lib
ffi-1.16.3/lib/ffi/dynamic_library.rb:65:in `load_library'
ffi-1.16.3/lib/ffi/library.rb:95:in `block in ffi_lib'
ffi-1.16.3/lib/ffi/library.rb:94:in `map'
ffi-1.16.3/lib/ffi/library.rb:94:in `ffi_lib'
sassc-2.4.0/lib/sassc/native.rb:13:in `rescue in <module:Native>'
sassc-2.4.0/lib/sassc/native.rb:10:in `<module:Native>'
sassc-2.4.0/lib/sassc/native.rb:6:in `<module:SassC>'
sassc-2.4.0/lib/sassc/native.rb:5:in `<main>'
sassc-2.4.0/lib/sassc.rb:31:in `require_relative'
sassc-2.4.0/lib/sassc.rb:31:in `<main>'

bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
sassc-rails-2.1.2/lib/sassc/rails.rb:5:in `<main>'
sassc-rails-2.1.2/lib/sassc-rails.rb:3:in `require_relative'
sassc-rails-2.1.2/lib/sassc-rails.rb:3:in `<main>'

bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
administrate-0.19.0/lib/administrate/engine.rb:3:in `<main>'

According to dartsass-rails https://github.com/rails/dartsass-rails#loaderror-cannot-load-such-file----sassc

Sass files are referenced in the Sprockets manifest file
If any Sass files are referenced in the Sprockets manifest file (app/assets/config/manifest.js) Sprockets will try to build the Sass files and fail.

The thing is, this error happens no matter what code I have in manifest.js or if I have any scss files in app/assets/stylesheets/ at all. Any attempt to load the Rails app or task fails:

bundle exec rails dartsass:build
bin/rails aborted!
LoadError: Could not open library 'sassc-2.4.0/ext/libsass.so': 
  sassc-2.4.0/ext/libsass.so: cannot open shared object file: No such file or directory.
@januszm januszm added the bug breakages in functionality that is implemented label Oct 30, 2023
@januszm
Copy link
Contributor Author

januszm commented Oct 30, 2023

Just tried with a brand new app generated with:

rails new -d sqlite3 -M -C -c sass -j esbuild -T -B testapp71 # Rails 7.1.1
bundle add dartsass-rails
bundle add administrate
rails dartsass:install
rails g model Page title body
rails db:setup

rails generate administrate:install

no dice, same error on production servers running on Amazon Linux 2023 with Ruby 3.2

@januszm
Copy link
Contributor Author

januszm commented Oct 30, 2023

Also doesn't work with Rails 7.0.6 on Ruby 3.2.2 in this combination.

Oddly enough, I have another application running with Rails 7.0.8 and Ruby 3.0 and the following gems, but set up with webpacker (and older Ruby 3.0)

gem 'administrate'
gem 'administrate-field-image'

gem 'dartsass-rails'
gem 'sprockets-rails'

and it works just fine with dartsass

@nickcharlton
Copy link
Member

Thank you for opening this issue and your patience whilst we figured out how to handle assets for now and in the future.

I took the decision to go with #2397, which will mean in our next release we'll be bundling the assets required for Administrate in the gem itself. My expectation is that this will mean there's no longer any downstream problems caused by us when people change the way they go about bundling their assets, or Rails itself changes how they want to do things.

I'm going to start releasing some pre-release versions of the gem in the coming days, as I'm sure I'm about to break stuff for people, and so we can get feedback and make sure there's nice migration help sorted out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug breakages in functionality that is implemented
Projects
None yet
Development

No branches or pull requests

2 participants