Ian Hulin <i...@hulin.org.uk> writes:

> I am compiling a file which references some modules declared in source
> files present in the %load-path.  However I get a "no code for (xxx
> yyy)" error when I attempt to compile with guild compile.
>
> Guile version 2.0.3
> Ubuntu 11.10
>
> I am running the compilation from a shell command procedure as follows
> (the PWD is /home/ian/src/lilypond):
> declare -x GUILE_LOAD_COMPILED_PATH='/home/ian/src/lilypond/scm/out'
> declare -x GUILE_AUTO_COMPILE=0
> guild compile scm/lily-guile2.scm \
> --load-path=/home/ian/src/lilypond/scm/ \
> --warn=unbound-variable \
> --output=scm/out/lily-guile2.go
>
>
> lily-guile2.scm starts as follows:
>
>
> (eval-when (compile load eval)
> (display "%load-path: ")
> (display %load-path) (newline)
> (display (%search-load-path "clip-region")) (newline)
> (display (%search-load-path "memory-trace")) (newline)
> (display (%search-load-path "coverage")) (newline)
> (display (%search-load-path "safe-utility-defs")) (newline))
>
> (use-modules (scm clip-region)
>              (scm memory-trace)
>              (scm coverage)
>            (scm safe-utility-defs))
>
> I've attached the trace-back below.  It looks like the use-modules code
> isn't doing the right thing in translating the module name list into a
> file system path and file-name (as in 6.19.1 General Information about
> Modules, pages 385-386).

This is your mistake, I would say.

Lets see, quoting
https://www.gnu.org/software/guile/manual/html_node/General-Information-about-Modules.html
 

To use a module, it must be found and loaded. All Guile modules have a
unique module name, which is a list of one or more symbols. Examples are
(ice-9 popen) or (srfi srfi-11). When Guile searches for the code of a
module, it constructs the name of the file to load by concatenating the
name elements with slashes between the elements and appending a number
of file name extensions from the list %load-extensions (see
Loading). The resulting file name is then searched in all directories in
the variable %load-path (see Build Config). For example, the (ice-9
popen) module would result in the filename ice-9/popen.scm and searched
in the installation directories of Guile and in all other directories in
the load path.

So, for your example, (scm clip-region), it looks for
scm/clip-region.scm in %load-path, or in scheme
(%search-load-path "scm/clip-region")

Which fails to match in your case, because /home/ian/src/lilypond/scm/
is in your path, not /home/ian/src/lilypond/. And hence it will look for 
the existence of a /home/ian/src/lilypond/scm/scm/clip-region.scm. 

My advice is to change your %load-path, or if you prefer, use
(clip-region) instead of (scm clip-region), and so on.

-- 
Ian Price

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"



Reply via email to