Program compiles until version 8.2.0 but does not compile in 8.2.1 or 8.5.8

I am using MacOS Big Sur 11.2.3 and Windows 10 under Parallels Desktop.

I have a program that is compiled correctly by the command

swipl --goal=main -o tester1.exe -c module21.pl

if I use SWI-Prolog 8.2.0 (or e.g. 8.1.26) under Windows (Parallels Desktop).
And the compiled program executes without an error.

However, when I use SWI-Prolog 8.2.1 under Windows (Parallels Desktop),
the compilation shows the messages

  % Disabled autoloading (loaded 38 files)
  % Disabled autoloading (loaded 0 files) 

and then, the compilation hangs .


When I repeat the experiment under MacOS, I get the following:
The same program is also compiled correctly by the command

swipl --goal=main -o tester1 -c module21.pl

if I use SWI-Prolog 8.2.0 (or e.g. 8.1.26) under MacOS.
Again, the compiled program executes without an error.

However, when I use SWI-Prolog 8.2.1 (or some newer versions, e.g. 8.5.8-1) under MacOS,
compilation shows a warning

  % Disabled autoloading (loaded 39 files)
  % Disabled autoloading (loaded 0 files) 

and the execution of the compiled program throws an error

ERROR: -g user:main: '$clause'/4: No permission to access private_procedure `catch/3'

Is there a trick to use newer versions of SWI-Prolog for my program?

Thanks in advance
Stefan

My program consist of the following 5 parts:
module21.pl (1,8 KB)
sol1.pl (26,1 KB)
stud1.pl (1,5 KB)
tester21.pl (9,9 KB)
v21tester.pl (42,9 KB)

The last problem looks related to :- set_prolog_flag(protect_static_code, true). in your code. This breaks the code analysis for saving the program. If I call this at the beginning of main/1, all seems to work fine. For me it also compiles fine under Windows (version 8.5.8).

Thank you very much, Jan! The last problem is in fact solved by calling
set_prolog_flag(protect_static_code, true) in main/1.

The other problem still remains, i.e. with version 8.5.8 under MacOS,
the compilation with

swipl --goal=main -o tester1 -c module21.pl

produces warnings

% Disabled autoloading (loaded 60 files)
% Disabled autoloading (loaded 4 files)
% Disabled autoloading (loaded 0 files)

and the compiled program runs correctly.

However, with version 8.5.8 under Parallels Windows,
the compilation with

swipl --goal=main -o tester1.exe -c module21.pl

hangs after showing the warnings

% Disabled autoloading (loaded 59 files)
% Disabled autoloading (loaded 4 files)
% Disabled autoloading (loaded 0 files)

Can it be that there is 1 file missing in the compilation process done by Windows
(60 files versus 59 files)?

Any sugguestions that allow me to use a newer version of SWI Prolog are very welcome.

Stefan

I have added the modified files agian for easier double checking the tests.
sol1.pl (26,2 KB)
stud1.pl (1,5 KB)
tester21.pl (10,0 KB)
v21tester.pl (42,9 KB)
module21.pl (1,8 KB)

This is not a warning. It is an informational message.

More likely causes by differences in some of the code due to Windows/MacOS changes. You can use --map=somefile to ask it to write a detailed log of what is saved into the state to somefile.

All I can say is that it runs fine for me both for Windows (Both real Windows running inside a VirtualBox VM and Wine) and Linux. Maybe someone else can reproduce this?

Thank you, Jan!
I have produced the logs for 8.5.8 compilation under Parallels/Windows and under MacOS. However, I am not familiar enough with the SWI Prolog implementation in order to see what could be missing or what I could do to avoid that the compilation under Windows hangs. I have added both log files here as this might help to find the reason why.

On the other hand, the compilation problem is (mainly) solved for me. I have just seen that the compilation process under version 8.5.8 and Parallels (Windows) generates correct executable code - and thereafter hangs.
In contrast to the compilation process under version 8.5.8 and MacOS which generates correct executable code and does not hang.
Therefore, as a workaround, I can use MacOS as develepment platform and finally compile once under Windows.

_swipl-compile-log-MacOS.pl (260,9 KB)
_swipl-compile-log-Win.pl (230,8 KB)