Difficulty installing SWEEP

When trying to start sweep-mode I get this error “Symbol’s function definition is void: sweeprolog-initialize”

The following is in my .emacs file

‘’’
(require 'sweeprolog)
(setq sweeprolog-swipl-path “/bin/swipl”)
;; add-to-list 'sweeprolog-initialize swipl)
;; (add-to-list ‘auto-mode-alist ‘("\.pl?\’" . sweeprolog-mode))
‘’’

I am running:

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2023-03-19
sweeprolog 0.17.0 installed Embedded SWI-Prolog

Hi there,
That error message is a bit odd–basically sweeprolog-initialize is defined in a C module that we ensure gets loaded before this function, and others, are called.
When this module is loaded you should see a message saying something like:

Loading /usr/local/lib/swipl/lib/x86_64-darwin/sweep-module.so (module)...done

Do you see this message? You can inspect previous messages with C-h e.

If possible, could you elaborate on how you’ve tried to start sweeprolog-mode when you got this error? Lastly, what does your SWI-Prolog installation look like? Does check_installation/0 report any Sweep-related issues when you run it in the top-level?

Cheers

  1. Mode start method

Both “M-x sweeprolog-mode ” and “M-x sweep-mode ” produce this error. Also, emacs begins to run so slow it impairs the function of other programs, like the Chrome browser, on the Linux Mint virtual machine with 4 cores and 16GB of memory.

  1. C-h e
For information about GNU Emacs and the GNU system, type C-h C-a.
sweeprolog-init: Symbol’s function definition is void: sweeprolog-initializeError during redisplay: (eval (when (sweeprolog-buffer-loaded-since-last-modification-p) "/Loaded")) signaled (void-function sweeprolog-initialize)
Error during redisplay: (eval (when (sweeprolog-buffer-loaded-since-last-modification-p) "/Loaded")) signaled (void-function sweeprolog-initialize)
eldoc error: (void-function sweeprolog-initialize)
Error during redisplay: (eval (when (sweeprolog-buffer-loaded-since-last-modification-p) "/Loaded")) signaled (void-function sweeprolog-initialize) [4 times]
Mark set
Error during redisplay: (eval (when (sweeprolog-buffer-loaded-since-last-modification-p) "/Loaded")) signaled (void-function sweeprolog-initialize)
  1. check_installation/0
trent@trent-virtual-machine:~$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.8)
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).

?- check_installation
|    .
% Checking your SWI-Prolog kit for common issues ...
% 
% Version: ............. 9.1.8
% Address bits: ........ 64
% Architecture: ........ x86_64-linux
% Installed at: ........ /usr/lib/swi-prolog
% Cores: ............... 4
% 
% Checking tcmalloc ............................ not present
Warning: See http://www.swi-prolog.org/build/issues/tcmalloc.html
% Checking gmp ................................. ok
% Loading library(archive) ..................... ok
%   Supported filters: bzip2, compress, gzip, grzip, lrzip, lzip, lzma, lzop, none, rpm, uu, xz
%   Supported formats: 7zip, ar, cab, cpio, empty, gnutar, iso9660, lha, mtree, rar, raw, tar, xar, zip
% Loading library(cgi) ......................... ok
% Loading library(crypt) ....................... ok
Warning: library(bdb) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/bdb.html
% Loading library(double_metaphone) ............ ok
% Loading library(filesex) ..................... ok
% Loading library(http/http_stream) ............ ok
% Loading library(http/json) ................... ok
% Loading library(http/jquery) ................. ok
%   jQuery from /usr/share/javascript/jquery/jquery.min.js
% Loading library(isub) ........................ ok
Warning: library(jpl) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/jpl.html
% Loading library(memfile) ..................... ok
Warning: library(odbc) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/odbc.html
% Loading library(pce) ......................... ok
% Loading library(pcre) ........................ ok
% Loading library(pdt_console) ................. ok
% Loading library(porter_stem) ................. ok
% Loading library(process) ..................... ok
% Loading library(protobufs) ................... ok
% Loading library(editline) .................... ok
% Loading library(readline) .................... ok
% Loading library(readutil) .................... ok
% Loading library(rlimit) ...................... ok
% Loading library(semweb/rdf_db) ............... ok
% Loading library(semweb/rdf_ntriples) ......... ok
% Loading library(semweb/turtle) ............... ok
% Loading library(sgml) ........................ ok
% Loading library(sha) ......................... ok
% Loading library(snowball) .................... ok
% Loading library(socket) ...................... ok
% Loading library(ssl) ......................... ok
Warning: library(sweep_link) ................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/sweep_link.html
% Loading library(crypto) ...................... ok
% Loading library(syslog) ...................... ok
% Loading library(table) ....................... ok
% Loading library(time) ........................ ok
% Loading library(tipc/tipc) ................... ok
% Loading library(unicode) ..................... ok
% Loading library(uri) ......................... ok
% Loading library(uuid) ........................ ok
% Loading library(zlib) ........................ ok
% Loading library(yaml) ........................ ok
Warning: Found 5 issues.
true.

Thanks for your assistance thus far

% Checking your SWI-Prolog kit for common issues ...
% 
% Version: ............. 9.1.8
% Address bits: ........ 64
% Architecture: ........ x86_64-linux
% Installed at: ........ /usr/lib/swi-prolog
% Cores: ............... 4
% 
% Checking tcmalloc ............................ not present
Warning: See http://www.swi-prolog.org/build/issues/tcmalloc.html
% Checking gmp ................................. ok
% Loading library(archive) ..................... ok
%   Supported filters: bzip2, compress, gzip, grzip, lrzip, lzip, lzma, lzop, none, rpm, uu, xz
%   Supported formats: 7zip, ar, cab, cpio, empty, gnutar, iso9660, lha, mtree, rar, raw, tar, xar, zip
% Loading library(cgi) ......................... ok
% Loading library(crypt) ....................... ok
Warning: library(bdb) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/bdb.html
% Loading library(double_metaphone) ............ ok
% Loading library(filesex) ..................... ok
% Loading library(http/http_stream) ............ ok
% Loading library(http/json) ................... ok
% Loading library(http/jquery) ................. ok
%   jQuery from /usr/share/javascript/jquery/jquery.min.js
% Loading library(isub) ........................ ok
Warning: library(jpl) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/jpl.html
% Loading library(memfile) ..................... ok
Warning: library(odbc) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/odbc.html
% Loading library(pce) ......................... ok
% Loading library(pcre) ........................ ok
% Loading library(pdt_console) ................. ok
% Loading library(porter_stem) ................. ok
% Loading library(process) ..................... ok
% Loading library(protobufs) ................... ok
% Loading library(editline) .................... ok
% Loading library(readline) .................... ok
% Loading library(readutil) .................... ok
% Loading library(rlimit) ...................... ok
% Loading library(semweb/rdf_db) ............... ok
% Loading library(semweb/rdf_ntriples) ......... ok
% Loading library(semweb/turtle) ............... ok
% Loading library(sgml) ........................ ok
% Loading library(sha) ......................... ok
% Loading library(snowball) .................... ok
% Loading library(socket) ...................... ok
% Loading library(ssl) ......................... ok
Warning: library(sweep_link) ................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/sweep_link.html
% Loading library(crypto) ...................... ok
% Loading library(syslog) ...................... ok
% Loading library(table) ....................... ok
% Loading library(time) ........................ ok
% Loading library(tipc/tipc) ................... ok
% Loading library(unicode) ..................... ok
% Loading library(uri) ......................... ok
% Loading library(uuid) ........................ ok
% Loading library(zlib) ........................ ok
% Loading library(yaml) ........................ ok
Warning: Found 5 issues.

Thanks,

check_installation/0 says that the Sweep module wasn’t built along with your SWI-Prolog installation, which would certainly prevent you from using Sweep :frowning:

If you build SWI-Prolog from source, make sure that the header file emacs-module.h is present in your search path for include files–otherwise it won’t build the Sweep module since it relies on this header.

Should/do you want “Installing from PPA (Ubuntu Personal Package Archive)” [Development version] install sweep and its Emacs dependency or not? (Thereby requiring a build-from-source to use sweep.)

Is that how you’ve installed your current SWI-Prolog?

I don’t know enough about the PPA packaging to give a definitive answer, but I think we want all SWI-Prolog distributions to include Sweep if possible. Specifying Emacs as a hard dependency of SWI-Prolog is probably undesirable though. @jan what do you think?

Yes. I just tried to reinstall it that way. Emacs 30-something is installed, but get the same error.

‘’’

trent@trent-virtual-machine:~$ sudo apt-add-repository ppa:swi-prolog/devel
[sudo] password for trent:             
You are about to add the following PPA:
 Official PPAs for SWI-Prolog.  See https://www.swi-prolog.org for further information.
 More info: https://launchpad.net/~swi-prolog/+archive/ubuntu/devel
Press Enter to continue or Ctrl+C to cancel

gpg: keybox '/.../*.keyring' created
gpg: key *: public key "Launchpad PPA for SWI Prolog" imported
gpg: Total number processed: 1
gpg:               imported: 1
trent@trent-virtual-machine:~$ sudo apt-get update

.
.
.

trent@trent-virtual-machine:~$ sudo apt-get install swi-prolog
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
swi-prolog is already the newest version (9.1.8-2-g886ff1196-jammyppa2).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
trent@trent-virtual-machine:~$ sudo apt-get install swi-prolog --upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
swi-prolog is already the newest version (9.1.8-2-g886ff1196-jammyppa2).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
trent@trent-virtual-machine:~$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.8)
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).

?- check_installation
|    .
% Checking your SWI-Prolog kit for common issues ...
% 
% Version: ............. 9.1.8
% Address bits: ........ 64
% Architecture: ........ x86_64-linux
% Installed at: ........ /usr/lib/swi-prolog
% Cores: ............... 4
% 
% Checking tcmalloc ............................ not present
Warning: See http://www.swi-prolog.org/build/issues/tcmalloc.html
% Checking gmp ................................. ok
% Loading library(archive) ..................... ok
%   Supported filters: bzip2, compress, gzip, grzip, lrzip, lzip, lzma, lzop, none, rpm, uu, xz
%   Supported formats: 7zip, ar, cab, cpio, empty, gnutar, iso9660, lha, mtree, rar, raw, tar, xar, zip
% Loading library(cgi) ......................... ok
% Loading library(crypt) ....................... ok
Warning: library(bdb) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/bdb.html
% Loading library(double_metaphone) ............ ok
% Loading library(filesex) ..................... ok
% Loading library(http/http_stream) ............ ok
% Loading library(http/json) ................... ok
% Loading library(http/jquery) ................. ok
%   jQuery from /usr/share/javascript/jquery/jquery.min.js
% Loading library(isub) ........................ ok
Warning: library(jpl) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/jpl.html
% Loading library(memfile) ..................... ok
Warning: library(odbc) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/odbc.html
% Loading library(pce) ......................... ok
% Loading library(pcre) ........................ ok
% Loading library(pdt_console) ................. ok
% Loading library(porter_stem) ................. ok
% Loading library(process) ..................... ok
% Loading library(protobufs) ................... ok
% Loading library(editline) .................... ok
% Loading library(readline) .................... ok
% Loading library(readutil) .................... ok
% Loading library(rlimit) ...................... ok
% Loading library(semweb/rdf_db) ............... ok
% Loading library(semweb/rdf_ntriples) ......... ok
% Loading library(semweb/turtle) ............... ok
% Loading library(sgml) ........................ ok
% Loading library(sha) ......................... ok
% Loading library(snowball) .................... ok
% Loading library(socket) ...................... ok
% Loading library(ssl) ......................... ok
Warning: library(sweep_link) ................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/sweep_link.html
% Loading library(crypto) ...................... ok
% Loading library(syslog) ...................... ok
% Loading library(table) ....................... ok
% Loading library(time) ........................ ok
% Loading library(tipc/tipc) ................... ok
% Loading library(unicode) ..................... ok
% Loading library(uri) ......................... ok
% Loading library(uuid) ........................ ok
% Loading library(zlib) ........................ ok
% Loading library(yaml) ........................ ok
Warning: Found 5 issues.
true.

?- halt.

‘’’

Summary

This text will be hidden

How do you install sweep with a apt package without also installing Emacs? In a sand-boxed environment like you’d get with a Snap or Flatpack, I guess you could just include what you want. I haven’t played with a swi-prolog Snap, but it might be really ideal for working through the Tate book like I’m doing (slowly). A snap would also be very useful for those getting a BS in computer science getting an into to logic programming.

1 Like

Thanks!

I built from scratch. All tests pass. All check_installation items are OK.

1 Like

I’m getting the same error on M1 Mac on the latest MacPorts build:

➜ swipl
% The graphical front-end will be used for subsequent tracing
Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.8)
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).

?- check_installation. 
% Checking your SWI-Prolog kit for common issues ...
% 
% Version: ............. 9.1.8
% Address bits: ........ 64
% Architecture: ........ arm64-darwin
% Installed at: ........ /opt/local/lib/swipl
% Cores: ............... 10
% 
% Checking gmp ................................. ok
% Loading library(archive) ..................... ok
%   Supported filters: bzip2, compress, gzip, grzip, lrzip, lzip, lzma, lzop, none, rpm, uu, xz
%   Supported formats: 7zip, ar, cab, cpio, empty, gnutar, iso9660, lha, mtree, rar, raw, tar, xar, zip
% Loading library(cgi) ......................... ok
% Loading library(crypt) ....................... ok
% Loading library(bdb) ......................... ok
% Loading library(double_metaphone) ............ ok
% Loading library(filesex) ..................... ok
% Loading library(http/http_stream) ............ ok
% Loading library(http/json) ................... ok
% Loading library(http/jquery) ................. ok
%   jQuery from /opt/local/lib/swipl/library/http/web/js/jquery-3.6.0.min.js
% Loading library(isub) ........................ ok
Warning: library(jpl) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/jpl.html
% Loading library(memfile) ..................... ok
Warning: library(odbc) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/odbc.html
% Loading library(pce) ......................... ok
% Loading library(pcre) ........................ ok
% Loading library(pdt_console) ................. ok
% Loading library(porter_stem) ................. ok
% Loading library(process) ..................... ok
% Loading library(protobufs) ................... ok
% Loading library(editline) .................... ok
% Loading library(readline) ...Thread 1 (main): foreign predicate system:rl_wrap/0 did not clear exception:
        error(type_error(bool,readline),context(system:rl_wrap/0,_31802))
................................................ ok
% Loading library(readutil) .................... ok
% Loading library(rlimit) ...................... ok
% Loading library(semweb/rdf_db) ............... ok
% Loading library(semweb/rdf_ntriples) ......... ok
% Loading library(semweb/turtle) ............... ok
% Loading library(sgml) ........................ ok
% Loading library(sha) ......................... ok
% Loading library(snowball) .................... ok
% Loading library(socket) ...................... ok
% Loading library(ssl) ......................... ok
Warning: library(sweep_link) ................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/sweep_link.html
% Loading library(crypto) ...................... ok
% Loading library(syslog) ...................... ok
% Loading library(table) ....................... ok
% Loading library(time) ........................ ok
% Loading library(unicode) ..................... ok
% Loading library(uri) ......................... ok
% Loading library(uuid) ........................ ok
% Loading library(zlib) ........................ ok
% Loading library(yaml) ........................ ok
Warning: Found 3 issues.
true.

Homebrew seems to have built sweep, so I guess I’ll use homebrew’s swipl (which didn’t build with graphical xpce. Oh well. An issue for another time. So maybe there’s some magic incantation for us to get right when building on Macports? Anyways, certainly didn’t “just work”. Working now, and it’s already a huge jump in quality-of-life! Rejoice :raised_hands:

Most likely emacs-module.h is not installed in a place where it can be found. It should be part of Emacs. I’m still wondering whether it might be a better idea to distribute this header along with SWI-Prolog’s sweep package, so we can always build the interface. But, of course, redistributing the header for a package you want to interface too is bad practice :frowning: