XPCE version on Linux? Have REPL running

#1

I first tried building SWI-Prolog using the GitHub repo via the Ninja pathway and everything built fine.
I did install all the pre-build libraries as those docs specified. But I can’t find an executable anywhere, not even after doing an updatedb and a locate -r "swipl$ which only listed 2 directories named swipl. (Note: A confusing statement in the build documents is that you should upgrade CMake on Linux to version 3.5, yet the rest of the text says to install using version 3.1.2. I just went ahead with the 3.1.2 instructions and it worked fine, just no executable to be found.)

So I switched to the PPA route and that worked. Now I have the SWI-Prolog text-only REPL running fine on Linux. Is there any way to get the full XPCE interface running too, editor and debugger, or is that pair of software elements a Windows only thing? If I can have them on Linux, please link me the document that tells me how to do this.

#2

The system is in <CMAKE_INSTALL_PREFIX>/bin/swipl. CMAKE_INSTALL_PREFIX is by default /usr/local on Unix-like sytems. Possibly locate doesn’t do its job there? If you want to know, use

$ grep CMAKE_INSTALL_PREFIX CMakeCache.txt 
CMAKE_INSTALL_PREFIX:STRING=/home/jan/cmake/linux

CMAKE.md explains how to install the latest stable binary from cmake.org. That was 3.12 at the time of writing. On all Linux systems except for a few old long term release versions from conservative distros the default version will be recent enough.

For the PPA, install swi-prolog-x to get XPCE support.

1 Like
#3

Thanks Jan. I’ve got swi-prolog-x now. Are there instructions on how to launch it?

#4

It makes commands such a ?- emacs., ?- gtrace., ?- gxref. etc. work from the swipl prompt. There is no overall menu. If you want that, build from source and make sure you have Qt installed. That will create swipl-win, providing the same as the app for MacOS.

1 Like
#5

Thanks. Where can I find a list of those commands and what they do?

#6

I’m afraid all over the place :frowning: Once you have one of the graphical development tools open most of the related features can be accessed from menus though. There is quite a lot: debugger, profiler, cross-referencer, thread monitor (shows CPU and memory usage of all threads), etc.

A good introduction on how to use the SWI-Prolog development tools would be great to have. Even better would be someone new asking a lot of questions such that it becomes clear what is not easy to find. Next this can be improved with documentation or hints/menus/…

1 Like
#7

So there is no part of the source code for the REPL that has big switch statement for each command? Or are the commands all in separate modules and are being “located” via Prolog unification so that there isn’t a central code file that acts as a router?

#8

No. The things you can call from the toplevel to manage the environment are just predicates. They can be defined anywhere and even be subject to auto loading. For example, listing/1 is in the library, but normally not loaded as normal applications do not need it (often). If you type

?- listing(mypred).

It will autoload listing/1 from library(listing) and listing/1 in turn will search for mypred in various places and list it.

You can extend this as you seem fit in ~/.swiplrc or your private library in ~/lib/prolog

1 Like
#9

Thanks again Jan.

And as the tutorial below says “Shucky Darn!”:

http://www.pathwayslms.com/swipltuts/html/index.html

:upside_down_face: