Giter Club home page Giter Club logo

swipl's Introduction

CI

SWI-Prolog: A comprehensive Prolog implementation

SWI-Prolog is an open source (BSD-2) implementation of the Prolog language with many extensions. It is implemented in C (version 11) and Prolog and is available for many platforms (Linux, practically any POSIX like system, MacOS, Windows). All CPUs supported by Debian Linux are supported. A prototype running in your browser based on WASM (Web Assembly) is available.

(SWI-)Prolog is a versatile language. It is being used for business rule validation, natural language processing, software verification, software refactoring, network configuration, security, robotics, reasoning in legal and medical domains, graph processing, machine learning (ILP, PLP), linked data (RDF), mathematical proofs, and much more.

If you are interested in commercial assistence to make SWI-Prolog work in your organization, please contact SWI-Prolog Solutions b.v..

Forking, cloning and submitting patches

This repository uses many Git submodules. This causes the common issue that fork and clone doesn't work. Instead, clone from https://github.com/SWI-Prolog/swipl-devel.git and then associate your clone with your fork (replace me with your github user name).

git clone https://github.com/SWI-Prolog/swipl-devel.git
cd swipl-devel
git submodule update --init
git remote add myfork [email protected]:me/swipl-devel.git

See How to submit a patch for details.

See also the discussion at Being friendly to quick contributions

Building

See CMAKE.md and Build SWI-Prolog from source

Web home

Please find the up-to-date information on SWI-Prolog at https://www.swi-prolog.org.

Trying SWI-Prolog online

An online version of SWI-Prolog is provided by SWISH. Note that this version is subject to sandbox restrictions and does not provide the features most valued in SWI-Prolog such as its rich set of interfaces, multi-threading, modules, etc.

Alternatively, there is a WASM (Web Assembly) version available at http://dev.swi-prolog.org/wasm/shell. This version has no sandbox restrictions. The WASM build allows interaction with the browser's DOM, so it allows for interactive Prolog applications running inside the browser. It is otherwise rather limited though.

Forum/mailing list

Our forum is hosted at a Discourse site. The forum provides a mail list interface.

Documentation

Documentation is available from several locations and in several formats.

  • Several tutorials can be accessed from the Tutorials menu on the home page

  • A HTML version of the documentation is in the doc/Manual directory of the installation. Note that some packagers put this documentation elsewhere or require it to be installed separately.

    These docs can be searched using ?- apropos("query").. Help on a predicate can be disaplayed using e.g., ?- help(append/3).

  • A PDF version of the documentation is available from the download page

You can also install the website locally to use its complete functionality if you are offline. It is available at https://github.com/SWI-Prolog/plweb.

swipl's People

Contributors

abramo-bagnara avatar anionic avatar borisvassilev avatar dgelessus avatar dmchurch avatar dtonhofer avatar edisonm avatar eshelyaron avatar fnogatz avatar github-cygwin avatar janwielemaker avatar jeswr avatar johanromme avatar jrvosse avatar kamahen avatar keriharris avatar likelion avatar madler avatar mgondan avatar mifigiel avatar mndrix avatar pmoura avatar ridgeworks avatar rla avatar saarland47 avatar sddu avatar teamspoon avatar triska avatar uwn avatar wouterbeek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swipl's Issues

Online manual reader rendering issues

When using the online manual browser in SWI-Prolog 7.4.2, I’m seeing odd rendering issues in headlines, code blocks, underlined words, crossreferences and literature references.

Screenshot

When I copy-paste text portions containing the block glyphs, they are pasted as the control character backspace. Any pointers?

Kind regards!

Foreign function interface out of date

Hi,

could you update the information of the foreign function interface?
If I understand correctly, since 8.2.0 version, PL_register_foreign takes a function with the return with pl_function_t instead of foreign_t. The documentation and tests (here) do not reflect that change.

I would appreciate if you could give a small example of the correct usage. I tried to modify the hello example you provide, but unsuccessfully.

Thank you!

Installation fails

I'm following the commands:
cd swipl-devel mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=$HOME/opt/swipl-8.0.3 .. make ctest -j 4 sudo make install

where DCMAKE_INSTALL_PREFIX=$HOME/opt/swipl-8.0.3. During make I get the repeated error shown in the attached image, which regards tex files generation.
I get the same error with the development version downloaded from the github repository at https://github.com/SWI-Prolog/swipl-devel.git.
Screenshot 2019-11-26 16 06 27

Unable to build: error: '../man/archive', needed by 'man/lib/prologpack.tex',

I'm not able to build following the instructions in
swipl-devel/CMAKE.md
or
https://eu.swi-prolog.org/build/unix.html#

The docs are missing some information on installing dependencies:

~/soft/swipl-devel/$  git submodule update --init
~/soft/swipl-devel/build$  cmake -DCMAKE_INSTALL_PREFIX=$HOME -G Ninja .. && echo OK
-- Configuring SWI-Prolog-8.3.2
-- Could NOT find LibTCMalloc (missing: LIBTCMALLOC_LIBRARY) 
-- Could NOT find LibTCMalloc (missing: LIBTCMALLOC_LIBRARY) 
-- Could NOT find LibUUID (missing: LIBUUID_INCLUDE_DIR UUID_LIBRARY) 
-- Could NOT find LibArchive (missing: LibArchive_LIBRARY LibArchive_INCLUDE_DIR) 
-- Could NOT find ODBC (missing: ODBC_LIBRARY ODBC_INCLUDE_DIR) 
-- Optional package Berkeley DB was not found
-- Could NOT find PCRE (missing: PCRE_LIBRARY PCRE_INCLUDE_DIR) 
-- No junit.jar. Make sure junit.jar points to junit4.jar  Dropping JPL tests.
-- Could NOT find Qt5Widgets (missing: Qt5Widgets_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sir/soft/swipl-devel/build
OK
~/soft/swipl-devel/build$ ninja && echo OK
ninja: error: '../man/archive', needed by 'man/lib/prologpack.tex', missing and no known rule to make it

readln never returns end_of_file atom.

No matter what I do, when readln reaches the end of the input it just returns an empty list.
Here's the current version of the script I'm trying to write:

#! /usr/bin/swipl -q

:- initialization(main).
:- dynamic(asserted/1).

assert_stuff(List):- assert_stuff_intern(List).

assert_stuff_intern([]):- !.
assert_stuff_intern([end_of_file]):-
        findall(X, asserted(X), Y),
        writer_intern(Y),
        halt(0).
assert_stuff_intern([X|Rest]):-
        \+ asserted(X),
        asserta(asserted(X)),
        assert_stuff_intern(Rest), !.
assert_stuff_intern([_|Rest]):-
        assert_stuff_intern(Rest), !.

writer_intern([]).
writer_intern([X|Rest]):-
        writeln(X),
        writer_intern(Rest).

main:- prompt1(''), repeat, readln(X), assert_stuff(X), false.

When I feed it an input file it just hangs forever. The documentation says it's supposed to return end_of_file.

Trying to calculate a hash with crypto_data_hash causes SWI session to crash - am I doing something wrong or is this a bug?

Hello,

I just wanted to give crypto_data_hash/3 a try but that causes SWI to crash.

use_module(library(crypto)).
crypto_data_hash(test, Hash, [algorithm(sha1)]).

I'm working on Linux Mint 21.2 Xfce 64bit.

And the following documents the session plus error message:

➜  prolog-freecell-solver git:(two-free-cells) swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.4.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).

?- use_module(library(crypto)).
true.

?- crypto_data_hash(test, Hash, [algorithm(sha1)]).

SWI-Prolog [thread 1 (main) at Sun Oct 22 14:17:20 2023]: received fatal signal 11 (segv)
C-stack trace labeled "crash":
  [0] PL_advance_hash_table_enum() at ??:? [0x7f78f1af8b6a]
  [1] Sdprintf() at ??:? [0x7f78f1afda4d]
  [2] PL_changed_cwd() at ??:? [0x7f78f1b03cd7]
  [3] __restore_rt() at libc_sigaction.c:? [0x7f78f185d520]
  [4] EVP_MAC_up_ref() at ??:? [0x7f78f0402074]
  [5] ??() at ??:0 [0x7f78f07606c4]
  [6] PL_malloc_atomic() at ??:? [0x7f78f1b0e96d]
  [7] PL_unify_blob() at ??:? [0x7f78f1b436c8]
  [8] PL_unify_blob() at ??:? [0x7f78f1b4356c]
  [9] PL_toplevel() at ??:? [0x7f78f1b5ae6f]
  [10] swipl(+0x11a5) [0x55ddbdfe31a5]
  [11] __libc_start_call_main() at ./csu/../sysdeps/nptl/libc_start_call_main.h:58 [0x7f78f1844d90]
  [12] call_init() at ./csu/../csu/libc-start.c:128 [0x7f78f1844e40]
  [13] swipl(+0x10c5) [0x55ddbdfe30c5]
Prolog stack:
  [12] crypto:_crypto_hash_context_copy/2 [PC=1 in supervisor]
  [11] crypto:crypto_data_context/3 [PC=5 in clause 1]
  [10] crypto:crypto_data_hash/3 [PC=13 in clause 1]
  [9] $toplevel:toplevel_call/1 [PC=3 in clause 1]
  [8] $toplevel:stop_backtrace/1 [PC=4 in clause 1]
  [7] $tabling:$wfs_call/2 [PC=17 in clause 1]
  [5] $toplevel:$execute_goal2/3 [PC=29 in clause 1]
  [3] $toplevel:$query_loop/0 [PC=39 in clause 2]
  [2] $toplevel:$runtoplevel/0 [PC=19 in clause 1]
  [1] $toplevel:$toplevel/0 [PC=3 in clause 1]
  [0] system:$c_call_prolog/0 [PC=0 in top query clause]
Running on_halt hooks with status 139
Killing 12793 with default signal handlers
[1]    12793 segmentation fault (core dumped)  swipl

Thanks

Raffael

Getting "undeclared identifier 'rl_catch_signals' "

Making SWI-Prolog 7.2.2 for x86_64-darwin14.4.0
To be installed in /usr/bin/swipl
Home (libraries) in /usr/lib/swipl-7.2.2

No GIT version change
/Volumes/Raghav/Github/swipl/src/rc
make[2]: Nothing to be done for all'.
/Volumes/Raghav/Github/swipl/src/libtai
make[2]: Nothing to be done for all'.
gcc -c -I. -I. -I./rc -Wall -O2 -fno-strict-aliasing -pthread -fno-common os/pl-rl.c -o os/pl-rl.o
os/pl-rl.c:326:3: warning: implicit declaration of function 'rl_reset_after_signal' is invalid in C99
[-Wimplicit-function-declaration]
rl_reset_after_signal ();
^
os/pl-rl.c:482:4: warning: implicit declaration of function 'rl_discard_argument' is invalid in C99
[-Wimplicit-function-declaration]
rl_discard_argument();
^
os/pl-rl.c:534:7: warning: implicit declaration of function 'rl_delete' is invalid in C99
[-Wimplicit-function-declaration]
rl_delete(-1, key);
^
os/pl-rl.c:597:3: error: use of undeclared identifier 'rl_catch_signals'
rl_catch_signals = 0;
^
os/pl-rl.c:605:35: warning: incompatible pointer types passing 'int (int, int)' to parameter of type
'Function ' (aka 'int ()(const char , int)') [-Wincompatible-pointer-types]
rl_add_defun("prolog-complete", prolog_complete, '\t');
^~~~~~~~~~~~~~~
/usr/include/readline/history.h:195:44: note: passing argument to parameter here
int rl_add_defun(const char *, Function *, int);
^
4 warnings and 1 error generated.
make[1]: *
* [os/pl-rl.o] Error 1
make: *** [lite] Error 2

Any clue?
The reason I have to build it is because I need it as shared library to run PySWIP.

Weird `PL_cleanup` behaviour with `PL_CLEANUP_NO_RECLAIM_MEMORY`

I ran into a weird issue using SWI-Prolog version 9.0.3 for x86_64-linux with the following program.

#include <stdio.h>
#include <SWI-Prolog.h>

int main(int argc, char **argv) {
  for(int i = 0; i < 3; i++) {
    printf("initialise -> %i\n", PL_initialise(argc, argv));
    printf("cleanup    -> %i\n", PL_cleanup(PL_CLEANUP_NO_RECLAIM_MEMORY));
  }

  return 0;
}

It produces the following output.

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

initialise -> 1
cleanup    -> 1
initialise -> 1
cleanup    -> -2
initialise -> 1
cleanup    -> -2

Note that the last two calls to PL_cleanup return -2 (i.e., PL_CLEANUP_RECURSIVE), which is not what I would expect since PL_cleanup was clearly not (quoting the documentation) "called from a hook called by the cleanup process". Also, the last two calls to initialise do not print the welcome message, which might indicate that they do nothing (?). So probably the first call to PL_cleanup messes up the state somehow.

Replacing PL_CLEANUP_NO_RECLAIM_MEMORY with 0 in the program yields the expected output:

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

initialise -> 1
cleanup    -> 1
Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.3)
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).

initialise -> 1
cleanup    -> 1
Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.3)
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).

initialise -> 1
cleanup    -> 1

Unknown procedure `to_list/2`

Hi,

I couldn't run some plunit tests on 8.4.2-1 that I could on 8.4.1-1 (I tried with homebrew install and with package retrieved from https://www.swi-prolog.org/download/stable/bin/swipl-8.4.1-1.x86_64.dmg and https://www.swi-prolog.org/download/stable/bin/swipl-8.4.2-1.fat.dmg)

I am on my M1 mac with MacOS Monterey 12.3 also tried on 12.2.1 intel

When running ?- run_tests(sql). with 8.4.2 I get an error for missing to_list/2

Here is the stacktrace :

ERROR: In:
ERROR:   [38] to_list([selec/4],_6988)
ERROR:   [37] append_args([selec/4],[],_7028) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:2137
ERROR:   [34] actions_to_format([nl,...|...],_7066,_7068) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:2073
ERROR:   [33] actions_to_format(['  However, there are definitions for:',nl|...],_7106,_7108) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:2100
ERROR:   [32] actions_to_format([nl,'  However, there are definitions for:'|...],_7146,_7148) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:2073
ERROR:   [31] actions_to_format(['Unknown procedure: ~q'- ...,nl|...],_7186,_7188) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:2090
ERROR:   [30] actions_to_format(['~q:~q/~w: '- ...,...|...],_7232,_7234) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:2090
ERROR:   [29] message_to_string(error(existence_error(procedure,...),context(...,_7296)),_7278) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:2063
ERROR:   [28] plunit:failure(error(existence_error(procedure,...),context(...,_7348)),_7328,_7330) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/library/plunit.pl:1778
ERROR:   [27] plunit:message(plunit(failed(sql,insert2,78,...)),[url(...),':\n\t'|...],_7382) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/library/plunit.pl:1586
ERROR:   [25] translate_message2(plunit(failed(sql,insert2,78,...)),[url(...),':\n\t'|...],_7440) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:100
ERROR:   [24] translate_message(plunit(failed(sql,insert2,78,...)),[url(...),':\n\t'|...],[]) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:87
ERROR:   [23] print_message_guarded(error,plunit(failed(sql,insert2,78,...))) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:1803
ERROR:   [22] setup_call_catcher_cleanup('$messages':push_msg(...),'$messages':print_message_guarded(error,...),_7596,'$messages':pop_msg) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/init.pl:663
ERROR:   [20] print_message(error,plunit(failed(sql,insert2,78,...))) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/messages.pl:1772
ERROR:   [18] plunit:failure(sql,insert2,78,error(existence_error(procedure,...),context(...,_7722)),[true(true),...]) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/library/plunit.pl:1201
ERROR:   [16] plunit:run_test_once(sql,insert2,78,[true(true),...],plunit_sql:'unit body'('insert2@line 78',vars)) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/library/plunit.pl:842
ERROR:   [14] plunit:run_unit(sql) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/library/plunit.pl:624
ERROR:   [13] plunit:run_unit_and_check_errors(sql) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/library/plunit.pl:616
ERROR:   [12] setup_call_catcher_cleanup(plunit:setup_trap_assertions(<clause>(0x600000158000)),plunit:run_unit_and_check_errors(sql),_7892,plunit:report_and_cleanup(<clause>(0x600000158000))) at /opt/homebrew/Cellar/swi-prolog/8.4.2/libexec/lib/swipl/boot/init.pl:663
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
   Exception: (38) to_list([selec/4], _4454) ? EOF: exit (status 4)

while the corresponding error on 8.4.1 was :

ERROR: tests.pl:78:
	test insert2: received error: plunit_sql:'unit body'/2: Unknown procedure: plunit_sql:selec/3
  However, there are definitions for:
        selec/4

User init file does not appear to work in Windows 10, and "User init file..." menu selection crashes if file exists.

I installed SWI-Prolog 8.4.3 64-bit in Windows 10 (for all users). If I create a user init file, it does not appear to load in either swipl-win or swipl. I created one with the contents "use_module(library(clpfd))." without the quotes of course. The clpfd module does not appear to be loaded when I start the program, however. Also, when I select Settings->"User init file..." from the menus again, the program dumps a bunch of red error text and then exits immediately. I have to do a very fast screen capture to see what the errors are.

If I delete the init.pl file (C:\Users\steve\AppData\Roaming\swi-prolog\init.pl) then the program no longer crashes when I select "User init file..." from the menu, it just asks me if I want to create one. I have attached a couple screen captures of the error messages.

Screenshot (6)
Screenshot (3)

Question about phrase_from_stream/2 blocking IO (library(pure_input)).

Hello!
I could use some help understanding how lazy IO works. I'm trying to use phrase_from_stream/2 to do some basic text parsing on an incoming socket stream.

Basically, I'm trying to read the first line of a HTTP request. As far as I can tell, my DCG grammar is sufficient for parsing the line but phrase_from_stream/2 seems to block indefinitely while waiting for more input to become available. The reason I think the DCG grammar works is because as soon as the client terminates the connection my program continues just fine.

The code I am using can be found here: https://github.com/epeld/http-server-prolog/blob/789ec1c0766b16f3cdd8f64ea9291e694939fa5d/http.pl#L19
and any help is welcome!

SWI-Prolog 8.4.2 plunit regression - append_args/3: Unknown procedure: '$messages':to_list/2

8.4.2 seems to have a regression in how test output is handled. This regression seems to only exist in 8.4.2, and not in 8.4.1 or in the dev branch.

Given the following file test.pl:

:-begin_tests(example).
test('throw error') :-
    throw(error(example_error, _)).
:-end_tests(example).

Running these tests on 8.4.2 results in this error:

$ swipl --version
SWI-Prolog version 8.4.2 for x86_64-linux
$ swipl -f test.pl -g run_tests
% PL-Unit: example 
% No tests to run
ERROR: -g run_tests: append_args/3: Unknown procedure: '$messages':to_list/2

Neither 8.4.1 nor 8.5.5 display this behavior:

$ swipl --version
SWI-Prolog version 8.4.1 for x86_64-linux
$ swipl -f test.pl -g run_tests
% PL-Unit: example 
ERROR: /home/matthijs/plunit-regression/test.pl:2:
	test throw error: received error: Unknown error term: example_error
 done
% 1 test failed
% 0 tests passed
ERROR: -g run_tests: false
$ swivm use v8.5.5
Now using SWI-Prolog v8.5.5
$ swipl --version
SWI-Prolog version 8.5.5 for x86_64-linux
$ swipl -f test.pl -g run_tests
% PL-Unit: example 
ERROR: /home/matthijs/plunit-regression/test.pl:2:
	test throw error: received error: Unknown error term: example_error
 done
% 1 test failed
% 0 tests passed
ERROR: -g run_tests: false

All version installs were done through swivm.

Error: unknown procedure

Hello,

linux$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.2.3)
?- assertz(g(a)), g(M).
ERROR: Unknown procedure: g/1 (DWIM could not correct goal)

Isn't it allowed to call the goal g() at that point?

SIGTERM does not terminate swipl v8.4 on some systems

Summary

On some systems, SIGTERM (e.g. using kill) doesn't terminate the swipl process. SIGKILL (e.g. kill -9) does still kill the process.

Background

We first ran into this issue after trying to use v8.4.0 for TerminusDB. We didn't have the problem with v8.2.4 and earlier.

The problem has appeared on Debian Linux and macOS, but not on every system or installation of SWI-Prolog. In particular, it doesn't appear on the official Docker images for swipl:8.2.4 and swipl:8.4.1. Also, a previous SWI-Prolog v8.4.0 on macOS did not exhibit the problem, but one v8.4.1 installed from source does exhibit it.

The problem showed up in some TerminusDB unit tests, which spawn a swipl process using process_create(..., ..., [process(PID), ...]), kill the process using process_kill(PID), and wait for the process using process_wait(PID, _). The process_wait would hang indefinitely. If we change process_kill(PID) to process_kill(PID, 9), process_wait does not hang.

We also confirmed that, after simply running swipl (with no arguments) and looking up the process ID with either ps or the predicate process_id, we could not kill the swipl process from another shell.

Conclusion

This is the only remaining issue we've encountered that prevents us from upgrading to SWI-Prolog v8.4 for TerminusDB. We can work around it in our tests using process_kill(PID, 9). But it does make us wonder what's happening.

It may be difficult to debug this problem if you can't reproduce it yourself. If you can give us any suggestions on what to try or where to look, we'd be happy to help.

pl-arith.c errors

I am getting this error with the latest version of swipl form git. ( or from here: http://www.swi-prolog.org/download/stable/src/swipl-7.2.2.tar.gz)

During the 'make' step:

rm -f libtai.a
ar cq libtai.a tai_add.o tai_now.o tai_pack.o tai_sub.o tai_unpack.o taia_add.o taia_approx.o taia_fmtfrac.o taia_frac.o taia_half.o taia_less.o taia_now.o taia_pack.o taia_sub.o taia_tai.o taia_unpack.o caldate_fmt.o caldate_scan.o caldate_fmjd.o caldate_mjd.o caldate_norm.o caldate_ster.o leapsecs_read.o leapsecs_init.o leapsecs_add.o leapsecs_sub.o caltime_fmt.o caltime_scan.o caltime_tai.o caltime_utc.o
ranlib libtai.a
make[2]: Leaving directory `/home/arenduc1/source-pkgs/swipl/src/libtai'
gcc -c -I. -I. -I./rc -Wall -O2 -fPIC -fno-strict-aliasing -pthread -fPIC  pl-atom.c -o pl-atom.o
gcc -c -I. -I. -I./rc -Wall -O2 -fPIC -fno-strict-aliasing -pthread -fPIC  pl-wam.c -o pl-wam.o
In file included from pl-wam.c:2691:0:
pl-wam.c: In function ‘PL_next_solution’:
pl-vmi.c:3392:3: warning: label ‘can_bind’ defined but not used [-Wunused-label]
gcc -c -I. -I. -I./rc -Wall -O2 -fPIC -fno-strict-aliasing -pthread -fPIC  pl-arith.c -o pl-arith.o
pl-arith.c: In function ‘ar_getbit’:
pl-arith.c:2639:3: error: unknown type name ‘mp_bitcnt_t’
pl-arith.c:2650:19: error: ‘mp_bitcnt_t’ undeclared (first use in this function)
pl-arith.c:2650:19: note: each undeclared identifier is reported only once for each function it appears in
pl-arith.c:2651:18: error: expected ‘)’ before numeric constant
pl-arith.c: At top level:
pl-arith.c:3372:1: warning: ‘ar_random_float’ defined but not used [-Wunused-function]
make[1]: *** [pl-arith.o] Error 1
make[1]: Leaving directory `/home/arenduc1/source-pkgs/swipl/src'
make: *** [lite] Error 2

Where can I get an older stable version to install? Or how do I resolve this issue? I am installing on a debian machine without sudo access.

ctrl + arrow key combinations not working as expected

Previously opened in the wrong repository.

The ctrl + arrow keys ( or ) combinations are used to move cursor by word in most terminals. But, it seems that these keys are not mapped in SWI-Prolog interpreter.

Below are the screen recordings to help understanding:

swi-prolog

Here is how gprolog behaves:

gnu-prolog

arg/3 with attributed variable as first argument

The following code works as expected:

?- arg(N,t(_,_,_),_), N in 2..3.
N = 2 ;
N = 3.

However, this code does not:

?- N in 2..3, arg(N,t(_,_,_),_).
ERROR: arg/3: Arguments are not sufficiently instantiated

I get the same behavior if I replace N in 2..3 with freeze(N,(N=2;N=3)).

However, if I replace arg(N,t(_,_,_),_) with between(1,3,N) all examples work correctly.

This seems to be an interaction between arg/3 and attributed variables. I wasn't sure how to go about fixing this myself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.