Question

I started sicstus from my Cygwin prompt on my Windows7 64bit installation, and created a prolog program. Then I saved it using the following command that created the file "test.sav" in my current folder.

save_program(test).

When I try to run this file, I get a cryptic error message:

$ ./test.sav
! Existence error in argument 1 of restore/1
! file '%0.bat' does not exist
! goal:  restore('%0.bat')
SICStus 4.2.0 (x86-win32-nt-4): Mon Mar  7 20:21:12 WEST 2011
Licensed to SP4idi.ntnu.no
| ?- halt.
./test.sav: line 2: $'\032\r': command not found
./test.sav: line 8: x??xU?u/:?HBa?m[F?????ld?l???l?????./test.sav: line 9: syntax error near unexpected token `)'
./test.sav: line 9: `}?????????8?h????)}???C?qa?   ??.?????????/F??7W???yE?lL}>}L???????"???o%"?aac|S[G?????"W????'??K?1Q???????H??M?4??=???bE?
???t[<??????I??\)T?*????????N+?4??@h? ?'?{?1J?*????F?Q??q?<B?5@????l?(s?x?`r?????b?5??%:#I?Eb?@????1-???|a?????  ?D??G?)??O?

When I look at the head of the file, this is what I get:

$ head ./test.sav
sicstus-4.2.0 -r %0.bat -a %1 %2 %3 %4 %5 %6 %7 %8 %9

# META_INFO 1
# FILE: "c:/eclipse/workspace_prolog/busstuc/test.sav"
# FR: "timeout"
# META_INFO END
version=4 archmask=0x2c81a
x??xU?u/:?HBa?m[F?????ld?l???l?????head: write error: Permission denied
head: write error

I also tried loading the file in a different manner:

$ sicstus -l ./test.sav
% loading c:/eclipse/workspace_prolog/busstuc/test.sav...
% c:/eclipse/workspace_prolog/busstuc/test.sav loaded, 0 msec 104 bytes
! Consistency error: memory and saved_state are inconsistent
! type 32-bit,BDD,GAUGE,ALL_BUT_PROLOG, saved state, type 32-bit,BDD,GAUGE, emulator
! goal:  ensure_loaded(user:'./test.sav')
SICStus 4.2.0 (x86-win32-nt-4): Mon Mar  7 20:21:12 WEST 2011
Licensed to SP4idi.ntnu.no
| ?- halt.

Can someone please explain to me why this is not working? Am I doing something wrong here? Thanks!

EDIT: I changed the filename from test.sav to test.bat following Per's suggestion. This happens:

C:\eclipse\workspace_prolog\BussTUC>sicstus-4.2.0 -r C:\eclipse\workspace_prolog\BussTUC\test.bat.bat -a
! Existence error in argument 1 of restore/1
! file 'C:\\eclipse\\workspace_prolog\\BussTUC\\test.bat.bat' does not exist
! goal:  restore('C:\\eclipse\\workspace_prolog\\BussTUC\\test.bat.bat')
SICStus 4.2.0 (x86-win32-nt-4): Mon Mar  7 20:21:12 WEST 2011
Licensed to SP4idi.ntnu.no
| ?- halt.

C:\eclipse\workspace_prolog\BussTUC># META_INFO 1
'#' is not recognized as an internal or external command,
operable program or batch file.

C:\eclipse\workspace_prolog\BussTUC>The system cannot write to the specified device.
The system cannot write to the specified device.
 | The system cannot write to the specified device.
Was it helpful?

Solution

This, undocumented and unsupported, feature apparently never did work on Windows.

Instead you can use one of the pre-built runtime systems that loads a main.sav from the folder containing the executable. E.g. save your test.sav as main.sav instead and place it alongside sprti.exe in a folder that contains a proper folder structure for SICStus, as described in the manual, in the section Runtime Systems on Windows Target Machines.

The most common solution is to use the spld.exe tool an build a self contained executable but that requires the corresponding C compiler from Microsoft.

(I am one of the SICStus Prolog developers)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top