Starting SWIPL on Linux

Hi.
I have just installed SWI Prolog on Linux, using GIT.
It appears to have downloaded a lot of files, so it appears to have installed it.

But I can’t find any file named “swipl”, so I can’t find out how to start prolog.
How can I start prolog?

I see that “prolog-devel/demo/README” says that to start Prolog I need to use “pl”, not “swipl”. Is this correct? The main SWI Prolog website says I need to use “swipl”.
If I need to use a command called “pl”, this is not helpful, because I can’t find a file named “pl” either.


Martin Sondergaard.

Martin,

Git usually is used to download source code, and not pre-built binaries that can be executed (like swipl).

  1. I would recommend you install swi-prolog using your distributions package manager (apt-get on ubuntu or debian-like linuxes).

  2. If you still want to build it from git (perhaps you want the latest and greatest version), you can follow the instructions in CMAKE.md which tell you how to build and install swi-prolog.

NOTE: yes, the reference to pl is quite outdated, it used to be the original name many centuries ago :slight_smile: It should probably be updated, but maybe it should be left there as a tribute to the length of time swi-prolog has been around :smile:

Hi Martin

On Ubuntu, I have a mini script that run the steps required to get executables swipl and swipl-win when Jan publishes a new release.

git clone https://github.com/SWI-Prolog/swipl-devel.git
cd swipl-devel
git submodule update --init
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$HOME ..
make -j
make install

The effect is to create (or update) 4 folders in $HOME: swipl-devel, bin, share and lib. Working in $HOME allows for unprivileged (non root) execution.

Usually I first rename the old ~/swipl-devel, and delete after a successful build.
Note, your system must have the prerequisites listed here (for a Debian based installation).

HTH, Carlo

Thank you for your replies.
I have just installed SWI Prolog from the software repository for my distro. It was easy, doing it that way.

I have noticed that this version is very slow when running the GUI tracer.
Is this still a problem with the latest version, or is that faster when running the tracer?


Martin.

The only problem I know is that the trace Windows and a few other windows of the GUI first show up empty and grey. This problem is related to some window managers, but unfortunately the more popular ones. The window draws if you move it a little or wait long enough.

That problem is still there and I have little clue on how to fix it. As far as I recall it is related to an X11 notification event that should happen but doesn’t.

That should work, but is rather slow. Some remarks:

  • make -j requires a big machine. It does everything concurrently that can be done concurrently and that is a lot since the move to CMake. Better use make -j N, where N is somewhat higher than the number of cores you have or lower if you want your machine to remain fast during the build.
  • For comfortable build, use ninja, typically in a package ninja.build or something similar:
    • Adjusts concurrency automatically, so no need for -j with the right value
    • Feedback on the same line, only showing warnings and errors
    • Faster, in particular for an update
    • add -G Ninja to the original cmake command to use Ninja
  • For update and specific builds, see CMAKE.md. Basically though
      git pull
      git submodule update --init
      cd build
      ninja
      ctest -j 8
      ninja install

ctest does require concurrency to be specified. You can of course also skip the test.

In the unlikely case it goes wrong, report, note the hash associated with the version before the update, do git checkout <hash> instead of the git pull above and rebuild the previous version.

1 Like

Just to confirm, ninja is about say 10 times faster than Make for updating? In particular, it seems much better at taking less time when less has changed.

BTW, I think Paulo mentioned this, it is possible to “help” discourse with the code block by specifying the language. For example, if I type this:

```
git submodule update --init
```

you see:

git submodule update --init

and if I type this:

```bash
git submodule update --init
```

you’ll see:

git submodule update --init

(it no longer thinks it’s SQL probably?)

PS: Found the post: When posting using mail, please use markdown

Is there a way to “pin” this some place that is easy to find?

Good idea; I just set it as a pinned topic :+1: