[CM] cload rebuilds don't consider *load-path*

Brad Christensen bchristensen-lists at outlook.com
Sat Aug 21 11:05:26 PDT 2021


Consider the following project tree, with the current working directory being 'some-project':

|-- source/scheme/some-lib
|    |-- example.scm --> (which uses cload to build a library)
| . . .

When *load-path* contains "source/scheme", the following load works as expected:

> (load "some-lib/example.scm")

However, it will not rewrite and rebuild the corresponding .c file, even when example.scm is newer than the previously generated .so library. For that, the path given to load needs to be the entire path from the cwd:

> (load "source/scheme/some-lib/example.scm")

I believe this is because the load-path is not considered when setting `port-filename`. Even though the file to load was found via a path in *load-path*, it believes itself not to exist when testing for a rebuild of the library. See line 741 in cload.scm, the conditional test for writing and building the .c file:

736       (unless (and output-name
737                    (file-exists? c-file-name)
738                    (file-exists? so-file-name)
739                    (provided? 'system-extras)
740                    (>= (file-mtime so-file-name) (file-mtime c-file-name))
741                    (not (and (file-exists? (port-filename))
742                              (< (file-mtime so-file-name) (file-mtime (port-filename))))))

Indeed, "some-project/some-lib/example.scm" does not exist. Can `port-filename` be made to expand to include whatever load-path the file was found to reside in?


More information about the Cmdist mailing list