friguzzi / cplint

cplint is a suite of programs for reasoning with probabilistic logic programs
Other
67 stars 14 forks source link

Problems in pita.pl : yield bddem errors #24

Closed hakank closed 5 years ago

hakank commented 5 years ago

Today I wanted to test some cplint programs on my local machine, e.g. the program from http://cplint.eu/p/urns_and_balls1.swinb , and got a lot of errors. (There's no such error when running the cplint.eu SWISH programs.)

$ swipl urns_and_balls.pl """ ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:add_abd_var/4 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:end_ex/1 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:init_em/1 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:add_var/4 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:init_ex/2 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:add_query_var/4 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:em/9 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:init/1 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:end_em/1 is not defined

Welcome to SWI-Prolog (threaded, 64 bits, version 7.7.18-18-g82c1e9564-DIRTY) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details.

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

I have removed/installed both the cplint and dbdem package in swipl and got the same errors. Here's the log of the upgrades: """ ?- pack_upgrade(cplint). % Running "git fetch" in '/home/hakank/lib/swipl/pack/cplint' % Package "cplint" is up-to-date true.

?- pack_upgrade(bddem). % Running "git fetch" in '/home/hakank/lib/swipl/pack/bddem' % Package "bddem" is up-to-date true. """

My SWI Prolog version is 7.7.18-18-g82c1e9564-DIRTY.

Best,

Hakan

friguzzi commented 5 years ago

Try pack_rebuild(bddem) Which os are you using?

hakank commented 5 years ago

Thanks for the suggestion. I run this on a Linux Ubuntu 18.04 LTS box.

1) I tried pack_rebuild(bddem) and first got problems since that SWI-package had the Makefile.temp with CC defined as CC=/usr/local/bin/gcc-8

After I symlinked /usr/bin/gcc to /usr/bin/gcc the rebuild worked.

(I checked the version of bddem at Github, https://github.com/friguzzi/bddem/blob/master/Makefile.temp and there CC is defined just as gcc: CC=gcc )

However, when running the bddem's run_tests/0 it give a similar error: $ swipl ?- use_module(library(bddem_test)). true.

?- run_tests. """ % PL-Unit: prob ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:22: test one: received error: plunit_prob:'unit body'/2: Undefined procedure: bddem:init/1 However, there are definitions for: bddem:init/3 ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:29: test and: received error: plunit_prob:'unit body'/2: Undefined procedure: bddem:init/1 However, there are definitions for: bddem:init/3 ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:38: test or: received error: plunit_prob:'unit body'/2: Undefined procedure: bddem:init/1 However, there are definitions for: bddem:init/3 ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:47: test nor: received error: plunit_prob:'unit body'/2: Undefined procedure: bddem:init/1 However, there are definitions for: bddem:init/3 done % PL-Unit: em ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:65: test one: received error: plunit_em:'unit body'/2: Undefined procedure: bddem:init_em/1 done % 5 tests failed % 0 tests passed false. """

Also, I got the same problem as before when running a Pita programs. Here's an example running a program from the SWI pack distribution: $ cd /home/hakank/lib/swipl/pack/cplint/prolog/examples $ swipl persons.pl """ ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:add_abd_var/4 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:end_ex/1 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:init_em/1 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:add_var/4 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:init_ex/2 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:add_query_var/4 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:em/9 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:init/1 is not defined ERROR: /home/hakank/lib/swipl/pack/cplint/prolog/pita.pl:42: Exported procedure bddem:end_em/1 is not defined Welcome to SWI-Prolog (threaded, 64 bits, version 7.7.18-18-g82c1e9564-DIRTY) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details.

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

friguzzi commented 5 years ago

Try reinstalling the package using the git source instead of the zip file

hakank commented 5 years ago

The process of first removing and then installing bddem from Git and then rebuilding worked without any problems.

However, when loading bddem, there are errors.

$ swipl """ ?- use_module(library(bddem)). ERROR: Exported procedure bddem:add_abd_var/4 is not defined ERROR: Exported procedure bddem:init_ex/2 is not defined ERROR: Exported procedure bddem:add_query_var/4 is not defined ERROR: Exported procedure bddem:em/9 is not defined ERROR: Exported procedure bddem:add_var/4 is not defined ERROR: Exported procedure bddem:end_ex/1 is not defined ERROR: Exported procedure bddem:init_em/1 is not defined ERROR: Exported procedure bddem:end_em/1 is not defined ERROR: Exported procedure bddem:init/1 is not defined true. """

Same with testing via "bddem_test" library:

$ swipl ?- use_module(library(bddem_test)). """ ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:4: Exported procedure bddem:add_var/4 is not defined ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:4: Exported procedure bddem:end_ex/1 is not defined ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:4: Exported procedure bddem:init_em/1 is not defined ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:4: Exported procedure bddem:end_em/1 is not defined ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:4: Exported procedure bddem:add_query_var/4 is not defined ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:4: Exported procedure bddem:em/9 is not defined ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:4: Exported procedure bddem:init/1 is not defined ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:4: Exported procedure bddem:add_abd_var/4 is not defined ERROR: /home/hakank/lib/swipl/pack/bddem/prolog/bddem_test.pl:4: Exported procedure bddem:init_ex/2 is not defined true. """

friguzzi commented 5 years ago

I tried a reinstall on my system Ubuntu 18.04.1

rzf@cpr:~/lib/swipl/pack$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 7.7.20-63-g9d33c3f81)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

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

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

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

?- run_tests.
% PL-Unit: prob .... done
% PL-Unit: em -8.182497543790239e-5
[[1,[3.0471422788891367e-5,0.9999695285772111]],[0,[0.41697539991953203,0.583024600080468]]]
[0.9999663333853958,0.9999759213928441,0.9999759213928441]
. done
% All 5 tests passed
true.

Can you try with swipl 7.7.20?

hakank commented 5 years ago

Found it!

It was the trill package that contained an old bddem.so. After removing the trill package it worked.

/Hakan