Omikhleia / awesome-sile-books

Sources for test books ready-to-compile with SILE
Other
12 stars 0 forks source link

Unable to find inputters.silm #1

Closed RobH123 closed 1 year ago

RobH123 commented 1 year ago

I'm sure this is a noob error, but the Readme shows the command:

sile -u inputters.silm book/book.silm

On my Ubuntu system with SILE compiled from source and with this repo cloned, I've got:

`~/Downloads/sile-0.14.10$ ./sile -u inputters.silm /awesome-sile-books/lsg/lsg.silm

SILE v0.14.10 (Lua 5.3) /usr/bin/lua: ./core/sile.lua:151: module 'inputters.silm' not found: no field package.preload['inputters.silm']could not load ftl file no file './lua_modules/share/lua/5.3/inputters/silm.lua' .... (lots more lines) `

I'm unable to discover inputters.silm on my system. Am I missing something or is the ReadMe missing some instruction?

UPDATE: I tried doing sudo make install (then I could run sile from any path) to see if that would help it find inputters but no change.

Omikhleia commented 1 year ago

Have you installed resilient.sile via Luarocks as specified in the README pre-requisites, 3rd-bullet?

Omikhleia commented 1 year ago

You can also run luarocks list to check which 3rd-party packages were installed, by the way.

RobH123 commented 1 year ago

Ok, thanks for the very helpful pointers @Omikhleia. That made it easy to track the problem down down to Lua versions and paths. Seems my system liked Lua 5.2 but SILE liked 5.3. Not sure how many other things I messed up on my system on the way, but eventually got resilient.sile reinstalled under 5.3 and got the path right so it would find the inputter. (I see why the docker container saves lots of setup issues, but I couldn't see anything in the SILE manual about where/how to install a .sile package in that scenario so ended up compiling SILE from source.)

Anyway, now I got to this: ` ! Unexpected Lua error

stack traceback: /usr/local/share/sile/packages/bidi.lua:248: in main chunk [C]: in function 'require' /usr/local/share/lua/5.3/sile/classes/base.lua:147: in function 'classes.resilient.base.loadPackage' /usr/local/share/sile/classes/plain.lua:36: in function 'classes.plain._init' /usr/local/share/lua/5.3/sile/classes/resilient/base.lua:14: in function 'classes.resilient.base._init' /usr/local/share/lua/5.3/sile/classes/resilient/book.lua:19: in function 'classes/resilient.book._init' .../local/share/sile/lua_modules/share/lua/5.3/pl/class.lua:38: in upvalue 'call_ctor' .../local/share/sile/lua_modules/share/lua/5.3/pl/class.lua:171: in local 'constructor' /usr/local/share/sile/inputters/base.lua:31: in function 'inputters.djot.classInit' /usr/local/share/sile/inputters/base.lua:40: in function 'inputters.djot.requireClass' /usr/local/share/sile/inputters/base.lua:48: in function 'inputters.djot.process' /usr/local/share/sile/core/sile.lua:309: in function 'core.sile.processString' /usr/local/share/sile/core/sile.lua:354: in function 'core.sile.processFile' ...local/share/sile/lua_modules/share/lua/5.3/pl/tablex.lua:351: in function 'pl.tablex.imap' /usr/local/bin/sile:52: in function </usr/local/bin/sile:51> [C]: in function 'xpcall' /usr/local/bin/sile:51: in main chunk [C]: in ?

error summary: Processing at: /home/robert/Programming/ExternalPrograms/awesome-sile-books/lsg/lsg.silm: in : [[masterfile: 0.0␤metadata:␤ title: Bible Louis Segond 1910␤font:␤ family: Libertinus Serif␤ size: ]] Using code at: /usr/local/share/sile/packages/bidi.lua:248: attempt to index a nil value (field 'typesetter') `

Omikhleia commented 1 year ago

/usr/local/share/sile/packages/bidi.lua:248 is a weird line to have an issue with the core SILE bidi package, I can't make sense of it breaking there in any SILE 0.14.x. If it crashes here, it should even have crashed earlier on the previous line. Hmm.

/usr/local/share/lua/5.3/sile/classes/base.lua:147 is the base class loading a package, but I have an issue with that line number. It does'nt make sense too with either the core SILE base class (then in the legacy package case, which bidi is NOT at all) or the overloaded base class from my modules (then on a basic require). I would have expected something such as line 155...

/usr/local/share/sile/classes/plain.lua:36 is the plain class from SILE loading "bidi", expected from that point and all other logs look reasonable.

I am at loss, the line numbers don't make sense to me.

There might be some mash up of earlier SILE installs, or something wrong in your build setup, or some path issue.

What is the code around the lines /usr/local/share/sile/packages/bidi.lua:248 and /usr/local/share/lua/5.3/sile/classes/base.lua:147 on your system?

I am not sure how I can help troubleshooting core SILE install issues. I always use a docker image with all my setup in it, to avoid conflicts with my host system(s).

Omikhleia commented 1 year ago

May I suggest using docker?

With the following Dockerfile (quickly baked, not sure all is nicely done, but it works)


FROM ghcr.io/sile-typesetter/sile

# Freshen all base system packages (and cleanup cache)
RUN pacman-key --init
RUN pacman --needed --noconfirm -Syq archlinux-keyring && yes | pacman -Sccq
RUN pacman --needed --noconfirm -Suq && yes | pacman -Sccq

# RESILIENT: Additional tools
RUN pacman --noconfirm -Syu graphicsmagick
RUN pacman --noconfirm -S inkscape
RUN pacman --noconfirm -Su ghostscript
RUN pacman --noconfirm -Su graphviz
RUN pacman --noconfirm -Su lilypond

# Install extra fonts LATER
# COPY ./resilient/Makefile-fonts /

RUN yes | pacman -Syu make
# RUN make -f Makefile-fonts allfonts
# COPY ./resilient/fonts/OCRB.otf /.fonts

# RESILIENT: LUAROCKS AND ADDITIONAL 3RD-PARTY SILE PACKAGES
# Install extra packages
RUN yes | pacman -Syu luarocks git

RUN luarocks install resilient.sile

RUN luarocks list
#RUN sile --version

WORKDIR /data
ENTRYPOINT ["sile"]

Build with:

docker build --progress plain . -f Dockerfile -t silex

Then define an alias:

alias resilient='docker run -it --volume "$(pwd):/data" --user "$(id -u):$(id -g)" silex'

Then process files with, e.g.

resilient -u inputters.silm lsg/lsg.silm

There will be missing fonts... But that's a possible way where to start, and perhaps we could either mount a font volume or bake a set of fonts into the docker image (I have a script but commented out, it downloads many fonts)

This would at least save the trouble of building SILE from source and the version mess on Ubuntu.

Omikhleia commented 1 year ago

N.B. I'll propose a better dockerfile when i get the time.

(Better) Docker file provided and README updated.

RobH123 commented 1 year ago

Thankyou, that was so helpful and also showed me how to add SILE packages to a docker container. (Using Docker certainly solves Lua dependency issues, but I had searched the SILE manual for how to add an additional package to the Docker image without success -- maybe it could be mentioned there under "Further Tricks".) Your ReadMe didn't mention that you have to be in the awesome-sile-books folder to run the build command but figured that out. And I couldn't get the book/book.silm command to work (so not sure where that should be run from -- I tried from the resilient.sile folder with no better success).

However, I was able to use lsg/lsg.silm and successfully created the nice PDF! It said ! Warning: table of contents has changed, please rerun SILE to update it. so I'm currently creating it all again -- hopefully that's what was expected? (I noted the lsg.ref and lsg.toc files that had been created, so presumably they get used the second time?) Anyway, thanks for taking the time to help me get started. Now I'll try to understand how it all works (although I'll eventually be wanting two-column text with footnotes at bottom which is the most common Bible style that I've encountered).

Omikhleia commented 1 year ago

And I couldn't get the book/book.silm

My assumption was for it to be replaced with the true name of the intended book (lovecraft/lovecraft.silm, lsg/lsg.silm, etc.) If it's unclear please don't hesitate making a PR with adequate rewording to the README. It sounds obvious to me, but that's to be expected from the original developer! I am not the best placed for phrasing it in a better way. :smile_cat:

so not sure where that should be run from ...

Likewise, I intended everything to be done just inside the awesome-sile-books folder.

Warning: table of contents has changed, please rerun SILE to update it.

A minor issue in both SILE and resilient -- we complain about the ToC even if we do not use it (in these examples)... Bah. I'll leave such bugs to other developers...

... although I'll eventually be wanting two-column text with footnotes at bottom which is the most common Bible style that I've encountered

SILE needs more developers ;)

As I wrote in the initial SILE issue on the topic, we might possibly be years away from such a goal. There are already tons of issues to fix even for a single-page bible.

Even in single-page, you'll notice issues - no grid typesetting, pages that overflow, split paragraphs that should be kept together, etc. Some of these problems can be fixed, but we lack the task force for them. It's beyond reach with so small a team, maybe.