"Updating index for library" messages after ninja install

After I run ninja install with cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local and then run a test of one of my programs, I get this (some output removed for clarity; to trigger the “make”, I touched the source file):

$ swipl ~/src/nerdle/test_nerdle.pl
?- run_tests.
% All 401 tests passed in 5.035 seconds (0.002 cpu)
true.

?- make.
% Updating index for library /home/peter/.local/lib/swipl/library/
% Updating index for library /home/peter/.local/lib/swipl/library/ext/PDT/
% Updating index for library /home/peter/.local/lib/swipl/library/ext/RDF/
 ...
% All 401 tests passed in 4.974 seconds (0.001 cpu)
true.

?- make.
% Updating index for library /home/peter/.local/lib/swipl/library/ext/nlp/
% Updating index for library /home/peter/.local/lib/swipl/library/ext/table/
% /home/peter/src/nerdle/test_nerdle compiled into test_nerdle 0.06 sec, 0 clauses
% All 401 tests passed in 4.745 seconds (0.001 cpu)
true.

I’m wondering where these messages are coming from; and shouldn’t updating the indexes have been done as part of the install?

The CPU time is also wrong, presumably because I have this:

:- set_test_options([jobs(8), load(always)]).

make/0 calls ‘$update_library_index’/0. This updates the index if either some *.pl file in the directory or the directory itself is more recent than the index and the index is writeable.

In the built system all is fine, but in the installed system the index will normally considered to be out of date. If the system is installed globally by a root/admin user, users cannot write and all is fine. If you install as user, it will update the library index on the first make/0 call. Repeated updates are a bit weird though. Possibly we should consider removing updating the indexes from make/0 as creating the index is now properly scripted in the build and install? It should be harmless to update, but doing so might be less confusing?

Hmm. Just tested. For me run_tests/0 reports the total CPU time of all threads.

I presume that make/0 calling 'update_library_index'/0 helps when working on the SWI-Prolog library, because the build directory contains symlinks to the source. Is there any other use case for it?

As for the strange total CPU time from run_tests/0, the source code is here: GitHub - kamahen/nerdle: Nerdle game in Prolog

$ swipl -g run_tests -t halt ~/src/nerdle/test_nerdle.pl
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――








――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
% All 403 tests passed in 4.788 seconds (0.001 cpu)

Thanks for letting me discover this Nerdle game :gift_heart: :sparkling_heart: :heartbeat:

There used to be. As these problems are resolved I’ve changed make/0 to only check autoload directories that are not part of the system. That should be less confusing and faster.

I wonder why my test worked. Pushed a fix to plunit. Now I get

% All 395 tests passed in 2.301 seconds (8.062 cpu)
2 Likes