Upgrade Prolog 7.2.3 32 bits to 64 bits on Raspberry Pi?

Hello!

I am a total beginner and I am trying to connect Python and Prolog using PySWIP on a Raspberry Pi 3, Model B. There seems to be an issue since I have installed SWI-Prolog 32 bits, version 7.2.3, whereas Python version 2.7.13 is 64 bits, and these should both be either 32 or 62 bits versions.

I have searched for solutions on whether it is possible to download a newer version of SWI-Prolog (64 bits) on the Raspberry Pi 3, and if so, how to do it.

Any assistance would be much appreciated.

Thanks,
Lars

Have you seen?

Building SWI-Prolog for the Raspberry Pi

I have not used this so can’t attest if it worked/works.


Also do a search of the SWI-Prolog documentation, e.g.

image

Yes, Raspberry 3, Model B, thanks! Yes, I have seen this (and many other articles), but have not managed to understand what is going on. The Raspberry has Linux 9 (Stretch), which should have GCC 6.3.0. When I try to update Prolog I receive the message that I have the newest version (7.2.3+dfsg-6) 32 bits.

Again I have not done this but my understanding is

  1. I agree that both Python and SWI-Prolog both need to be at same bit-ness for this to work, either both 64-bit or both 32-bit.
  2. You should be on newer versions of the software. Python 2.x is no longer supported and SWI-Prolog 7.x is so old that everyone will tell you to upgrade to 8.3.x.
  3. You will have to build SWI-Prolog for use with Raspberry Pi. There are no ready to download builds of SWI-Prolog for Raspberry Pi. That is because Raspberry Pi uses ARM processors and there is not a great demand for this variation of SWI-Prolog it is not a standard part of the build and distribute process.

You might also consider creating a Docker image for building this variation. As an example there is GitHub - SWI-Prolog/docker-swipl-build-mingw: Docker to cross-compile SWI-Prolog for Windows. Just modify it for building the Raspberry Pi version.


Also there is the Prolog Language Server which might satisfy your needs and is so new you could be the first to try it with Raspberry Pi.

Prolog Language Server: Enabling swipl integration with Python and other languages

Ok, thank you for the context explanation and tips on how to move forward!

You can just compile the whole system on any Pi. Just follow the normal download and build instructions for Linux, taking the Debian dependency list. On a model 3 it takes quite a while for the whole system :slight_smile:

1 Like

Thanks! I have (I think) followed the instructions and have a now installed version 8.3.28-27-g284ce5073. It says however, that this too is a 32 bits version and not the 64 bits I am looking for.

The are two other things I do not understand,

  1. I cannot open the program with the swipl command in terminal (did not find command), but I can open it in terminal by clicking on shortcut icon in the pi/bin folder.

  2. When open (by clicking on the shortcut and open in terminal), it does not anymore query the .pl files in the pi folder.

If anyone has the patience to further guide me I’d be much obliged.

I’m not entirely up to date with Raspbian wrt 32/64 bit. For a long time it was just a 32-bit Linux system. If it is now hybrid, is it possible that its default compiler toolchain still produces 32-bit binaries?

You should either edit ~/.bashrc to include $HOME/bin in $PATH or install to e.g. /usr/local/bin rather than in the user’s home. Again, I don’t have a pi right here, so I cannot give the exact instructions. Hopefully someone can help …

Note that it should also work to start as ~/bin/swipl ....

I hate to say this but I think the total number of users here who have done what you seek is zero. That does not mean we will not try and help but that you will probably get no responses to that request. At this point your guesses are as good as mine but I will note that before the SWI-Prolog forum moved to Discourse it was on Google Groups (SWI-Prolog on Google Groups) and there are some related messages there. Also many of the users there did transition to this forum but are not that active here. I would note them by name but in this case I don’t think they have anything more to offer than what is posted.

Search results: (https://groups.google.com/g/swi-prolog/search?q=Raspberry%20Pi)


Also in general searching I am finding lots of references to

sudo apt-get install swi-prolog

but that seems to be what I take it you used to get SWI-Prolog version 7.2.3 32-bit installed.


Also, while I would like to boot up my Raspberry Pi and do this, the timing is really bad for me right now.