akihikodaki / cld3-ruby

cld3-ruby is an interface of Compact Language Detector v3 (CLD3) for Ruby.
Apache License 2.0
77 stars 22 forks source link

.so file not found #37

Closed j-manu closed 1 year ago

j-manu commented 1 year ago

Getting this error after installation in Docker container

Could not open library '/usr/local/bundle/gems/cld3-3.5.0/lib/cld3/../../ext/cld3/libcld3.so': /usr/local/bundle/gems/cld3-3.5.0/lib/cld3/../../ext/cld3/libcld3.so: cannot open shared object file: No such file or directory (LoadError)

The .so file is present in /usr/local/bundle/gems/cld3-3.5.0/lib/ but not /usr/local/bundle/gems/cld3-3.5.0/ext/cld3/libcld3.so

Reproduction: https://github.com/debug-poc/cld3 https://github.com/debug-poc/cld3/actions/runs/3781540490/jobs/6428505336

j-manu commented 1 year ago

This is due to https://github.com/rubygems/rubygems/issues/6205

akihikodaki commented 1 year ago

tl; dr: cld3-ruby won't support the latest RubyGems until RubyGems developers figure out a reliable way to get the path to the binary. I recommend to stay away of the latest RubyGems and Ruby, which includes the lastest RubyGems for now.

I authored commit 0ff7bb57a052fbdc346f28c1e1e9b097bfc606b6 but I decided not to merge this change. The problem of this change is that the binary won't be installed to the lib directory on Fedora and on Arch Linux (and potentially on other distributions as well). For details, see:

Referring to the lib directory can also be problematic in the future as the binary in the directory is stated to be removed anyway: https://github.com/rubygems/rubygems/commit/e07dba09231a5182cab8a00094cbc261cd1ed0fc

Unfortunately the reality is that RubyGems introduced a disruptive change without realizing its nature and there is no good workaround. I hope the situation gets better soon; only a few days have passed since Ruby 3.2.0 release anyway so let's wait a bit longer.

josh-m-sharpe commented 1 year ago

Is there an active/open discussion against ruby gems somewhere? I see that https://github.com/rubygems/rubygems/issues/6205 was linked, but is closed now.

akihikodaki commented 1 year ago

I don't think so. There is a PR to document an API useful to fix the issue but it's kind of stale and does not provide an exact procedure to resolve the path: https://github.com/rubygems/rubygems/pull/6218

j-manu commented 1 year ago

@akihikodaki Please consider releasing a version compatible with ruby 3.2 even if it is not optimal for all use cases. You can release it as prerelease gem so that it has to be opted in explicitly.

akihikodaki commented 1 year ago

Fixed with https://github.com/akihikodaki/cld3-ruby/commit/59f3ae9b5cecb88dda8ece28969c97ddfb0b85f4.

j-manu commented 1 year ago

@akihikodaki Thank you!!