asciidoctor / docker-asciidoctor

:ship: A Docker image for using the Asciidoctor toolchain to process AsciiDoc content
https://hub.docker.com/r/asciidoctor/docker-asciidoctor/
Other
324 stars 149 forks source link

EPUB generation failing since docker-asciidoctor:1.64 version with error "cannot load such file -- nokogiri/nokogiri" #430

Open sivaprasadreddy opened 8 months ago

sivaprasadreddy commented 8 months ago

I am using docker-asciidoctor to generate PDF, HTML an EPUB formats and it was working fine until 1.63 version.

docker run --rm -v $(pwd):/documents/:z asciidoctor/docker-asciidoctor:1.63 asciidoctor -o build/mybook.html src/index.adoc

docker run --rm -v $(pwd):/documents/:z asciidoctor/docker-asciidoctor:1.63 asciidoctor-pdf -o build/mybook.pdf src/index.adoc

docker run --rm -v $(pwd):/documents/:z asciidoctor/docker-asciidoctor:1.63 asciidoctor-epub3 -o build/mybook.epub src/index.adoc

When I try to upgrade docker-asciidoctor version to 1.64 or any newer, I am getting the following error ONLY FOR EPUB:

<internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:159:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:159:in `rescue in require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:39:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri/extension.rb:31:in `rescue in <top (required)>'
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri/extension.rb:4:in `<top (required)>'
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri.rb:8:in `require_relative'
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri.rb:8:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub/meta.rb:2:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub.rb:8:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/lib/asciidoctor-epub3.rb:5:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/bin/asciidoctor-epub3:5:in `<top (required)>'
        from /usr/bin/asciidoctor-epub3:25:in `load'
        from /usr/bin/asciidoctor-epub3:25:in `<main>'
<internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri/extension.rb:31:in `rescue in <top (required)>'
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri/extension.rb:4:in `<top (required)>'
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri.rb:8:in `require_relative'
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri.rb:8:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub/meta.rb:2:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub.rb:8:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/lib/asciidoctor-epub3.rb:5:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/bin/asciidoctor-epub3:5:in `<top (required)>'
        from /usr/bin/asciidoctor-epub3:25:in `load'
        from /usr/bin/asciidoctor-epub3:25:in `<main>'
/usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri/extension.rb:7:in `require_relative': Error loading shared library ld-linux-aarch64.so.1: No such file or directory (needed by /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri/3.2/nokogiri.so) - /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri/3.2/nokogiri.so (LoadError)
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri/extension.rb:7:in `<top (required)>'
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri.rb:8:in `require_relative'
        from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.1-aarch64-linux/lib/nokogiri.rb:8:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub/meta.rb:2:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub.rb:8:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/lib/asciidoctor-epub3.rb:5:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/bin/asciidoctor-epub3:5:in `<top (required)>'
        from /usr/bin/asciidoctor-epub3:25:in `load'
        from /usr/bin/asciidoctor-epub3:25:in `<main>'
barthel commented 5 months ago
gem list nokogiri

*** LOCAL GEMS ***

nokogiri (1.16.5 aarch64-linux, 1.13.10)
asciidoctor-fb2-0.7.0 depends on fb2rb (>= 0.6, < 0.8)
fb2rb-0.7.0 depends on nokogiri (>= 1.10, < 1.14)

Using fb2rb 0.8.0 could fix this issue but there is no asciidoctor-fb2 using this.

As a fix, the asciidoctor-fb2 should be removed on arm64 instead of nokogiri only: https://github.com/asciidoctor/docker-asciidoctor/blob/d16e85e04c46ed02414565aa26b67a809f4c64c1/Dockerfile#L139 Or change the nokogiri version to remove to like '> 1.14' because the installed version is 1.16.5 and not 1.16.0 and this version will not removed.

gem uninstall nokogiri -v '> 1.14'
igr commented 5 months ago

Is there a workaround? Quite an annoying problem that is not being solved yet

dunyakirkali commented 2 months ago

I'm having the same issue with the latest docker image

barthel commented 2 months ago

Provide my working/tested solution from https://github.com/barthel/docker-asciidoctor/blob/82cb8bde849fa0cf532c4b8ac51299609a58b854/Dockerfile#L257

dduportal commented 2 months ago

(reopening until we have confirmation the problem is fixed for everyone)

dduportal commented 2 months ago

Hi @sivaprasadreddy @igr @dunyakirkali ! Thanks to @barthel 's contribution, a first fix has been issued: can you tell us if the version 1.77.0 (released today with the aforementioned fix) is working for you or not please?

dunyakirkali commented 2 months ago

1.77.0 works now.

Thank you so much!