ndctl icon indicating copy to clipboard operation
ndctl copied to clipboard

asciidoctor 2.0.10 compilation error

Open linjiach opened this issue 5 years ago • 2 comments

I encountered compilation error when configuring machine based on Centos 7. I had to downgrade asciidoctor to 1.5.6 to bypass make error. When using the default upstream verion 2.0.10, there're errors below:

[root@xxx]# make GEN version.m4 make --no-print-directory all-recursive GEN version.m4 Making all in . GEN version.m4 Making all in daxctl/lib make[2]: Nothing to be done for all'. Making all in ndctl/lib make[2]: Nothing to be done for all'. Making all in ndctl make --no-print-directory all-am CCLD ndctl Making all in daxctl make --no-print-directory all-am make[3]: Nothing to be done for all-am'. Making all in Documentation/ndctl GEN ndctl.1 /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/extensions.rb:68:in enable_dsl': undefined method singleton_class?' for Ndctl::Documentation::LinkNdctlProcessor:Class (NoMethodError) from /root/ndctl-66/Documentation/ndctl/asciidoctor-extensions.rb:7:in class:LinkNdctlProcessor' from /root/ndctl-66/Documentation/ndctl/asciidoctor-extensions.rb:6:in <module:Documentation>' from /root/ndctl-66/Documentation/ndctl/asciidoctor-extensions.rb:5:in module:Ndctl' from /root/ndctl-66/Documentation/ndctl/asciidoctor-extensions.rb:4:in <top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:276:in block in parse!' from /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:274:in each' from /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:274:in parse!' from /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:34:in parse!' from /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:24:in initialize' from /usr/local/share/gems/gems/asciidoctor-2.0.10/bin/asciidoctor:13:in new' from /usr/local/share/gems/gems/asciidoctor-2.0.10/bin/asciidoctor:13:in <top (required)>' from /bin/asciidoctor:26:in load' from /bin/asciidoctor:26:in

' make[2]: *** [ndctl.1] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2

linjiach avatar Mar 12 '20 22:03 linjiach

I could not reproduce the issue on Fedora 31 using Asciidoctor 2.0.10 with Ruby 2.6.5. Fedora supplies:

# asciidoctor --version
Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

CentOS7.7 defaults to asciidoctor 1.5.6.1 and Ruby 2.0.0 where there are no issues building ndctl.

I installed asciidoctor 2.0.10 using gem install asciidoctor:

$ asciidoctor --version 
Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.0.0p648 (2015-12-16) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

This reproduced the issue:

Making all in Documentation/ndctl
  GEN      asciidoctor-extensions.rb
  GEN      attrs.adoc
  GEN      ndctl.1
/usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/extensions.rb:68:in `enable_dsl': undefined method `singleton_class?' for Ndctl::Documentation::LinkNdctlProcessor:Class (NoMethodError)
        from /downloads/ndctl/Documentation/ndctl/asciidoctor-extensions.rb:7:in `<class:LinkNdctlProcessor>'
        from /downloads/ndctl/Documentation/ndctl/asciidoctor-extensions.rb:6:in `<module:Documentation>'
        from /downloads/ndctl/Documentation/ndctl/asciidoctor-extensions.rb:5:in `<module:Ndctl>'
        from /downloads/ndctl/Documentation/ndctl/asciidoctor-extensions.rb:4:in `<top (required)>'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:276:in `block in parse!'
        from /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:274:in `each'
        from /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:274:in `parse!'
        from /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:34:in `parse!'
        from /usr/local/share/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:24:in `initialize'
        from /usr/local/share/gems/gems/asciidoctor-2.0.10/bin/asciidoctor:13:in `new'
        from /usr/local/share/gems/gems/asciidoctor-2.0.10/bin/asciidoctor:13:in `<top (required)>'
        from /usr/local/bin/asciidoctor:23:in `load'
        from /usr/local/bin/asciidoctor:23:in `<main>'
make[2]: *** [ndctl.1] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

I noted that Fedora used Ruby 2.6.5 versus CentOS that uses Ruby 2.0.0, so I followed the instructions at https://tecadmin.net/install-ruby-latest-stable-centos/ to install Ruby 2.6.3 (the latest available for CentOS).

$ asciidoctor --version 
Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

This did not resolve the issue as we still get:

Making all in Documentation/ndctl
  GEN      ndctl.1
/home/pmemuser/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/extensions.rb:68:in `enable_dsl': undefined method `singleton_class?' for Ndctl::Documentation::LinkNdctlProcessor:Class (NoMethodError)
        from /downloads/ndctl/Documentation/ndctl/asciidoctor-extensions.rb:7:in `<class:LinkNdctlProcessor>'
        from /downloads/ndctl/Documentation/ndctl/asciidoctor-extensions.rb:6:in `<module:Documentation>'
        from /downloads/ndctl/Documentation/ndctl/asciidoctor-extensions.rb:5:in `<module:Ndctl>'
        from /downloads/ndctl/Documentation/ndctl/asciidoctor-extensions.rb:4:in `<top (required)>'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/pmemuser/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:276:in `block in parse!'
        from /home/pmemuser/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:274:in `each'
        from /home/pmemuser/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:274:in `parse!'
        from /home/pmemuser/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:34:in `parse!'
        from /home/pmemuser/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:24:in `initialize'
        from /home/pmemuser/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/bin/asciidoctor:13:in `new'
        from /home/pmemuser/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/bin/asciidoctor:13:in `<top (required)>'
        from /usr/local/bin/asciidoctor:23:in `load'
        from /usr/local/bin/asciidoctor:23:in `<main>'
make[2]: *** [ndctl.1] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Doing some further debugging, I believe this relates to Asciidoctor-diagram 1.5.17 is incompatible with asciidoctor 1.5.x. I was able to solve the problem by installing asciidoctor-diagram and asciidoctor-pdf:

gem install asciidoctor-diagram asciidoctor-pdf

asciidoctor-pdf --version 
Asciidoctor PDF 1.5.3 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

Now ndctl compiles the documentation on CentOS 7.7 using Asciidoctor 2.x without error.

Summary

Just installing asciidoctor 2.x leaves the systems with incompatible or missing packages (asciidoctor-figure and asciidoctor-pdf).

Solution

It is recommended to use the default Ruby 2.x and Asciidoctor v1.5.x versions delivered with CentOS 7.x.

To use Asciidoctor 2.x, do the following:

  1. Install Ruby v2.1 or later using the instructions at https://tecadmin.net/install-ruby-latest-stable-centos/

  2. Install all the version compatible asciidoctor packages/modules:

gem install asciidoctor asciidoctor-diagram asciidoctor-pdf

sscargal avatar Mar 25 '20 18:03 sscargal

On CentOS 7 I recommend falling back to asciidoc instead of asciidoctor. See the CentOS 7 ndctl source rpm:

https://mirror.chpc.utah.edu/pub/vault.centos.org/centos/7.7.1908/os/Source/SPackages/ndctl-64.1-2.el7.src.rpm

djbw avatar Mar 25 '20 19:03 djbw