Closed ronaldtse closed 2 years ago
@andrew2net do you know why this is the case?
@ronaldtse how to reproduce the error? Is relaton-3gpp installed?
If you run a document through Metanorma's docker container, you will see it. You can find instructions to run the container here: https://www.metanorma.org/install/docker/
@andrew2net actually it has nothing to do with Docker -- a normal install of Metanorma already shows this line:
[relaton] Info: detecting backends:
[relaton] Error: backend relaton_3gpp not present
...
Maybe this has to do with "relaton_3gpp" vs "relaton-3gpp" name?
@ronaldtse the name relaton_3gpp
is correct. It seems an error occurs when the gem is required. It doesn't happen on my comp so we need to explore the error with Docker.
I'll add a backtrace and an error message in the relaton gem to the log. So we can see what happened when the relaton-3gpp loading.
Here's the reason for the failure:
irb(main):002:0> require 'relaton_3gpp'
/Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/relaton-3gpp-1.10.1/lib/relaton_3gpp/data_fetcher.rb:2:in `require': cannot load such file -- net/ftp (LoadError)
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/relaton-3gpp-1.10.1/lib/relaton_3gpp/data_fetcher.rb:2:in `<top (required)>'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/relaton-3gpp-1.10.1/lib/relaton_3gpp.rb:12:in `require_relative'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/relaton-3gpp-1.10.1/lib/relaton_3gpp.rb:12:in `<top (required)>'
from (irb):2:in `require'
from (irb):2:in `<main>'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/cli/console.rb:19:in `run'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/cli.rb:514:in `console'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/cli.rb:31:in `dispatch'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/cli.rb:25:in `start'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/exe/bundle:48:in `block in <top (required)>'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/exe/bundle:36:in `<top (required)>'
... 2 levels...
irb(main):003:0> require 'relaton_cie'
=> true
Looks like the "net/ftp" module is missing.
I'm on Ruby 3.1.
I supposed the net-ftp
gem should be installed by default. Semms it isn't in Ruby 3.1. Added the dependency to the relaton-3gpp gemspec.
@andrew2net can we only require net/ftp gem for a Ruby version that doesn’t have it? Not sure how the gemspec does that.
@ronaldtse all the dependencies from a gemspec are installed when a gem is installed. It works as Gemfile but it allows to use published gems only.
The require
command a load gem into memory. We can require a dependence when we need to use it but it should be installed in advance.
@andrew2net there's a misunderstanding here.
Ruby < 3.0 includes net/ftp
as an "internal gem", so there is no need to include it in gemspec.
Ruby >= 3.0 does not include the net/ftp
gem at all (it has been removed from Ruby vanilla), so we need it in gemspec.
I'm asking whether there is a way to specify a dependency depending on the Ruby version. I just don't know what the behavior would be if the Ruby version is < 3.0 but the gemspec requires 'net/ftp'.
@ronaldtse if dependency already exists then gemspec does nothing. We don't need to do anything to specify dependency depending on the Ruby version.
@andrew2net agreed, and I tried installing the net-ftp
gem on 2.7.3, which just installs the latest one. No problem then.
I also updated the bundle and the error is indeed fixed. Thanks.
I'm getting this error when compiling a document.