bug#52230: 'guild compile' and C(++) extensions (in the context of LilyPond)
Jean Abou Samra <[email protected]>
| Newsgroups | gmane.lisp.guile.bugs,gmane.lisp.guile.user,gmane.lisp.guile.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, (Cross-posted to guile-user, guile-devel and the debbugs issue, I'm unsure where this should go.) In LilyPond, we have now made a development release with binaries using Guile 2.2. However, a major problem is that we don't ship Guile bytecode yet. Notably, one problem to get the bytecode in a build system is that we are currently forced to use GUILE_AUTO_COMPILE=1 to generate it -- which means we need to compile the entire suite of regression tests in order to exercise all files. This also means spurious test differences when Guile gets noisy about byte-compilation (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16364). In summary: it would mean a lot less headache to be able to use 'guild compile'. Unfortunately, this does not work. One issue is that our Scheme files are mostly not Guile modules, but loaded directly with primitive-load-path. This will be a lot of work to fix, but it is on our end. However, I don't understand how to get around another issue, which is how our Scheme code interfaces with C++. https://debbugs.gnu.org/cgi/bugreport.cgi?bug=52230 Basically, if a Scheme file has something like (define-public point-stencil (ly:make-stencil "" '(0 . 0) '(0 . 0))) where ly:make-stencil is a procedure defined in C++, I can get this file to compile, but I can't get files using it as a module to compile. Investigation shows that Guile is apparently trying to load the module when compiling. $ cat print.scm (define-module (print)) (display "Module running!") $ guild compile print.scm wrote `/home/jean/.cache/guile/ccache/3.0-LE-8-4.4/home/jean/repos/lilypond/print.scm.go' $ cat import.scm (use-modules (print)) $ guild compile -L . print.scm wrote `/home/jean/.cache/guile/ccache/3.0-LE-8-4.4/home/jean/repos/lilypond/print.scm.go' $ guild compile -L . import.scm Module running!wrote `/home/jean/.cache/guile/ccache/3.0-LE-8-4.4/home/jean/repos/lilypond/import.scm.go' For functions defined in C++, that does not work: they are added by the entry point in the function that scm_boot_guile calls, using scm_c_define_gsubr. They aren't defined until the program is actually run. So how is 'guild compile' supposed to work with C(++) code? Thanks in advance, Jean