Building swipl-dev on Windows Subsystem for Linux

While building swipl-dev version 8.3.2-18-g0111bdd47 on Windows Subsystem for Linux
i.e. Ubuntu 20.04 we get several messages like:

% The following threads wouldn't die: []
% The following threads wouldn't die: [gc]
% The following threads wouldn't die: [gc,pce]
% The following threads wouldn't die: [pce]

We also get such message with:

$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.2)
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).

?- ^D
% halt
% The following threads wouldn't die: [gc]

The tests give 3 errors:

Test project /home/jdroo/github.com/SWI-Prolog/swipl-devel/build
      Start  1: swipl:basic
      Start  2: swipl:unprotected
      Start  3: swipl:core
      Start  4: swipl:attvar
      Start  5: swipl:debug
      Start  6: swipl:tabling
      Start  7: swipl:library
      Start  8: swipl:charset
 1/66 Test  #8: swipl:charset ....................   Passed    0.26 sec
      Start  9: swipl:eclipse
 2/66 Test  #9: swipl:eclipse ....................   Passed    0.24 sec
      Start 10: swipl:clp
 3/66 Test  #4: swipl:attvar .....................   Passed    0.63 sec
      Start 11: swipl:GC
 4/66 Test  #2: swipl:unprotected ................   Passed    0.74 sec
      Start 12: swipl:save
 5/66 Test  #1: swipl:basic ......................***Failed    0.94 sec
Running test set "syntax" ............................... done.
Running test set "write_test" .............. done.
Running test set "format_test" ......... done.
Running test set "unify" .. done.
Running test set "occurs_check" ...... done.
Running test set "unifiable" ... done.
Running test set "arithmetic" ...................................... done.
Running test set "arithmetic_functions"  done.
Running test set "floattest" ........ done.
Running test set "gmp" ........................................................... done.
Running test set "chars" .. done.
Running test set "wchars" .. done.
Running test set "depth_limit" ..... done.
Running test set "type_test" .... done.
Running test set "meta" ............... done.
Running test set "avar" ........................... done.
Running test set "gvar" ..... done.
Running test set "copy_term" .............. done.
Running test set "term_hash" ........ done.
Running test set "cyclic" .......... done.
Running test set "cleanup" ............. done.
Running test set "term" ........... done.
Running test set "list" ........... done.
Running test set "sets" ......... done.
Running test set "atom_handling" ........................ done.
Running test set "string_handling" ..... done.
Running test set "proc" ........ done.
Running test set "cl" ........... done.
Running test set "record" ....... done.
Running test set "compiler" ....... done.
Running test set "flag" . done.
Running test set "update" ... done.
Running test set "gc" ........ done.
Running test set "control" ......... done.
Running test set "exception" ........ done.
Running test set "term_atom" .. done.
Running test set "os" .. done.
Running test set "io" .. done.
Running test set "popen" ... done.
Running test set "timeout" sleep: cannot read realtime clock: Invalid argument
E1 == error(syntax_error(end_of_file),stream(<stream>(0x7ffff66eb0b0),1,2,1))
/home/jdroo/github.com/SWI-Prolog/swipl-devel/src/test.pl:2274: Test timeout(pipe-1) failed
 done.
Running test set "file" ............. done.
Running test set "unicode_file" .... done.
Running test set "seek" . done.
Running test set "load_program" . done.
Running test set "ctype" ...... done.
Running test set "wctype" . done.
Running test set "thread" .....
/home/jdroo/github.com/SWI-Prolog/swipl-devel/src/test.pl:2563: Test thread(status-1) failed
. done.
Running test set "mutex" ... done.
*** 2 tests failed ***

      Start 13: swipl:files
 6/66 Test #10: swipl:clp ........................   Passed    0.50 sec
      Start 14: swipl:xsb/basic_tests
 7/66 Test #13: swipl:files ......................   Passed    0.32 sec
      Start 15: swipl:xsb/ai_tests
 8/66 Test  #6: swipl:tabling ....................   Passed    1.85 sec
      Start 16: swipl:xsb/ptq
 9/66 Test  #5: swipl:debug ......................***Failed    1.94 sec
Running scripts from debug ............................
ERROR: /home/jdroo/github.com/SWI-Prolog/swipl-devel/src/Tests/debug/test_interrupt.pl:99:
        test copy_stream_data: failed

Script /home/jdroo/github.com/SWI-Prolog/swipl-devel/src/Tests/debug/test_interrupt.pl failed
.. done
*** 1 tests failed ***

      Start 17: swipl:xsb/neg_tests
10/66 Test #14: swipl:xsb/basic_tests ............   Passed    1.38 sec
      Start 18: swipl:xsb/delay_tests
11/66 Test #15: swipl:xsb/ai_tests ...............   Passed    1.11 sec
      Start 19: swipl:xsb/wfs_tests
12/66 Test  #7: swipl:library ....................***Failed    2.90 sec
Running scripts from library ..............................................................................................................................................................................................
ERROR: /home/jdroo/github.com/SWI-Prolog/swipl-devel/src/Tests/library/test_thread.pl:63:
        test first is subject to occurs check (STO):
ERROR: Finite trees (error checking): deterministic success in 0.00 seconds
ERROR: Rational trees: must fail but succeeded in 0.00 seconds

ERROR: Finite trees: deterministic success in 0.00 seconds
..
Script /home/jdroo/github.com/SWI-Prolog/swipl-devel/src/Tests/library/test_thread.pl failed
......................................................................................................................................................... done
*** 1 tests failed ***

      Start 20: swipl:xsb/table_tests
13/66 Test #17: swipl:xsb/neg_tests ..............   Passed    1.18 sec
      Start 21: swipl:xsb/incremental_tests
14/66 Test #16: swipl:xsb/ptq ....................   Passed    1.47 sec
      Start 22: swipl:xsb/nonmt_tests
15/66 Test #19: swipl:xsb/wfs_tests ..............   Passed    0.92 sec
      Start 23: swipl:xsb/sub_tests
16/66 Test #12: swipl:save .......................   Passed    2.81 sec
      Start 24: swipl:thread
17/66 Test #21: swipl:xsb/incremental_tests ......   Passed    0.79 sec
      Start 25: swipl:thread_wait
18/66 Test #22: swipl:xsb/nonmt_tests ............   Passed    0.77 sec
      Start 26: chr:chr
19/66 Test #11: swipl:GC .........................   Passed    3.86 sec
      Start 27: clib:cgi
20/66 Test #27: clib:cgi .........................   Passed    0.18 sec
      Start 28: clib:crypt
21/66 Test #28: clib:crypt .......................   Passed    0.14 sec
      Start 29: clib:memfile
22/66 Test #23: swipl:xsb/sub_tests ..............   Passed    1.43 sec
      Start 30: clib:process
23/66 Test #20: swipl:xsb/table_tests ............   Passed    2.12 sec
      Start 31: clib:readutil
24/66 Test #29: clib:memfile .....................   Passed    0.26 sec
      Start 32: clib:socket
25/66 Test #18: swipl:xsb/delay_tests ............   Passed    2.85 sec
      Start 33: clib:af_unix
26/66 Test #31: clib:readutil ....................   Passed    0.28 sec
      Start 34: clib:stream
27/66 Test #33: clib:af_unix .....................   Passed    0.21 sec
      Start 35: clib:time
28/66 Test #34: clib:stream ......................   Passed    0.21 sec
      Start 36: clib:uri
29/66 Test #32: clib:socket ......................   Passed    0.50 sec
      Start 37: http:cgi_stream
30/66 Test #36: clib:uri .........................   Passed    0.30 sec
      Start 38: http:http
31/66 Test #25: swipl:thread_wait ................   Passed    2.10 sec
      Start 39: http:json
32/66 Test #26: chr:chr ..........................   Passed    2.08 sec
      Start 40: http:multipart
33/66 Test #37: http:cgi_stream ..................   Passed    0.77 sec
      Start 41: http:proxy
34/66 Test #35: clib:time ........................   Passed    1.26 sec
      Start 42: http:websocket
35/66 Test #40: http:multipart ...................   Passed    0.61 sec
      Start 43: nlp:nlp
36/66 Test #39: http:json ........................   Passed    0.77 sec
      Start 44: pengines:pengines
37/66 Test #43: nlp:nlp ..........................   Passed    0.26 sec
      Start 45: pengines:term_html
38/66 Test #38: http:http ........................   Passed    1.49 sec
      Start 46: protobufs:protobufs
39/66 Test #45: pengines:term_html ...............   Passed    0.46 sec
      Start 47: RDF:rdf
40/66 Test #46: protobufs:protobufs ..............   Passed    0.21 sec
      Start 48: RDF:write
41/66 Test #42: http:websocket ...................   Passed    0.90 sec
      Start 49: semweb:con
42/66 Test #30: clib:process .....................   Passed    2.98 sec
      Start 50: semweb:litmap
43/66 Test #41: http:proxy .......................   Passed    1.56 sec
      Start 51: semweb:load
44/66 Test #47: RDF:rdf ..........................   Passed    0.39 sec
      Start 52: semweb:ntriples
45/66 Test #49: semweb:con .......................   Passed    0.36 sec
      Start 53: semweb:rdf11
46/66 Test #50: semweb:litmap ....................   Passed    0.43 sec
      Start 54: semweb:rdf_db
47/66 Test #52: semweb:ntriples ..................   Passed    0.43 sec
      Start 55: semweb:subprop
48/66 Test #48: RDF:write ........................   Passed    0.84 sec
      Start 56: semweb:turtle2
49/66 Test #51: semweb:load ......................   Passed    0.61 sec
      Start 57: semweb:turtle
50/66 Test #53: semweb:rdf11 .....................   Passed    0.58 sec
      Start 58: sgml:sgml
51/66 Test #56: semweb:turtle2 ...................   Passed    0.47 sec
      Start 59: sgml:sgml_write
52/66 Test #58: sgml:sgml ........................   Passed    0.35 sec
      Start 60: sgml:xsd
53/66 Test #59: sgml:sgml_write ..................   Passed    0.26 sec
      Start 61: sgml:c14n
54/66 Test #54: semweb:rdf_db ....................   Passed    1.09 sec
      Start 62: zlib:zlib
55/66 Test #60: sgml:xsd .........................   Passed    0.37 sec
      Start 63: bdb:bdb
56/66 Test #61: sgml:c14n ........................   Passed    0.49 sec
      Start 64: pcre:pcre
57/66 Test #63: bdb:bdb ..........................   Passed    0.39 sec
      Start 65: yaml:yaml
58/66 Test #64: pcre:pcre ........................   Passed    0.28 sec
      Start 66: ssl:ssl
59/66 Test #65: yaml:yaml ........................   Passed    0.37 sec
60/66 Test #55: semweb:subprop ...................   Passed    2.68 sec
61/66 Test #57: semweb:turtle ....................   Passed    2.70 sec
62/66 Test #62: zlib:zlib ........................   Passed    2.07 sec
63/66 Test #44: pengines:pengines ................   Passed    4.54 sec
64/66 Test #66: ssl:ssl ..........................   Passed    1.95 sec
65/66 Test  #3: swipl:core .......................   Passed   13.13 sec
66/66 Test #24: swipl:thread .....................   Passed   10.88 sec

95% tests passed, 3 tests failed out of 66

Total Test time (real) =  14.62 sec

The following tests FAILED:
          1 - swipl:basic (Failed)
          5 - swipl:debug (Failed)
          7 - swipl:library (Failed)

Which WSL was used? WSL 1 or WSL 2. It might make a difference.

The failing stuff mostly seems to be related to thread synchronization and timing. The shutdown issue is probably related to missing or malfunctioning semaphores. As @EricGT says, the WSL version may matter. As I understand it, WSL 1 does more or less what Wine does on Linux: emulate loading and running a Linux binary on top of the Windows kernel while WSL 2 is a VM. Right?

Otherwise I think this is more an issue to raise at Microsoft :slight_smile:

That said, it is not entirely clear to me why one would like to run SWI-Prolog for Linux on Windows. If you want SWI-Prolog on Windows, just use the Windows binaries (which also do not pass all tests, some possibly due to non-portability of the test, others might be real issues). If you want the Linux version of SWI-Prolog, run Linux … The only reason I’ve heart a couple of times is “I have to use Windows from my boss but I like Linux so much better” That makes sense :frowning:

1 Like

It is WSL 1 and yes, I have to use Windows but I like Linux so much better :slight_smile:

2 Likes

Also forgot to mention that those issues do not occur with WSL 1 Ubuntu 18.04
Everything there works as smooth as native Ubuntu 18.04 :wink:

1 Like

I had the same message with Ubuntu 20 on WSL 1, disappeared after upgrade to WSL 2.

Regarding Jan’s question on why WSL? My use case is rserve_client. Why Windows not Linux: last time I checked Linux, the mouse support was as terrible as 20 years ago (e.g. submenus close if the mouse pointer accidentally leaves the line of selected menu item).

1 Like