Error running make

In version 8.1.24 I get a new error when running make aftter modifying some loaded file:

$ swipl /tmp/t.pl
[...change the file...]
6 ?- make.
ERROR: /usr/lib/swipl/xpce/prolog/boot/pce_pl.pl:37:
ERROR:    '$set_predicate_attribute'/3: No permission to redefine imported_procedure `pce_principal:get/3'
Warning: /usr/lib/swipl/xpce/prolog/boot/pce_pl.pl:37:
Warning:    Goal (directive) failed: pce_host:require([send/2,get/3])

The loaded file does not use pce and the GUI environment has not been loaded. Any idea about the problem?

1 Like

Doesn’t reproduce for me. Is this the PPA version? Does change the file mean using external tools or the builtin editor?

External tools

I am guessing it is because of something in my init.pl file.
If I run :

$ swipl -f none /tmp/t.pl

Everything works fine.
I’ll try to find the offending line in my init.pl.

Update

Found the offending line in my init.pl

dbgide    :- prolog_ide(debug_monitor).

If I comment out the line everything works.

1 Like

Could you try putting this line in your init.pl/.swiplrc and see if you get the error?

dbgide    :- prolog_ide(debug_monitor).

Thanks!!

Tried that both on my travel Macbook and remotely on a Linux machine with the latest (8.1.24) PPA version. No problems. Anything else in your init.pl. Notably thinking about stuff that affects autoloading, search paths, etc.

I can reproduce it every time with the following:

$ cat /tmp/s.pl
dbgide    :- prolog_ide(debug_monitor).

$ cat /tmp/3.pl
main :-
   write(hello).

$ swipl -f /tmp/s.pl /tmp/3.pl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.24)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- make.
true.

?- make.
ERROR: /usr/lib/swipl/xpce/prolog/boot/pce_pl.pl:37:
ERROR:    '$set_predicate_attribute'/3: No permission to redefine imported_procedure `pce_principal:get/3'
Warning: /usr/lib/swipl/xpce/prolog/boot/pce_pl.pl:37:
Warning:    Goal (directive) failed: pce_host:require([send/2,get/3])
% /usr/lib/swipl/xpce/prolog/lib/pce loaded into pce 0.03 sec, 0 clauses
ERROR: /usr/lib/swipl/xpce/prolog/boot/pce_pl.pl:37:
ERROR:    '$set_predicate_attribute'/3: No permission to redefine imported_procedure `pce_principal:get/3'
Warning: /usr/lib/swipl/xpce/prolog/boot/pce_pl.pl:37:
Warning:    Goal (directive) failed: pce_host:require([send/2,get/3])
% /usr/lib/swipl/xpce/prolog/lib/swi_compatibility compiled into pce_compatibility_layer 0.00 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_principal compiled into pce_principal 0.00 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_global compiled into pce_global 0.00 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_expansion compiled into pce_expansion 0.02 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_realise compiled into pce_realise 0.01 sec, 0 clauses
true.

Interesting things to note:

  1. It doesn’t happen on the first call to make, only on the second
  2. I didn’t change the source file 3.pl at all

Now, without an initialization file:

$ swipl -f none /tmp/3.pl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.24)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- make.
true.

?- make.
true.

?- make.
true.

?- ^D
% halt

Now changing the file:

$ swipl -f /tmp/s.pl /tmp/3.p
Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.24)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- make.
true.

?- % here I change the 3.pl file (hello -> hello1)
|    make.
% /tmp/3 compiled 0.00 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/lib/pce loaded into pce 0.04 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/lib/swi_compatibility compiled into pce_compatibility_layer 0.00 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_principal compiled into pce_principal 0.01 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_global compiled into pce_global 0.01 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_expansion compiled into pce_expansion 0.03 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_realise compiled into pce_realise 0.01 sec, 0 clauses
true.

?- shell('cat /tmp/3.pl').
main :-
   write(hello1).
true.

?- make.
ERROR: /usr/lib/swipl/xpce/prolog/boot/pce_pl.pl:37:
ERROR:    '$set_predicate_attribute'/3: No permission to redefine imported_procedure `pce_principal:get/3'
Warning: /usr/lib/swipl/xpce/prolog/boot/pce_pl.pl:37:
Warning:    Goal (directive) failed: pce_host:require([send/2,get/3])
% /usr/lib/swipl/xpce/prolog/lib/pce loaded into pce 0.03 sec, 0 clauses
true.

Thanks for all the details. One would say this should be enough, but it is not :frowning:

Make’s list_undefined/0 will try to get the predicate properties of prolog_ide/1, causing it to load this and so on. That seems to work well. The second make checks for all these loaded files to be changed and reloads them if necessary. That should not be necessary. There may be some mixup in the times recorded in the QLF file and the actual time causing a reload anyway. That should in principle not really cause any problems. I’ve tried simulating that by explicitly reloading some of the possibly involved files. All that works fine :frowning:

Possible work-arounds are to run make/0 as root, which probably recompiled the .qlf files or simply delete (notabably) pce.qlf from the installed system. Except some slowdown to start the tools this should have no effect.

But, I’d be happier if we got the cause and get that fixed.

Wow! So that means you were not able to reproduce the problem? What a strange thing. I’ll try to dig some more.

New information, it doesn’t happen with 8.1.23:

$ swipl -f /tmp/s.pl /tmp/3.pl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.23)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- make
|    .
true.

?- make.
% /usr/lib/swipl/xpce/prolog/lib/pce loaded into pce 0.03 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/lib/swi_compatibility compiled into pce_compatibility_layer 0.00 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_principal compiled into pce_principal 0.00 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_global compiled into pce_global 0.00 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_expansion compiled into pce_expansion 0.02 sec, 0 clauses
% /usr/lib/swipl/xpce/prolog/boot/pce_realise compiled into pce_realise 0.01 sec, 0 clauses
true.

?- make.
% /usr/lib/swipl/xpce/prolog/lib/pce loaded into pce 0.02 sec, 0 clauses
true.

Found out the reason for the problem.

I had an older swipl development verision, and that was interfering for some reason.

1 Like