1 @c -*- coding: utf-8; mode: texinfo; -*-
4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
6 When revising a translation, copy the HEAD committish of the
7 version that you are working on. For details, see the Contributors'
8 Guide, node Updating translation committishes..
14 @node Running lilypond
15 @chapter Running @command{lilypond}
17 This chapter details the technicalities of running LilyPond.
21 * Command-line usage::
30 Most users run LilyPond through a GUI; if you have not done so
31 already, please read the @rlearning{Tutorial}. If you use an alternate
32 editor to write lilypond files, see the documentation for that
36 @node Command-line usage
37 @section Command-line usage
39 This section contains extra information about using LilyPond on the
40 command-line. This may be desirable to pass extra options to the
41 program. In addition, there are certain extra @q{helper} programs (such
42 as @code{midi2ly}) which are only available on the command-line.
44 By @q{command-line}, we mean the command line in the operating system.
45 Windows users might be more familiar with the terms @q{DOS shell} or
46 @q{command shell}. MacOS@tie{}X users might be more familiar with the terms
47 @q{terminal} or @q{console}. Some additional setup is required
48 for MacOS@tie{}X users; please see @rweb{MacOS X}.
50 Describing how to use this part of an operating system is outside the
51 scope of this manual; please consult other documentation on this topic
52 if you are unfamiliar with the command-line.
56 * Basic command line options for LilyPond::
57 * Advanced command line options for LilyPond::
58 * Environment variables::
59 * LilyPond in chroot jail::
62 @node Invoking LilyPond
63 @unnumberedsubsec Invoking @command{lilypond}
65 The @command{lilypond} executable may be called as follows from
69 lilypond [@var{option}]@dots{} @var{file}@dots{}
72 When invoked with a filename that has no extension, the @file{.ly}
73 extension is tried first. To read input from stdin, use a
74 dash (@code{-}) for @var{file}.
76 When @file{filename.ly} is processed it will produce @file{filename.ps}
77 and @file{filename.pdf} as output. Several files can be specified;
78 they will each be processed independently. @footnote{The status of
79 GUILE is not reset after processing a @code{.ly} file, so be careful
80 not to change any system defaults from within Scheme.}
82 If @file{filename.ly} contains more than one @code{\book}
83 block, then the rest of the scores will be output in numbered files,
84 starting with @file{filename-1.pdf}. In addition, the value of
85 @code{output-suffix} will be inserted between the basename and the
86 number. An input file containing
89 #(define output-suffix "violin")
91 #(define output-suffix "cello")
96 will output @var{base}@file{-violin.pdf} and
97 @var{base}@file{-cello-1.pdf}.
100 @unnumberedsubsubsec Using LilyPond with standard shell features
102 Since LilyPond is a command line application, features of the @q{shell}
103 used for calling LilyPond can also be put to good use.
112 will process all LilyPond files in the current directory.
114 Redirecting the console output (e.g. to a file) may also be useful:
117 lilypond file.ly 1> stdout.txt
119 lilypond file.ly 2> stderr.txt
121 lilypond file.ly &> all.txt
125 Redirects @q{normal} output, @q{errors} only or @q{everything},
126 respectively, to a text file. Consult the documentation for your
127 particular shell, Command (Windows), Terminal or Console
128 applications (MacOS X) to see if output redirection is supported or if
129 the syntax is different.
131 The following example searches and processes all input files in the
132 current directory and all directories below it recursively. The output
133 files will be located in the same directory that the command was run in,
134 rather than in the same directories as the original input files.
137 find . -name '*.ly' -exec lilypond '@{@}' \;
141 This should also work for MacOS@tie{}X users.
143 A Windows user would run;
146 forfiles /s /M *.ly /c "cmd /c lilypond @@file"
150 entering these commands in a @code{command prompt} usually found under
151 @code{Start > Accessories > Command Prompt} or for version 8 users,
152 by typing in the search window @q{command prompt}.
154 Alternatively, an explicit path to the top-level of your folder
155 containing all the sub-folders that have input files in them can be
156 stated using the @code{/p} option;
159 forfiles /s /p C:\Documents\MyScores /M *.ly /c "cmd /c lilypond @@file"
162 If there are spaces in the path to the top-level folder, then the whole
163 path needs to be inside double quotes;
166 forfiles /s /p "C:\Documents\My Scores" /M *.ly /c "cmd /c lilypond @@file"
170 @node Basic command line options for LilyPond
171 @unnumberedsubsec Basic command line options for LilyPond
173 @cindex Invoking @command{lilypond}
174 @cindex command line options for @command{lilypond}
175 @cindex options, command line
178 The following options are supported:
185 PDF files generated will be much larger than normal (due to little or no
186 font optimization). However, if two or more PDF files are included
187 within @w{@code{pdftex}}, @w{@code{xetex}} or @w{@code{luatex}}
188 documents they can then be processed further via ghostscript (merging
189 duplicated font data) resulting in @emph{significantly} smaller PDF
196 Then run @code{ghostscript};
199 gs -q -sDEVICE=pdfwrite -o gsout.pdf myfile.pdf
202 @code{pdfsizeopt.py} can then be used to further optimize the size
206 pdfsizeopt.py --use-multivalent=no gsout.pdf final.pdf
210 @item -d, --define-default=@var{var}=@var{val}
211 See @ref{Advanced command line options for LilyPond}.
213 @cindex Scheme, expression evaluation
214 @cindex expression evaluation, Scheme
216 @item -e, --evaluate=@var{expr}
217 Evaluate the Scheme @var{expr} before parsing any @file{.ly} files.
218 Multiple @option{-e} options may be given, they will be evaluated
221 The expression will be evaluated in the @code{guile-user} module, so
222 if you want to use definitions in @var{expr}, use
225 lilypond -e '(define-public a 42)'
229 on the command-line, and include
232 #(use-modules (guile-user))
236 at the top of the @code{.ly} file.
238 @warning{Windows users must use double quotes instead of single quotes.}
240 @cindex output, format
241 @cindex format, output
243 @item -f, --format=@var{format}
244 which formats should be written. Choices for @code{format} are
245 @code{ps}, @code{pdf}, and @code{png}.
247 Example: @code{lilypond -fpng @var{filename}.ly}
250 Show a summary of usage.
252 @item -H, --header=@var{FIELD}
253 Dump a header field to file @file{BASENAME.@var{FIELD}}.
255 @item -i, --init=@var{file}
256 Set init file to @var{file} (default: @file{init.ly}).
258 @cindex file searching
261 @item -I, --include=@var{directory}
262 Add @var{directory} to the search path for input files.
264 Multiple -I options may be given. The search will start in the first
265 defined directory, and if the file to be included is not found the
266 search will continue in subsequent directories.
268 @cindex chroot jail, running inside
270 @item -j, --jail=@var{user},@var{group},@var{jail},@var{dir}
271 Run @command{lilypond} in a chroot jail.
273 The @option{--jail} option provides a more flexible alternative to
274 @option{-dsafe}, when LilyPond formatting is being provided via a web
275 server, or whenever LilyPond executes commands sent by external sources
276 (see @ref{Advanced command line options for LilyPond}).
278 It works by changing the root of @command{lilypond} to @var{jail} just
279 before starting the actual compilation process. The user and group are
280 then changed to match those provided, and the current directory is
281 changed to @var{dir}. This setup guarantees that it is not possible (at
282 least in theory) to escape from the jail. Note that for @option{--jail}
283 to work, @command{lilypond} must be run as root, which is usually
284 accomplished in a safe way using @command{sudo}.
286 Setting up a jail can be a relatively complex matter, as we must be sure
287 that LilyPond is able to find whatever it needs to compile the source
288 @emph{inside} the jail itself. A typical chroot jail will comprise the
293 @item Setting up a separate filesystem
294 A separate filesystem should be created for LilyPond, so that it can be
295 mounted with safe options such as @code{noexec}, @code{nodev}, and
296 @code{nosuid}. In this way, it is impossible to run executables or to
297 write directly to a device from LilyPond. If you do not want to create a
298 separate partition, just create a file of reasonable size and use it to
299 mount a loop device. A separate filesystem also guarantees that LilyPond
300 cannot write more space than it is allowed.
302 @item Setting up a separate user
303 A separate user and group (say, @code{lily}/@code{lily}) with low
304 privileges should be used to run LilyPond inside the jail. There should
305 be a single directory writable by this user, which should be passed in
308 @item Preparing the jail
309 LilyPond needs to read a number of files while running. All these files
310 are to be copied into the jail, under the same path they appear in the
311 real root filesystem. The entire content of the LilyPond installation
312 (e.g., @file{/usr/share/lilypond}) should be copied.
314 If problems arise, the simplest way to trace them down is to run
315 LilyPond using @command{strace}, which will allow you to determine which
318 @item Running LilyPond
319 In a jail mounted with @code{noexec} it is impossible to execute any
320 external program. Therefore LilyPond must be run with a backend that
321 does not require any such program. As we have already mentioned, it
322 must be run with superuser privileges (which, of course, it will lose
323 immediately), possibly using @command{sudo}. It is also good practice
324 to limit the number of seconds of CPU time LilyPond can use (e.g., using
325 @command{ulimit@tie{}-t}), and, if your operating system supports it,
326 the amount of memory that can be allocated. Also see
327 @ref{LilyPond in chroot jail}.
331 @cindex output, verbosity
333 @item -l, --loglevel=@var{LEVEL}
334 Set the verbosity of the console output to @var{LEVEL}. Possible values
340 No output at all, not even error messages.
343 Only error messages, no warnings or progress messages.
346 Warnings and error messages, no progress.
349 Basic progress messages (success), warnings and errors.
352 All progress messages, warnings and errors.
355 Progress messages, warnings, errors and further execution information.
358 All possible messages, including verbose debug output.
362 @cindex directory, redirect output
363 @cindex output, setting filename
364 @cindex output, directory
366 @item -o, --output=@var{FILE} or @var{FOLDER}
367 Set the default output file to @var{FILE} or, if a folder with that name
368 exists, direct the output to @var{FOLDER}, taking the file name from the
369 input file. The appropriate suffix will be added (e.g. @code{.pdf} for
372 @cindex PS (Postscript), output
373 @cindex Postscript (PS), output
374 @cindex output, PS (Postscript)
379 @cindex PNG (Portable Network Graphics), output
380 @cindex output, PNG (Portable Network Graphics)
383 Generate pictures of each page, in PNG format. This implies
384 @option{--ps}. The resolution in DPI of the image may be set with
389 @cindex PDF (Portable Document Format), output
390 @cindex output, PDF (Portable Document Format)
393 Generate PDF. This implies @option{--ps}.
396 Show version information.
399 Be verbose: show full paths of all files read, and give timing
403 Show the warranty with which GNU LilyPond comes. (It comes with
404 @strong{NO WARRANTY}!)
409 @node Advanced command line options for LilyPond
410 @unnumberedsubsec Advanced command line options for LilyPond
414 @item -d@var{[option-name]}=@var{[value]},
415 --define-default=@var{[option-name]}=@var{[value]}
416 This sets the equivalent internal Scheme function to @var{value}. For
423 If a @var{value} is not supplied, then the default value is used. The
424 prefix @code{no-} may be added to @var{option-name} to switch @q{off} an
427 @cindex point and click, command line
440 @noindent The following are supported along with their respective
443 @multitable @columnfractions .33 .16 .51
444 @item @strong{Symbol}
446 @tab @strong{Explanation/Options}
448 @item @code{anti-alias-factor}
450 @tab Render at a higher resolution (using the given factor) and scale
451 down the result to prevent @q{jaggies} in @code{PNG} images.
453 @item @code{aux-files}
455 @tab Create @code{.tex}, @code{.texi} and @code{.count} files when used
456 with the @code{eps} backend option.
460 @tab This is the default setting. Postscript files (default) include
461 @code{TTF}, @code{Type1} and @code{OTF} fonts. No @q{subsetting} of
462 these fonts is done. Be aware that using @q{oriental} character sets
463 can lead to very large file sizes.
467 @tab Used as default by the @command{lilypond-book} command. This dumps
468 every page as both a single file with all pages and fonts included and
469 as separate encapsulated postscipt files for each page but without fonts
474 @tab Do not output a printed score. This the same effect as
475 @code{-dno-print-pages}.
479 @tab This dumps out the raw, internal Scheme-based drawing commands.
483 @tab Scalable Vector Graphics.
484 A single SVG file is created for every page of output. Apart from
485 LilyPond's own music glyphs, no other font information will be included.
486 Any SVG viewer will therefore require the fonts be available to it for
487 the proper rendering of both text and lyrics. It is recommended to not
488 to use font @q{aliases} or @q{lists} in case the SVG viewer is unable to
489 handle them. When using @emph{Web Open Font Format} (WOFF) files the
490 additional @code{--svg-woff} switch is required.
494 @strong{Note for backend svg output:}
495 LilyPond's default fonts (@code{LilyPond Serif},
496 @code{LilyPond Sans Serif} and @code{LilyPond Monospace}) are just
497 @emph{local} font aliases. Therefore, when using the backend @code{svg}
498 command you must explicitly define the default fonts in your source
505 (make-pango-font-tree "TeX Gyre Schola"
508 (/ staff-height pt 20)))
513 Also see @ruser{Entire document fonts}.
515 @multitable @columnfractions .33 .16 .51
516 @item @code{check-internal-types}
518 @tab Check every property assignment for types.
520 @item @code{clip-systems}
522 @tab Extract music fragments out of a score. This requires that the
523 @code{clip-regions} function has been defined within the @code{\layout}
524 block. See @ruser{Extracting fragments of music}. No fragments are
525 extracted though if used with the @option{-dno-print-pages} option.
529 @tab Prefix for data files (read-only).
531 @item @code{debug-gc}
533 @tab Dump memory debugging statistics.
535 @item @code{debug-gc-assert-parsed-dead}
537 @tab For memory debugging: Ensure that all references to parsed objects
538 are dead. This is an internal option, and is switched on automatically
539 for @code{`-ddebug-gc'}.
541 @item @code{debug-lexer}
543 @tab Debug the flex lexer.
545 @item @code{debug-page-breaking-scoring}
547 @tab Dump scores for many different page breaking configurations.
549 @item @code{debug-parser}
551 @tab Debug the bison parser.
553 @item @code{debug-property-callbacks}
555 @tab Debug cyclic callback chains.
557 @item @code{debug-skylines}
561 @item @code{delete-intermediate-files}
563 @tab Delete the unusable, intermediate @code{.ps} files created during
566 @item @code{dump-cpu-profile}
568 @tab Dump timing information (system-dependent).
570 @item @code{dump-profile}
572 @tab Dump memory and time information for each file.
574 @item @code{dump-signatures}
576 @tab Dump output signatures of each system. Used for regression testing.
578 @item @code{eps-box-padding}
580 @tab Pad left edge of the output EPS bounding box by the given amount
583 @item @code{gs-load-fonts}
585 @tab Load fonts via Ghostscript.
587 @item @code{gs-load-lily-fonts}
589 @tab Load only the LilyPond fonts via Ghostscript.
593 @tab Runs silently and redirect all output to a log file.
597 @strong{Note to Windows users:} By default @code{lilypond.exe} outputs
598 all progress information to the command window,
599 @code{lilypond-windows.exe} does not and returns a prompt, with no
600 progress information, immediately at the command line. The
601 @option{-dgui} option can be used in this case to redirect output to a
604 @multitable @columnfractions .33 .16 .51
609 @item @code{include-book-title-preview}
611 @tab Include book titles in preview images.
613 @item @code{include-eps-fonts}
615 @tab Include fonts in separate-system EPS files.
617 @item @code{include-settings}
619 @tab Include file for global settings, this is included before the score
622 @item @code{job-count}
624 @tab Process in parallel, using the given number of jobs.
626 @item @code{log-file}
627 @tab @code{#f [file]}
628 @tab If string @code{FOO} is given as a second argument,
629 redirect output to the log file @code{FOO.log}.
631 @item @code{max-markup-depth}
633 @tab Maximum depth for the markup tree. If a markup has more levels,
634 assume it will not terminate on its own, print a warning and return a
637 @item @code{midi-extension}
639 @tab Set the default file extension for MIDI output file to given
642 @item @code{music-strings-to-paths}
644 @tab Convert text strings to paths when glyphs belong to a music font.
646 @item @code{paper-size}
648 @tab Set default paper size. Note the string must be enclosed in
649 escaped double quotes.
651 @item @code{pixmap-format}
653 @tab Set GhostScript's output format for pixel images.
655 @item @code{point-and-click}
657 @tab Add @q{point & click} links to PDF and SVG output.
658 See @ref{Point and click}.
662 @tab Create preview images in addition to normal output.
666 This option is supported by all backends; @code{pdf}, @code{png},
667 @code{ps}, @code{eps} and @code{svg}, but not @code{scm}. It generates
668 an output file, in the form @code{myFile.preview.extension}, containing
669 the titles and the first system of music. If @code{\book} or
670 @code{\bookpart} blocks are used, the titles of @code{\book},
671 @code{\bookpart} or @code{\score} will appear in the output, including
672 the first system of every @code{\score} block if the @code{\paper}
673 variable @code{print-all-headers} is set to @code{#t}.
675 To suppress the usual output, use the @option{-dprint-pages} or
676 @option{-dno-print-pages} options according to your requirements.
678 @multitable @columnfractions .33 .16 .51
679 @item @code{print-pages}
681 @tab Generate full pages, the default. @option{-dno-print-pages} is
682 useful in combination with @option{-dpreview}.
684 @item @code{profile-property-accesses}
686 @tab Keep statistics of @code{get_property()} function calls.
688 @item @code{protected-scheme-parsing}
690 @tab Continue when errors in inline scheme are caught in the parser. If
691 set to @code{#f}, halt on errors and print a stack trace.
693 @item @code{read-file-list}
694 @tab @code{#f [file]}
695 @tab Specify name of a file which contains a list of input files to be
698 @item @code{relative-includes}
700 @tab When processing an @code{\include} command, look for the included
701 file relative to the current file (instead of the root file).
703 @item @code{resolution}
705 @tab Set resolution for generating @code{PNG} pixmaps to given value (in
710 @tab Do not trust the @code{.ly} input.
714 When LilyPond formatting is available through a web server, either the
715 @option{--safe} or the @option{--jail} option @b{MUST} be passed. The
716 @option{--safe} option will prevent inline Scheme code from wreaking
721 #(s ystem "rm -rf /") % too dangerous to write correctly
723 c4^$(ly:gulp-file "/etc/passwd") % malicious but not destructive
728 The @option{-dsafe} option works by evaluating in-line Scheme
729 expressions in a special safe module. This is derived from GUILE
730 @file{safe-r5rs} module, but also adds a number of functions of the
731 LilyPond API which are listed in @file{scm/safe-lily.scm}.
733 In addition, safe mode disallows @code{\include} directives and
734 disables the use of backslashes in @TeX{} strings. It is also not
735 possible to import LilyPond variables into Scheme while in safe mode.
737 @option{-dsafe} does @emph{not} detect resource overuse, so it is still
738 possible to make the program hang indefinitely, for example by feeding
739 cyclic data structures into the backend. Therefore, if using LilyPond
740 on a publicly accessible webserver, the process should be limited in
741 both CPU and memory usage.
743 Safe mode will prevent many useful LilyPond snippets from being
746 The @option{--jail} is an even more secure alternative, but requires
747 more work to set up. See @ref{Basic command line options for LilyPond}.
749 @multitable @columnfractions .33 .16 .51
750 @item @code{separate-log-files}
752 @tab For input files @code{FILE1.ly}, @code{FILE2.ly}, etc. output log
753 data to files @code{FILE1.log}, @code{FILE2.log}@dots{}
755 @item @code{show-available-fonts}
757 @tab List available font names.
759 @item @code{strict-infinity-checking}
761 @tab Force a crash on encountering @code{Inf} and @code{NaN} floating
764 @item @code{strip-output-dir}
766 @tab Don't use directories from input files while constructing output
769 @item @code{strokeadjust}
771 @tab Force PostScript stroke adjustment. This option is mostly
772 relevant when a PDF is generated from PostScript output (stroke
773 adjustment is usually enabled automatically for low-resolution bitmap
774 devices). Without this option, PDF previewers tend to produce widely
775 inconsistent stem widths at resolutions typical for screen display. The
776 option does not noticeably affect print quality and causes large file
777 size increases in PDF files.
779 @item @code{svg-woff}
781 @tab This option is required when using Web Open Font Format (WOFF) font
782 files with the backend @code{svg} command. A single SVG file is created
783 for every page of output. Apart from LilyPond's own music glyphs, no
784 other font information will be included. Any SVG viewer will therefore
785 require the fonts be available to it for the proper rendering of both
786 text and lyrics. It is also recommended not to use any font @q{aliases}
787 or @q{lists} in case the SVG viewer cannot handle them.
789 @item @code{trace-memory-frequency}
791 @tab Record Scheme cell usage this many times per second. Dump the
792 results to @code{FILE.stacks} and @code{FILE.graph}.
794 @item @code{trace-scheme-coverage}
796 @tab Record coverage of Scheme files in @code{FILE.cov}.
800 @tab Verbose output, i.e. loglevel at DEBUG (read-only).
802 @item @code{warning-as-error}
804 @tab Change all warning and @q{programming error} messages into errors.
808 @node Environment variables
809 @unnumberedsubsec Environment variables
812 @cindex LILYPOND_DATADIR
814 @command{lilypond} recognizes the following environment variables:
816 @item LILYPOND_DATADIR
817 This specifies a directory where locale messages and
818 data files will be looked up by default. The directory should contain
819 subdirectories called @file{ly/}, @file{ps/}, @file{tex/}, etc.
822 This selects the language for the warning messages.
824 @item LILYPOND_LOGLEVEL
825 The default loglevel. If LilyPond is called without an explicit loglevel
826 (i.e. no @option{--loglevel} command line option), this value is used.
828 @item LILYPOND_GC_YIELD
829 A variable, as a percentage, that tunes memory management
830 behavior. A higher values means the program uses more memory, a
831 smaller value means more CPU time is used. The default value is
837 @node LilyPond in chroot jail
838 @unnumberedsubsec LilyPond in chroot jail
840 Setting up the server to run LilyPond in a chroot jail is a complicated
841 task. The steps are listed below. Examples in the steps are from
842 Ubuntu GNU/Linux, and may require the use of @code{sudo} as appropriate.
846 @item Install the necessary packages: LilyPond, GhostScript, and ImageMagick.
848 @item Create a new user by the name of @code{lily}:
855 This will create a new group for the @code{lily} user as well, and a
856 home folder, @code{/home/lily}
858 @item In the home folder of the @code{lily} user create a file to use as a
862 dd if=/dev/zero of=/home/lily/loopfile bs=1k count= 200000
866 This example creates a 200MB file for use as the jail filesystem.
868 @item Create a loop device, make a file system and mount it, then create
869 a folder that can be written by the @code{lily} user:
873 losetup /dev/loop0 /home/lily/loopfile
874 mkfs -t ext3 /dev/loop0 200000
875 mount -t ext3 /dev/loop0 /mnt/lilyloop
876 mkdir /mnt/lilyloop/lilyhome
877 chown lily /mnt/lilyloop/lilyhome
880 @item In the configuration of the servers, the JAIL will be @code{/mnt/lilyloop}
881 and the DIR will be @code{/lilyhome}.
883 @item Create a big directory tree in the jail by copying the necessary files, as
884 shown in the sample script below.
886 You can use @code{sed} to create the necessary copy commands for a given
890 for i in "/usr/local/lilypond/usr/bin/lilypond" "/bin/sh" "/usr/bin/; \
891 do ldd $i | sed 's/.*=> \/\(.*\/\)\([^(]*\).*/mkdir -p \1 \&\& \
892 cp -L \/\1\2 \1\2/' | sed 's/\t\/\(.*\/\)\(.*\) (.*)$/mkdir -p \
893 \1 \&\& cp -L \/\1\2 \1\2/' | sed '/.*=>.*/d'; done
898 @subheading Example script for 32-bit Ubuntu 8.04
906 loopdevice=/dev/loop0
907 jaildir=/mnt/lilyloop
908 # the prefix (without the leading slash!)
910 # the directory where lilypond is installed on the system
911 lilydir=/$lilyprefix/lilypond/
913 userhome=$home/$username
914 loopfile=$userhome/loopfile
916 dd if=/dev/zero of=$loopfile bs=1k count=200000
918 losetup $loopdevice $loopfile
919 mkfs -t ext3 $loopdevice 200000
920 mount -t ext3 $loopdevice $jaildir
921 mkdir $jaildir/lilyhome
922 chown $username $jaildir/lilyhome
925 mkdir -p bin usr/bin usr/share usr/lib usr/share/fonts $lilyprefix tmp
928 cp -r -L $lilydir $lilyprefix
929 cp -L /bin/sh /bin/rm bin
930 cp -L /usr/bin/convert /usr/bin/gs usr/bin
931 cp -L /usr/share/fonts/truetype usr/share/fonts
933 # Now the library copying magic
934 for i in "$lilydir/usr/bin/lilypond" "$lilydir/usr/bin/guile" "/bin/sh" \
935 "/bin/rm" "/usr/bin/gs" "/usr/bin/convert"; do ldd $i | sed 's/.*=> \
936 \/\(.*\/\)\([^(]*\).*/mkdir -p \1 \&\& cp -L \/\1\2 \1\2/' | sed \
937 's/\t\/\(.*\/\)\(.*\) (.*)$/mkdir -p \1 \&\& cp -L \/\1\2 \1\2/' \
938 | sed '/.*=>.*/d'; done | sh -s
940 # The shared files for ghostscript...
941 cp -L -r /usr/share/ghostscript usr/share
942 # The shared files for ImageMagick
943 cp -L -r /usr/lib/ImageMagick* usr/lib
945 ### Now, assuming that you have test.ly in /mnt/lilyloop/lilyhome,
946 ### you should be able to run:
947 ### Note that /$lilyprefix/bin/lilypond is a script, which sets the
948 ### LD_LIBRARY_PATH - this is crucial
949 /$lilyprefix/bin/lilypond -jlily,lily,/mnt/lilyloop,/lilyhome test.ly
952 @c " keep quote signs balanced for context-sensitive editors
955 @section Error messages
957 @cindex error messages
958 Different error messages can appear while compiling a file:
964 Something looks suspect. If you are requesting something out of the
965 ordinary then you will understand the message, and can ignore it.
966 However, warnings usually indicate that something is wrong with the
971 Something is definitely wrong. The current processing step (parsing,
972 interpreting, or formatting) will be finished, but the next step will
977 Something is definitely wrong, and LilyPond cannot continue. This
978 happens rarely. The most usual cause is misinstalled fonts.
981 @cindex trace, Scheme
984 Errors that occur while executing Scheme code are caught by the Scheme
985 interpreter. If running with the verbose option (@option{-V} or
986 @option{--verbose}) then a call trace of the offending
987 function call is printed.
989 @item Programming error
990 @cindex Programming error
991 There was some internal inconsistency. These error messages are
992 intended to help the programmers and debuggers. Usually, they can be
993 ignored. Sometimes, they come in such big quantities that they obscure
996 @item Aborted (core dumped)
997 @cindex Aborted (core dumped)
998 This signals a serious programming error that caused the program to
999 crash. Such errors are considered critical. If you stumble on one,
1003 @cindex errors, message format
1004 If warnings and errors can be linked to some part of the input file,
1005 then error messages have the following form
1008 @var{filename}:@var{lineno}:@var{columnno}: @var{message}
1009 @var{offending input line}
1012 A line-break is inserted in the offending line to indicate the column
1013 where the error was found. For example,
1016 test.ly:2:19: error: not a duration: 5
1021 These locations are LilyPond's best guess about where the warning or
1022 error occurred, but (by their very nature) warnings and errors occur
1023 when something unexpected happens. If you can't see an error in the
1024 indicated line of your input file, try checking one or two lines
1025 above the indicated position.
1027 Please note that diagnostics can be triggered at any point during the
1028 many stages of processing. For example if there are parts of the input
1029 that are processed multiple times (i.e. in midi and layout output), or
1030 if the same music variable is used in multiple contexts the same message
1031 may appear several times. Diagnostics produced at a @q{late} stage (i.e
1032 bar checks) might also be issued multiple times.
1034 More information about errors is given in @ref{Common errors}.
1038 @section Common errors
1040 The error conditions described below occur often, yet the cause
1041 is not obvious or easily found. Once seen and understood, they
1046 * Music runs off the page::
1047 * An extra staff appears::
1048 * Error message Unbound variable %::
1049 * Error message FT_Get_Glyph_Name::
1050 * Warning staff affinities should only decrease::
1051 * Error message unexpected new::
1052 * Warning this voice needs a voiceXx or shiftXx setting::
1055 @node Music runs off the page
1056 @unnumberedsubsec Music runs off the page
1058 Music running off the page over the right margin or appearing
1059 unduly compressed is almost always due to entering an incorrect
1060 duration on a note, causing the final note in a measure to extend
1061 over the bar line. It is not invalid if the final note in a
1062 measure does not end on the automatically entered bar line, as the
1063 note is simply assumed to carry over into the next measure. But
1064 if a long sequence of such carry-over measures occurs the music
1065 can appear compressed or may flow off the page because automatic
1066 line breaks can be inserted only at the end of complete measures,
1067 i.e., where all notes end before or at the end of the measure.
1069 @warning{An incorrect duration can cause line breaks to be
1070 inhibited, leading to a line of highly compressed music or
1071 music which flows off the page.}
1073 The incorrect duration can be found easily if bar checks are used,
1074 see @ruser{Bar and bar number checks}.
1076 If you actually intend to have a series of such carry-over measures
1077 you will need to insert an invisible bar line where you want the
1078 line to break. For details, see @ruser{Bar lines}.
1081 @node An extra staff appears
1082 @unnumberedsubsec An extra staff appears
1084 If contexts are not created explicitly with @code{\new} or
1085 @code{\context}, they will be silently created as soon as a
1086 command is encountered which cannot be applied to an existing
1087 context. In simple scores the automatic creation of contexts is
1088 useful, and most of the examples in the LilyPond manuals take
1089 advantage of this simplification. But occasionally the silent
1090 creation of contexts can give rise to unexpected new staves or
1091 scores. For example, it might be expected that the following code
1092 would cause all note heads within the following staff to be
1093 colored red, but in fact it results in two staves with the note
1094 heads remaining the default black in the lower staff.
1096 @lilypond[quote,verbatim,fragment]
1097 \override Staff.NoteHead.color = #red
1101 This is because a @code{Staff} context does not exist when the
1102 override is processed, so one is implicitly created and the override
1103 is applied to it, but then the @code{\new Staff} command creates
1104 another, separate, staff into which the notes are placed. The
1105 correct code to color all note heads red is
1107 @lilypond[quote,verbatim]
1109 \override Staff.NoteHead.color = #red
1114 @node Error message Unbound variable %
1115 @unnumberedsubsec Error message Unbound variable %
1117 This error message will appear at the bottom of the console
1118 output or log file together with a @qq{GUILE signalled an error @dots{}}
1119 message every time a Scheme routine is called which (invalidly)
1120 contains a @emph{LilyPond} rather than a @emph{Scheme} comment.
1122 LilyPond comments begin with a percent sign, (@code{%}), and must
1123 not be used within Scheme routines. Scheme comments begin with a
1124 semi-colon, (@code{;}).
1126 @node Error message FT_Get_Glyph_Name
1127 @unnumberedsubsec Error message FT_Get_Glyph_Name
1129 This error messages appears in the console output or log file if
1130 an input file contains a non-ASCII character and was not saved in
1131 UTF-8 encoding. For details, see @ruser{Text encoding}.
1134 @node Warning staff affinities should only decrease
1135 @unnumberedsubsec Warning staff affinities should only decrease
1137 This warning can appear if there are no staves in the printed
1138 output, for example if there are just a @code{ChordName} context
1139 and a @code{Lyrics} context as in a lead sheet. The warning
1140 messages can be avoided by making one of the contexts behave as a
1144 \override VerticalAxisGroup.staff-affinity = ##f
1148 at its start. For details, see @qq{Spacing of non-staff lines} in
1149 @ruser{Flexible vertical spacing within systems}.
1152 @node Error message unexpected new
1153 @unnumberedsubsec Error message unexpected @code{@bs{}new}
1155 A @code{\score} block must contain a @emph{single} music expression.
1156 If instead it contains several @code{\new Staff},
1157 @code{\new StaffGroup} or similar contexts introduced with @code{\new}
1158 without them being enclosed in either curly brackets,
1159 @code{@{ @dots{} @}}, or double angle brackets, @code{<< @dots{} >>},
1164 % Invalid! Generates error: syntax error, unexpected \new
1165 \new Staff @{ @dots{} @}
1166 \new Staff @{ @dots{} @}
1171 the error message will be produced.
1173 To avoid the error, enclose all the @code{\new} statements in
1174 curly or double angle brackets.
1176 Using curly brackets will introduce the @code{\new} statements
1179 @lilypond[quote,verbatim]
1182 \new Staff { a' a' a' a' }
1183 \new Staff { g' g' g' g' }
1189 but more likely you should be using double angle brackets so the new
1190 staves are introduced in parallel, i.e. simultaneously:
1192 @lilypond[quote,verbatim]
1195 \new Staff { a' a' a' a' }
1196 \new Staff { g' g' g' g' }
1201 @node Warning this voice needs a voiceXx or shiftXx setting
1202 @unnumberedsubsec Warning this voice needs a @code{@bs{}voiceXx}
1203 or @code{@bs{}shiftXx} setting
1205 If notes from two different voices with stems in the same direction
1206 occur at the same musical moment, but the voices have no
1207 voice-specific shifts specified, the warning message
1208 @samp{warning: this voice needs a \voiceXx or \shiftXx setting} will appear
1209 when compiling the LilyPond file. This warning will appear even when
1210 the notes have no visible stems, e.g. whole notes, if the stems for
1211 shorter notes at the same pitch would be in the same direction.
1213 Remember that the stem direction depends on the position of the
1214 note on the staff unless the stem direction is specified, for example
1215 by using @code{\voiceOne}, etc. In this case the warning will appear
1216 only when the stems happen to be in the same direction, i.e. when the
1217 notes are in the same half of the staff.
1219 By placing the notes in voices with stem directions and shifts
1220 specified, for example by using @code{\voiceOne}, etc., these warnings
1223 Notes in higher numbered voices, @code{\voiceThree} etc., are
1224 automatically shifted to avoid clashing note columns. This causes a
1225 visible shift for notes with stems, but whole notes are not visibly
1226 shifted unless an actual clash of the note heads occurs, or when the
1227 voices cross over from their natural order (when @code{\voiceThree}
1228 is higher than @code{\voiceOne}, etc.)
1231 @rlearning{Explicitly instantiating voices},
1232 @rlearning{Real music example},
1233 @ruser{Single-staff polyphony},
1234 @ruser{Collision resolution}.