Can't build on Ubuntu

Right after cloning the latest swipl-devel repo, following CMAKE.md, I did

    cd swipl-devel
    mkdir build
    cd build
    cmake -G Ninja ..

Which produced the following error messages

CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

How can I fix this, to proceed with the build and later installation.

Sorry, I’m new to CMAKE, if there is a resource I should read first, it will be welcome. On the other hand, if you have some quick-fix commands, that will really help.

Thanks.

Have you tried this:

sudo apt install ninja-build

@peter.ludemann :

Thanks for the quick reply. That allows me to move one step forward. Still with some issues. I will try to summarize fixes, or issues if I reach a blocking one.

All running smoothly up to successful installation (after following all the installation instructions in full detail).

The only issue I still have is that after running check_installation in swipl, I get this issue:

% Loading library(janus) ....................... FAILED
Warning: Cannot load required shared library
Warning: See http://www.swi-prolog.org/build/issues/janus.html

I installed the ubuntu python packages mentioned in the above reference, but still get the same error, after repeating the whole build and installation sequence.

What I really need for my project is access from Python to Prolog, but it would be a lot nicer to have a completely clean installation, just in case I might need that package, eventually (might be likely).

Any further suggestions?

Thanks

I think the instructions at GitHub - SWI-Prolog/packages-swipy: Python interface for SWI-Prolog are relevant, especially its mention of pip install . to compile Janus-swi.

@brebs :

[Edited]

Thanks a lot for the suggestion. Yes, I ended up noticing that and made sure to install from the same source repo. I found something else: when I try to use the library from swipl, I get this message:

ERROR:    open_shared_object/3: libpython3.12.so.1.0: cannot open shared object file: No such file or directory

I installed python3.12, still with no better results.

After I removed all python3.12 components from my system, the build was completely successful, including package Janus. For your reference, I am running on python3.13.3

I think it is particularly vital that the versions of the Python dev package matches the version of the running Python system. Embedding Python into Prolog links to a particular version of the Python .so file. There is unfortunately no way around that (AFAIK).

Anyway, great you fixed it! Happy hacking :slight_smile: