
lilypond - issue #1349
Guile 2.0 compat: Scheme macros must be defined/autocompiled before they are used.
From Guile NEWS
** Macros need to be defined before their first use.
It used to be that with lazy memoization, this might work:
(define (foo x)
(ref x))
(define-macro (ref x) x)
(foo 1) => 1
But now, the body of foo' is interpreted to mean a call to the toplevel
ref' function, instead of a macro expansion. The solution is to define
macros before code that uses them
This shows up in LilyPond initialization as . . [/home/ian/lilypond/out/share/lilypond/current/scm/ly-syntax-constructors.scm] [/home/ian/lilypond/out/share/lilypond/current/scm/define-context-properties.scm] [/home/ian/lilypond/out/share/lilypond/current/scm/translation-functions.scm;;; note: autocompilation is et GUILE_AUTO_COMPILE=0 ;;; or pass the --no-autocompile argument to disable. ;;; compiling /home/ian/lilypond/scm/translation-functions.scm
error: Not a markup command: line compiling markup expression (#:line (#:slashed-digit figure))
Patrick has prototyped a solution which reorders the load-order and restructures the declaration of the markup commands. This tracker is to merge the code into the master repository.
Comment #1
Posted on Oct 20, 2010 by Happy CamelHi Ian,
As far as I can tell, my solution works fine, but it is really hacked together.
IWBN if we can reorganize the macros and procedures so that everything is still organized and coherent.
Comment #2
Posted on Feb 10, 2011 by Swift RhinoJan has tweaked some of this stuff in commit 05514c83a49dd3dfabd1fa7774c69c3038ecde6b , Author: Jan Nieuwenhuizen Date: Wed Feb 2 11:18:28 2011 +0100
Guile-1.9 compatibility fixes.
* remove #:use-syntax
* rewrite curried definitions
* change order of loading .scm files so that
markups are defined before used in code
Comment #3
Posted on Feb 17, 2011 by Happy CamelIan,
Jan did move a couple of functions around, but I still ran into compile failures as a result of markup expressions being undefined.
The reordering commits from my guile branch still "work", so I'll start cleaning them up to make the diff as minimal as possible.
Comment #4
Posted on Feb 17, 2011 by Happy Camel(No comment was entered for this change.)
Comment #5
Posted on Mar 16, 2011 by Quick Monkey@pnorcks: how is this coming along? LilyPond is now not even buildable anymore with latest guile stable-2.0
If you have a diff that works with current HEAD, I'd like to experiment with that in GUB's guile 2.0 branch.
Comment #6
Posted on Mar 17, 2011 by Quick MonkeyI found git://repo.or.cz/lilypond/patrick.git
Any reason for not doing this on savannah, on dev/patrick ?
Comment #7
Posted on Mar 18, 2011 by Happy CamelThanks for the suggestion. dev/patrick is now on savannah.
I just test-compiled LilyPond against guile commit 900a6f87bad on the stable-2.0 branch, with mixed results. The first two attempts ended in a segfault, and the third attempt succeeded.
I'll have to take a closer look... it seems that (since 2.0) Guile is more strict with regard to this whole macro issue. I didn't see this problem with the official Guile 2.0 release.
Comment #8
Posted on Mar 18, 2011 by Quick MonkeyThanks.
FWIW, I used it for schikkers list and I haven't seen any segfaults, guile stable-2.0: f80ed1be
I was almost going to suggest to push it to master.
Comment #9
Posted on Mar 19, 2011 by Happy CamelThanks, Jan. I don't see segfaults anymore with the snapshot from that commit.
With regard to merging the reordering stuff into master, I think it's actually hanging by a needle and thread... So, not yet. :)
Comment #10
Posted on Jun 21, 2011 by Swift RhinoI've started work on Issue 1686 to allow us to compile our scm/.scm files to scm/out/.go and have come across another "feature". It looks like we have .scm files in the list loaded by lily.scm that have dependencies on other .scm files earlier in the list (e.g. markup.scm defining markup?).
I think we need to do some janitor work so that definitions used like this are defined in lily-library.scm (which is the first file loaded in the list).
Cheers, Ian
Comment #11
Posted on Jun 21, 2011 by Happy Rhinowould it be possible to just change the order of files in the makefile? Or maybe have a SCM_ARE_DEPENDENCIES= variable (which are compiled before attempting the other scm files), or something? I'm not certain that including markups in lily-library.scm simply to work around a build system issue is a good solution.
Comment #12
Posted on Jun 21, 2011 by Swift RhinoWhat I'm doing in T1686 is adding support for a -d compile-scheme option, which will get lily.scm to byte-compile all the files which are currently loaded in the init-scheme-files list. We need to do it this way so we can have all the Scheme definitions available which are defined in the C++ initialization code etc.
I can't see a way of picking up a build system variable like SCM_ARE_DEPENDENCIES at run-time.
However we do it, it looks like the ordering of this list needs sorting.
Comment #13
Posted on Jun 22, 2011 by Happy CamelIan, check out my dev/patrick branch and see if any files from scm/ still fail to compile.
I haven't tested this in a while, so something may have broken again...
Comment #14
Posted on Jul 18, 2011 by Swift RhinoHi, I've been doing some testing in conjunction with Issue 1686. I can get all the files to load OK in the call from ly_c_init_guile (where lily.scm itself is loaded) but it then fails in the later call to lilypond-main in lily.scm.
Here's the tail of a --verbose run. At the moment it fails with both Guile 1.8 and 2.0.
Building font database...
Processing test.ly'
Parsing...
[/home/ian/src/lilypond/build/out/share/lilypond/current/ly/init.ly
[/home/ian/src/lilypond/build/out/share/lilypond/current/ly/declarations-init.ly
[/home/ian/src/lilypond/build/out/share/lilypond/current/ly/music-functions-init.ly]
[/home/ian/src/lilypond/build/out/share/lilypond/current/ly/toc-init.ly
/home/ian/src/lilypond/build/out/share/lilypond/current/ly/toc-init.ly:25:33: error: syntax error, unexpected MARKUP_FUNCTION, expecting SCM_IDENTIFIER or SCM_TOKEN
tocTitleMarkup = \markup \huge
\column {
/home/ian/src/lilypond/build/out/share/lilypond/current/ly/toc-init.ly:27:4: error: unknown escaped string:
\hspace'
\hspace #1
/home/ian/src/lilypond/build/out/share/lilypond/current/ly/toc-init.ly:28:2: error: syntax error, unexpected '}', expecting '='
} /home/ian/src/lilypond/build/out/share/lilypond/current/ly/toc-init.ly:29:37: error: syntax error, unexpected '{', expecting SCM_IDENTIFIER or SCM_TOKEN tocItemMarkup = \markup \fill-line { ERROR: In procedure apply: ERROR: Wrong type argument in position 1: # ian@nanny-ogg:~/src/lilypond/build$
I've put the current patch for this and T1686 on Rietveld as http://codereview.appspot.com/4760049. Any ideas for progressing with this would be appreciated, as otherwise I'm stuck at the moment.
Cheers, Ian Hulin
Comment #15
Posted on Aug 10, 2011 by Swift RhinoDisentangled load order issues from other Guile V2 issues. Running with Guile 1.8.7 now passes make and regtests.
Patch available for review
http:://codereview/appspot.com/4849054
Ian Hulin
Comment #16
Posted on Aug 16, 2011 by Swift RhinoComment deleted
Comment #17
Posted on Aug 16, 2011 by Swift RhinoThe patch needs modifying to handle upstream changes to scm/lily.scm for logging and tracing introduced by Reinhold.
I'll also have another attempt at moving the Scheme definition of markup to scm/markup-macros.scm as per Neil's suggestion in the Rietveld review.
Comment #18
Posted on Aug 16, 2011 by Swift Rhino(No comment was entered for this change.)
Comment #19
Posted on Aug 16, 2011 by Swift OxIs there any way I can help with rebasing/updating that patch after my changes? Reinhold
Comment #20
Posted on Aug 16, 2011 by Swift RhinoReinhold, No problems, it's merged OK. I just wanted to make sure I didn't stamp on any of your upstream changes for loglevel.
Neil, I have had another try at moving the markup definition to markup-macros.scm but it regresses the change when running when running with V2.
I'm happy with Patchset 7 going for countdown.
Ian
Comment #21
Posted on Aug 18, 2011 by Happy CamelIan is handling this issue.
Comment #22
Posted on Aug 20, 2011 by Happy Rhinopatch here: http://www.codereview.appspot.com/4849054
Comment #23
Posted on Aug 20, 2011 by Swift RhinoHi Graham, I would push the patch myself, but I can't get the ssh connection to Savannah to work :-{.
I followed the instructions from the CG you sent re git push access.
I've tried generating and using both dsa and rsa public keys, and
entering them on the Savannah My Account/Account Configuration page,
but I still can't get git pull --verbose to work. This is frustrating -
grrrrr...
Comment #24
Posted on Aug 20, 2011 by Happy Rhino(No comment was entered for this change.)
Comment #25
Posted on Aug 21, 2011 by Happy Rhino(No comment was entered for this change.)
Comment #26
Posted on Aug 22, 2011 by Swift RhinoPushed as commit - f41963f0b6135c02c363f8401628e85b9bc60def Thanks to Carl for facilitating this,
Cheers Ian
Comment #27
Posted on Aug 29, 2011 by Happy BirdThanks for commit id.)
Status: Verified
Labels:
Priority-High
Patch-review
Type-Enhancement