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

asciidoctor: ERROR: KindleGen failed to write MOBI #362

Closed
amejiarosario opened this issue Aug 23, 2020 · 8 comments
Closed

asciidoctor: ERROR: KindleGen failed to write MOBI #362

amejiarosario opened this issue Aug 23, 2020 · 8 comments
Labels

Comments

@amejiarosario
Copy link
Contributor

amejiarosario commented Aug 23, 2020

I'm getting this error after I updated this gem to master. (epub works fine btw)

asciidoctor: ERROR: KindleGen failed to write MOBI to /mnt/c/Users/adria/Code/dsa.js/book/dist/dsajs-book-vsnapshot.mobi

I even tried downloading the kindlegen manually and passing it in KINDLEGEN but still no go

 env VERSION='0' KINDLEGEN=(pwd)"/bin/kindlegen" bundle exec asciidoctor --backend=epub3 --require=asciidoctor-epub3 -a ebook-validate  -a ebook-format=kf8 --trace --require=asciidoctor-diagram --destination-dir=../dist -a revnumber=snapshot ../readme.asc --out-file=../dist/dsajs-book-snapshot.mobi
@slonopotamus
Copy link
Contributor

slonopotamus commented Aug 23, 2020

@amejiarosario I need some more log output. Our "KindleGen failed to write MOBI" error just means that execution of KindleGen ended with non-zero exit code.

Also, what platform you're on? For Windows/Linux, KindleGen can be installed via kindlegen gem.

@amejiarosario
Copy link
Contributor Author

amejiarosario commented Aug 24, 2020

@slonopotamus I added the --verbose flag and got some more data. I'm using Ubuntu WSL (Windows Subsystem for Linux).

bin/kindlegen: Syntax error: "(" unexpected

full logs:

$ bundle exec asciidoctor --verbose --backend=epub3 --require=asciidoctor-epub3 -a ebook-validate -a ebook-format=kf8 --trace --requuire=asciidoctor-diagram --destination-dir=../dist -a revnumber=0 ../readme.asc --out-file=../dist/dsajs-book-v0.mobi

/home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/gepub-1.0.11/lib/gepub/package.rb:174: warning: instance variable @ordered not initialized
/home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/gepub-1.0.11/lib/gepub/book.rb:131: warning: instance variable @optional_files not initialized
/home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/gepub-1.0.11/lib/gepub/spine.rb:50: warning: instance variable @rendition_specified not initialized
/home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/gepub-1.0.11/lib/gepub/metadata.rb:99: warning: instance variable @xml not initialized
asciidoctor: DEBUG: Wrote KF8 to /mnt/c/Users/adria/Code/dsa.js/book/dist/dsajs-book-v0-kf8.epub
asciidoctor: DEBUG: Using KindleGen from gem: /home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/kindlegen-12dd349ce59f/bin/kindlegen
asciidoctor: INFO: /home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/kindlegen-12dd349ce59f/bin/kindlegen: 1: /home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/kindlegen-12dd349ce59f/bin/kindlegen: Syntax error: "(" unexpected
asciidoctor: ERROR: KindleGen failed to write MOBI to /mnt/c/Users/adria/Code/dsa.js/book/dist/dsajs-book-v0.mobi

Let me know if you need anything else

@slonopotamus
Copy link
Contributor

Seems like something went wrong when installing kindlegen gem. /home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/kindlegen-12dd349ce59f/bin/kindlegen is supposed to be an executable file. What does it contain?

@amejiarosario
Copy link
Contributor Author

It's an executable binary file (ELF4). I tried to run it on its own and looks like is failing:

  • bin/kindlegen' is marked as an executable but could not be run by the operating system.
  • bin/kindlegen: cannot execute binary file: Exec format error

I also get the same error when trying to run the file I downloaded it kindlegen_linux_2.6_i386_v2_9.tar.gz. Not sure why won't work in Ubuntu.

Full logs:

$ /home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/kindlegen-12dd349ce59f/bin/kindlegen 

Failed to execute process '/home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/kindlegen-12dd349ce59f/bin/kindlegen'. Reason:
exec: Exec format error
The file '/home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/kindlegen-12dd349ce59f/bin/kindlegen' is marked as an executable but could not be run by the operating system.
$ bash -c '/home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/kindlegen-12dd349ce59f/bin/kindlegen'                        06:42:51
bash: /home/adrian/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/kindlegen-12dd349ce59f/bin/kindlegen: cannot execute binary file: Exec format error

@slonopotamus
Copy link
Contributor

Hmm... I've noticed that you're using non-release version of kindlegen gem but commit 12dd349ce59f that is almost 6 years old. Could you try updating to latest kindlegen release (3.0.5)?

@slonopotamus
Copy link
Contributor

Also, does your kernel support running 32-bit executables at all? That could also be the cause of the problem.

@slonopotamus
Copy link
Contributor

Closing this in favor of #363.

@amejiarosario
Copy link
Contributor Author

amejiarosario commented Aug 25, 2020

I tried again on Ubuntu 20.04 (before 18.04) and with a newer version of ruby 2.7 (before 2.5). Also, deleted my Gemfile.lock and reinstalled everything fresh. It's working now 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants