Building SWI-Prolog on Ubuntu 20.04 from source, how sensitive is cmake to `-DCMAKE_INSTALL_PREFIX`?

Built SWI-Prolog for the first time using WSL 2 on Windows with a fresh version of Ubuntu 20.04 from the Microsoft store following the instructions: SWI-Prolog – Installation on Linux, *BSD (Unix)

The first time used ($HOME)

cmake -DCMAKE_INSTALL_PREFIX=$HOME -G Ninja ..

and had many problems. While I could get swipl to run, many parts were missing.

Starting again with a new WSL distro (think spinning up a new virtual machine or creating a Docker image) so nothing carried over from the first time used (/usr/bin)

cmake -DCMAKE_INSTALL_PREFIX=/usr/bin -G Ninja ..

and the build completed successfully with not even a hiccup. Some of the versions need to be updated, e.g. Java, OpenSSL.

So was wondering how much the value for CMAKE_INSTALL_PREFIX makes a difference?

Very unlikely, maybe unless there are spaces in $HOME or in the directory path leading to the sources.

Found a possibly small problem.


With

cmake -DCMAKE_INSTALL_PREFIX=/usr/bin -G Ninja ..
?- check_installation.
Warning: library(bdb) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/bdb.html
Warning: library(jpl) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/jpl.html
Warning: library(odbc) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/odbc.html

Looking at the code for check_installation find it leads to absolute_file_name/3 and find that it fails for library(bdb).

The directories for the library are:

?- file_search_path(library,B).
B = lib ;
B = '/usr/lib/swi-prolog/library' ;
B = '/usr/lib/swi-prolog/library/clp' ;
B = pce('prolog/lib').

In checking the location of dbd.pl find

eric@WINDOWS-6F874NS:/usr/bin$ find / -xdev 2>/dev/null -name "bdb.pl"
/home/eric/swipl-devel/packages/bdb/bdb.pl
/home/eric/swipl-devel/build/home/library/bdb.pl
/usr/bin/lib/swipl/library/bdb.pl

So check_installation is expecting

/usr/lib/swi-prolog/library/bdb.pl

but actual is

/usr/bin/lib/swipl/library/bdb.pl

I have not tried this rebuilding using just /usr, which is also what the Dockerfile has and still looking to find where/how /usr/lib/swi-prolog/library is determined. Even if I use /usr if swi-prolog comes from something I do during the build, I don’t see where that is noted.

If you know something that can shed some light on this it would be helpful. :slightly_smiling_face:


EDIT

With (/usr) get Congratulations, your kit seems sound and complete!

cmake -DCMAKE_INSTALL_PREFIX=/usr -G Ninja ..
?- check_installation.
% Checking your SWI-Prolog kit for common issues ...
%
% Version: ............. 8.3.10-20-g170f753b5
% Address bits: ........ 64
% Architecture: ........ x86_64-linux
% Installed at: ........ /usr/lib/swipl
% Cores: ............... 4
%
% Checking tcmalloc ............................ ok
% 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 /usr/share/javascript/jquery/jquery.min.js
% Loading library(isub) ........................ ok
% Loading library(jpl) ......................... ok
% Loading library(memfile) ..................... ok
% Loading library(odbc) ........................ ok
% 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
% 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
%
% Congratulations, your kit seems sound and complete!
true.

Most likely missing dependencies or some other reason why the configuration of these packages failed. Best, run cmake .. in the build dir again and it will notably tell you about the problems it (still) has configuring everything.

Ideally the CMake files should be extended to print a summary of remaining issues at the end.