ruby and pdf2epubEX

For discussions about programming and projects not necessarily associated with Porteus.
Post Reply
User avatar
Rava
Contributor
Contributor
Posts: 3006
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 5.0rc + 4.0 i586 XFCe
Location: Forests of Germany
Contact:

ruby and pdf2epubEX

Post#1 by Rava » 28 Aug 2021, 06:42

I try to get pdf2epubEX to run, but it is my first time trying to run a ruby script, and I did not find anything helpful searching for "htmlentities (LoadError)" and "ruby".

I installed pdf2epubEX in the folder where the PDFs are, I put xmlEscape.rb in /bin
I installed ruby-3.0.2-x86_64-1.xzm

I have no clue how to solve ruby dependency issues:

The dockerfile of pdf2epubEX has this:

Code: Select all

RUN apt -q update && apt -q -y install pdf2htmlex poppler-utils bc zip file ruby
RUN gem install htmlentities
I presume I have poppler-utils bc zip file already installed. Running

Code: Select all

gem install htmlentities
does NOT install htmlentities.

Code: Select all

root@porteus:/ # gem install htmlentities
/usr/lib64/ruby/3.0.0/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
<internal:/usr/lib64/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': libyaml-0.so.2: cannot open shared object file: No such file or directory - /usr/lib64/ruby/3.0.0/x86_64-linux/psych.so (LoadError)
	from <internal:/usr/lib64/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib64/ruby/3.0.0/psych.rb:13:in `<top (required)>'
	from <internal:/usr/lib64/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib64/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib64/ruby/3.0.0/yaml.rb:4:in `<top (required)>'
	from <internal:/usr/lib64/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib64/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib64/ruby/3.0.0/rubygems.rb:641:in `load_yaml'
	from /usr/lib64/ruby/3.0.0/rubygems/config_file.rb:345:in `load_file'
	from /usr/lib64/ruby/3.0.0/rubygems/config_file.rb:189:in `initialize'
	from /usr/lib64/ruby/3.0.0/rubygems/gem_runner.rb:73:in `new'
	from /usr/lib64/ruby/3.0.0/rubygems/gem_runner.rb:73:in `do_configuration'
	from /usr/lib64/ruby/3.0.0/rubygems/gem_runner.rb:38:in `run'
	from /usr/bin/gem:21:in `<main>'
gem install libyaml also fails.

Trying to run pdf2epubEX results in these errors:

Code: Select all

	from /bin/xmlEscape.rb:3:in `<main>'
<internal:/usr/lib64/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- htmlentities (LoadError)
And then the script hangs itself at the end and needs to be stopped with CTRL+c:

Code: Select all

./pdf2epubEX: line 227: [: ==: unary operator expected
./pdf2epubEX: line 235: pdf2htmlEX: command not found
cat: '*.page': No such file or directory
./pdf2epubEX: line 265: [: ==: unary operator expected
mv: cannot stat '*.css': No such file or directory
mv: cannot stat '*.woff': No such file or directory
mv: cannot stat '*.jpg': No such file or directory
I/O Error: Couldn't open file 'mybook.pdf': No such file or directory.
mv: cannot stat 'cover.png': No such file or directory
sed: can't read base.min.css: No such file or directory
./pdf2epubEX: line 391: [: ==: unary operator expected
^C

zip error: Interrupted (aborting)
Done
Any ideas?
Cheers!
Yours Rava

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3158
Joined: 20 Mar 2012, 03:42
Distribution: 5.0-current-64bit
Location: australia
Contact:

ruby and pdf2epubEX

Post#2 by ncmprhnsbl » 28 Aug 2021, 22:34

Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
Rava
Contributor
Contributor
Posts: 3006
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 5.0rc + 4.0 i586 XFCe
Location: Forests of Germany
Contact:

ruby and pdf2epubEX

Post#3 by Rava » 22 Sep 2021, 18:25

@ncmprhnsbl

Your reply is not helpful. :(

Do you know a forum for ruby?

I think when I would post all the above info on stackoverflow or a better suited URL from the same tech and other questions site, my post would not get much helpful replies since in the eyes of some experts I did not put in enough effort to learn about the issue and help myself.

Not saying that most folks on there are like this, but still some are.

But when you have zero info of how to fix such a error and there seems to be no helpful wiki pages that show you solutions to similar problems, how could I help myself more?

When there are doyens of basic and less basic ruby packages, how on earth could I guess in which the needed files are.

Also, the setup and installation guide for the other Linux OS not works in Porteus since we do not have these package managers.
Of course I could try finding a Live Linux of that OS - one where the GLIBC is compatible with current Porteus, meaning one where its binaries would all run in Porteus, and then install the converter stuff like they wrote...

But seriously that is such an effort for fixing a seemingly small error. Still serious enough so that the script wont work as intended. :evil: :wall:

Sometimes failure is the only option. :ROFL:
Cheers!
Yours Rava

Post Reply