jperon / lyluatex

Alternative à lilypond-book pour lualatex
MIT License
58 stars 12 forks source link

attempt to index field 'shared' (a nil value) stack traceback in function 'get_font_family' #180

Closed fedelibre closed 6 years ago

fedelibre commented 6 years ago

I'm trying to understand how lyluatex works, but I find different problems. Let's start with the first: why the compilation of a LilyPond file needs me to hit Enter several times.

My current configuration:

My .ly file is:

$ cat test.ly 
\version "2.18.2"

{ c1 }

My .tex file is:

$ cat lyluainclude.tex 
\documentclass{article}
\usepackage{lyluatex}
\begin{document}

\lilypondfile[]{test.ly}

\end{document}

I run the following command: lualatex --shell-escape lyluainclude.tex. And here's the last part of the output:

(/usr/share/texlive/texmf-dist/tex/latex/graphics/lscape.sty))./lyluatex.lua:13
52: attempt to index field 'shared' (a nil value)
stack traceback:
    ./lyluatex.lua:1352: in function 'get_font_family'
    [\directlua]:1: in main chunk.
\ly@currentfonts ..._font_family(font.current()))}
                                                  \rmfamily \edef \rmfamilyi...

l.6 \lilypondfile[]{test.ly}

? 
./lyluatex.lua:1352: attempt to index field 'shared' (a nil value)
stack traceback:
    ./lyluatex.lua:1352: in function 'get_font_family'
    ./lyluatex.lua:1399: in function 'set_fonts'
    [\directlua]:1: in main chunk.
\ly@currentfonts ..., \sffamilyid , \ttfamilyid )}
                                                  \endgroup 
l.6 \lilypondfile[]{test.ly}

? 
Module lyluatex Warning: Found something incompatible with `fragment`
(lyluatex)               (or `relative`). Setting them to false.
(lyluatex)               on input line 6
<tmp-ly/489dde8b0f74d276926d745375fd496c-1.pdf, id=1, 62.2325pt x 46.1725pt>
<use tmp-ly/489dde8b0f74d276926d745375fd496c-1.pdf> [1{/usr/share/texlive/texmf
-dist/fonts/map/pdftex/updmap/pdftex.map}<./tmp-ly/489dde8b0f74d276926d745375fd
496c-1.pdf>] (./lyluainclude.aux))
 422 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 9 glue, 7 attribute, 44 glue_spec, 7 attribute_lis
t, 1 write nodes
   avail lists: 2:54,3:6,4:6,5:16,6:5,7:42,8:4,9:35
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on lyluainclude.pdf (1 page, 15269 bytes).
Transcript written on lyluainclude.log.

The file is compiled correctly, but I'd like to avoid the interaction. Also I don't understand the lyluatex warning.

jperon commented 6 years ago

@fedelibre Could you please try to:

lyluatex.lua.txt

fedelibre commented 6 years ago

Ok, here's the terminal output:

$ lualatex --shell-escape lyluainclude.tex 
This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 system commands enabled.
(./lyluainclude.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./lyluatex.sty
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(/usr/share/texlive/texmf-dist/tex/luatex/ctablestack/ctablestack.sty))
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload.sty(using write
 cache: /home/fede/.cache/texlive/texmf-var/luatex-cache/generic)(using read ca
che: /usr/share/texlive/texmf-var/luatex-cache/generic /home/fede/.cache/texliv
e/texmf-var/luatex-cache/generic)
luaotfload | main : initialization completed in 0.122 seconds)
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/luatex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/minibox/minibox.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3pdfmode.def)))
(/usr/share/texlive/texmf-dist/tex/latex/environ/environ.sty
(/usr/share/texlive/texmf-dist/tex/latex/trimspaces/trimspaces.sty))
(/usr/share/texlive/texmf-dist/tex/latex/currfile/currfile.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/filehook/filehook.sty))
(/usr/share/texlive/texmf-dist/tex/latex/pdfpages/pdfpages.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/share/texlive/texmf-dist/tex/latex/tools/calc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/eso-pic/eso-pic.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/atbegshi.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty))
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg)))
(/usr/share/texlive/texmf-dist/tex/latex/pdfpages/ppluatex.def))
(/usr/share/texlive/texmf-dist/tex/latex/metalogo/metalogo.sty
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)))
No file lyluainclude.aux.
(/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/luatex-loader.sty
(/usr/share/texlive/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/pdflscape.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/lscape.sty))
FONTINFO    15  table: 0x557aa1530420
./lyluatex.lua:14
9: attempt to index field '?' (a nil value)
stack traceback:
    ./lyluatex.lua:149: in function 'fontinfo'
    ./lyluatex.lua:1359: in function 'get_font_family'
    [\directlua]:1: in main chunk.
\ly@currentfonts ..._font_family(font.current()))}
                                                  \rmfamily \edef \rmfamilyi...

l.6 \lilypondfile{test.ly}

? 

FONTINFO    15  table: 0x557aa1530420
./lyluatex.lua:149: attempt to index field '?' (a nil value)
stack traceback:
    ./lyluatex.lua:149: in function 'fontinfo'
    ./lyluatex.lua:1359: in function 'get_font_family'
    ./lyluatex.lua:1406: in function 'set_fonts'
    [\directlua]:1: in main chunk.
\ly@currentfonts ..., \sffamilyid , \ttfamilyid )}
                                                  \endgroup 
l.6 \lilypondfile{test.ly}

? 
Module lyluatex Warning: Found something incompatible with `fragment`
(lyluatex)               (or `relative`). Setting them to false.
(lyluatex)               on input line 6

FONTINFO    15  table: 0x557aa1530420
./lyluatex.lua:149: attempt to index field '?' (a nil value)
stack traceback:
    ./lyluatex.lua:149: in function 'fontinfo'
    ./lyluatex.lua:158: in function 'font_default_staffsize'
    ./lyluatex.lua:508: in function 'calc_properties'
    ./lyluatex.lua:1095: in function 'process'
    [\directlua]:1: in main chunk.
\ly@compilescore ...directlua {ly.score:process()}

l.6 \lilypondfile{test.ly}

? 
(./lyluainclude.aux))
 433 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 9 glue, 8 attribute, 44 glue_spec, 8 attribute_lis
t, 2 write, 1 pdf_colorstack nodes
   avail lists: 2:7,3:2,4:1,5:4,7:1,8:1,9:1

warning  (pdf backend): no pages of output.
Transcript written on lyluainclude.log.

Here's attached also the log: lyluainclude.log

fedelibre commented 6 years ago

On lilypond-user list another Fedora user confirmed the same problem. He told that it used to work some weeks before end of March...

I'm trying again to debug this problem, testing several fedora versions in containers.

Let me write down some notes to install required dependencies in Fedora:

dnf install texlive-{base,ctablestack,luatexbase,luaotfload,xkeyval,minibox,environ,currfile,pdfpages,metalogo,latex-bin-bin}

However, in these containers I can't even build any minimal LaTex document (without any lilypond snippet). Perhaps some basic package is missing? Or configuration? Another problem to solve before I can go further. I'll ask for help in other places.

fedelibre commented 6 years ago

Ok, I've figured out above problem. I was missing some basic texlive packages. In Fedora you can easily install a texlive-scheme metapackage, such as texlive-scheme-small, to get all the basic packages. Then run as root fmtutil-sys --all.

Anyway, same problem in Fedora 26 and 28, just like in 27.

fedelibre commented 6 years ago

@jperon Do you have any clue about which difference between Debian and Fedora may lead to this error? It's about fonts, right? I see for example a difference in the version of luaotfload module.

Debian 9 (Stretch):

root@debian9:~# grep -A10 ^luaotfload.module /usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-main.lua
luaotfload.module = {
    name          = "luaotfload-main",
    version       = 2.70003,
    date          = "2016/06/16",
    description   = "OpenType layout system.",
    author        = authors,
    copyright     = authors,
    license       = "GPL v2.0"
}

Fedora 27:

$ grep -A10 luaotfload.module /usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-main.lua
luaotfload.module = {
    name          = "luaotfload-main",
    version       = 2.70002,
    date          = "2016/04/21",
    description   = "OpenType layout system.",
    author        = authors,
    copyright     = authors,
    license       = "GPL v2.0"
}

I guess I'll have to install TexLive from source (no distro package) and see what happens.

fedelibre commented 6 years ago

Installing native TeX Live 2017 solved the problem. It must be an issue with a texlive Fedora package, so I'm going to close this.