# Building SWI-Prolog on Ubuntu 20.04 from source, how sensitive is cmake to \`-DCMAKE\_INSTALL\_PREFIX\`?

**URL:** <https://swi-prolog.discourse.group/t/building-swi-prolog-on-ubuntu-20-04-from-source-how-sensitive-is-cmake-to-dcmake-install-prefix/3115>\
**Category:** General\
**Created:** [October 30, 2020, 11:03am UTC](https://swi-prolog.discourse.group/t/building-swi-prolog-on-ubuntu-20-04-from-source-how-sensitive-is-cmake-to-dcmake-install-prefix/3115 "2020-10-30T11:03:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [October 30, 2020, 11:03am UTC](https://swi-prolog.discourse.group/t/building-swi-prolog-on-ubuntu-20-04-from-source-how-sensitive-is-cmake-to-dcmake-install-prefix/3115/1 "2020-10-30T11:03:36Z")

</div>

Built SWI-Prolog for the first time using [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/about) on Windows with a fresh version of [Ubuntu 20.04](https://www.microsoft.com/en-us/p/ubuntu-2004-lts/9n6svws3rx71?activetab=pivot:overviewtab) from the [Microsoft store](https://www.microsoft.com/en-us/store/apps/windows) following the instructions: [SWI-Prolog – Installation on Linux, \*BSD (Unix)](https://www.swi-prolog.org/build/unix.html)

The first time used (`$HOME`)

```prolog
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](https://docs.microsoft.com/en-us/windows/wsl/install-manual) (think spinning up a new virtual machine or creating a Docker image) so nothing carried over from the first time used (`/usr/bin`)

```prolog
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?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [October 30, 2020, 12:46pm UTC](https://swi-prolog.discourse.group/t/building-swi-prolog-on-ubuntu-20-04-from-source-how-sensitive-is-cmake-to-dcmake-install-prefix/3115/2 "2020-10-30T12:46:40Z")

</div>

> [@EricGT](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [October 30, 2020, 5:31pm UTC](https://swi-prolog.discourse.group/t/building-swi-prolog-on-ubuntu-20-04-from-source-how-sensitive-is-cmake-to-dcmake-install-prefix/3115/3 "2020-10-30T17:31:32Z")

</div>

Found a possibly small problem.

* * *

With

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

```

```prolog
?- 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](https://github.com/SWI-Prolog/swipl-devel/blob/7ed5968f50b68edf6d168e1852e04ae864d52409/library/check_installation.pl) find it leads to absolute\_file\_name/3 and find that it fails for `library(bdb)`.

The directories for the library are:

```prolog
?- 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

```bash
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

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

```

but actual is

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

```

I have not tried this rebuilding using just `/usr`, which is also what the [Dockerfile](https://github.com/SWI-Prolog/docker-swipl/blob/e890bf1885f30374ccb305a070aeeb19961d1972/8.2.2/stretch/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. 🙂

* * *

**EDIT**

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

```prolog
cmake -DCMAKE_INSTALL_PREFIX=/usr -G Ninja ..

```

```prolog
?- 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.

```

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [October 31, 2020, 4:22pm UTC](https://swi-prolog.discourse.group/t/building-swi-prolog-on-ubuntu-20-04-from-source-how-sensitive-is-cmake-to-dcmake-install-prefix/3115/4 "2020-10-31T16:22:28Z")

</div>

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.
