noteflakes-music/lyp

lyp fails on ghostscript command ~> 2.19.18

Closed this issue · 4 comments

I'm getting a failure in running the final ghostscript pdf-creation command in versions 2.19.18 and above. The usual gs command works if I run the exact same thing in the terminal, but it seems to be failing with lyp. I originally thought lilypond in general was also failing, but I successfully installed and compiled this test on 2.19.80 with no problems.

Running Arch Linux, ghostscript 9.22, lyp 1.3.5.

shell output

[vagrant@bazinga ly_test]$ lyp use 2.19.18
Using Lilypond version 2.19.18
[vagrant@bazinga ly_test]$ lyp compile test.ly
Lyp 1.3.5
GNU LilyPond 2.19.18
Processing `/tmp/lyp/wrappers/test.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Layout output to `test.ps'...
Converting to `./test.pdf'...
warning: `(gs -q -dSAFER -dDEVICEWIDTHPOINTS=595.28 -dDEVICEHEIGHTPOINTS=841.89
-dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -r1200 -sDEVICE=pdfwrite
-sOutputFile=./test.pdf -c.setpdfwrite -ftest.ps)' failed (256)

fatal error: failed files: "/tmp/lyp/wrappers/test.ly"

[vagrant@bazinga ly_test]$ lyp use 2.19.17
Using Lilypond version 2.19.17
[vagrant@bazinga ly_test]$ lyp compile test.ly
Lyp 1.3.5
GNU LilyPond 2.19.17
Processing `/tmp/lyp/wrappers/test.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Layout output to `test.ps'...
Converting to `./test.pdf'...
Success: compilation successfully completed

test.ly

\score {
    \new Voice {
        c'4 d' e' f'
    }

    \layout { }
}

Lyp installs the bundled versions of lilypond, which include among other things a copy of GhostScript. I have little understanding of how lilypond invokes it (I'll try to look it up). Anyway, try to compile the test file with debug level logging:

bin/lyp compile -lDEBUG test.ly

Great, thanks. So something happened in there where 2.19.17 and all versions of the "official" lilypond release uses the bundled gs but lyp uses my system ghostscript instead. The updated grammar is totally fine, but gs throws an error when the versions don't match.

gs: Interpreter revision (922) does not match gs_init.ps revision (921).    

Since I'm on Arch it's a gigantic headache to pin an out-of-date package version so I can't (easily) downgrade ghostscript. My guess is that lyp is failing to set some environment variable that is invoking the final gs command, so it's just defaulting to the system one. (I actually first installed the ghostscript package because lyp wasn't finding the packaged one.)

The plot thickens -- the exec at lilypond/bin/gs is version 9.22 for all versions larger than 2.19.18! 2.19.17 is still 8.70. lyp seems to be properly setting all the environment variables pointing the libs at the included 9.21 installation.

Update: I copied all the 9.22 ghostscript files from an updated installation into the relevant folders, and everything works! Theoretically this should be just fine. The issue is less urgent because this part is fixed (for me anyway), but I still wonder why the ghostscript version problem breaks lyp.